This post was last edited by ddllxxrr on 2018-10-27 20:13 Those who have a board know what D2 refers to. Those who don't have a board may think it's a bomb. D2 refers to a blue LED on the mini board. The first thing to pay attention to is the chip. My chip is not MMF103 but MMF031C8T. The specific chip depends on the silk screen of the board you have. According to the schematic diagram:
It is obviously A8. Note that the two pins of A8 and D2 should be short-circuited. Because I studied it and found that the other end of D2 is connected to the power supply 3.3V, which means that A8 is on when it is low. Then, open the TOGGLE in the BLINK example in the example below
MM32F031xx_n_Lib_Samples_V2.08_SC.zip
(2.61 MB, downloads: 3)
and change it as follows: First, add A8 to led.h
- #define LED5_ON() GPIO_ResetBits(GPIOA,GPIO_Pin_8) // PA8 #define LED5_OFF() GPIO_SetBits(GPIOA,GPIO_Pin_8) // PA8 #define LED5_TOGGLE() (GPIO_ReadOutputDataBit(GPIOA,GPIO_Pin_8))?(GPIO_ResetBits(GPIOA,GPIO_Pin_8)):(GPIO_SetBits(GPIOA,GPIO_Pin_8)) // PA8
复制代码Then add the following during initialization: Initialization of A8
- #include "led.h" #include "HAL_rcc.h" /****************************************************************************************** **oˉêyD¢ £oLED_Init(void) **1|üèê £oLED3êˉ **êè2êy £oT **ê32êy £oT ****************************************************************** ****************************/ void LED_Init(void) { GPIO_InitTypeDef GPIO_InitStructure; RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA|RCC_AHBPeriph_GPIOB, ENABLE); // GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15|GPIO_Pin_8; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_Init(GPIOA, &GPIO_InitStructure); InitStructure.GPIO_Pin = GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_Init(GPIOB, &GPIO_InitStructure); LED1_OFF(); LED2_OFF(); LED3_OFF(); LED4_OFF(); }
复制代码Add LED5TOGGLE to the main function:
- #include "delay.h" #include "sys.h" #include "led.h" #include "uart.h" /************************************************************************************************** **oˉêyD¢ £omain(void) ** 1|üèê £o **êè2êy £oT **ê32êy £oT ******************************************************************************************************/ int main(void) { delay_init(); LED_Init(); while(1) //TT-· { LED1_TOGGLE(); LED2_TOGGLE(); LED3_TOGGLE(); LED4_TOGGLE(); LED5_TOGGLE(); delay_ms(1000); } }
复制代码Here is the video:
http://v.youku.com/v_show/id_XMz ... j.8428770.3416059.1 This content was originally created by EEWORLD forum user ddllxxrr. If you want to reprint or use it for commercial purposes, you must obtain the author's consent and indicate the source