1949 views|1 replies

1w

Posts

16

Resources
The OP
 

MM32F031 Development Board Review 3: Lighting up D2 [Copy link]

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
  1. #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
  1. #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:
  1. #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


Latest reply

  Details Published on 2018-10-21 21:16
Personal signaturehttp://shop34182318.taobao.com/
https://shop436095304.taobao.com/?spm=a230r.7195193.1997079397.37.69fe60dfT705yr
 
 

152

Posts

0

Resources
2
Personal signature

欢迎大家来到电机驱动控制技术天地,一起在EEworld交流、学习。

 
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list