4619 views|1 replies

111

Posts

0

Resources
The OP
 

MM32F103 lighting and serial port experiment [Copy link]

This post was last edited by serialworld on 2018-10-30 20:21 Use arm-gcc compiler and TrueStudio IDE integrated development environment. Directly use the startup file and connection file of STM32F103, refer to the DEMO program downloaded from the MM32 official website, and make simple modifications. When using the STM32 startup file, pay attention to the different naming of the interrupt function and the MM32 library function. For example: the serial port interrupt function STM32 definition: void USART1_IRQHandler(void), while MM32 is defined as void UART1_IRQHandler(void), and the corresponding startup file needs to be modified. include "delay.h" #include "sys.h" #include "led.h" #include "key.h" #include "uart.h" #include "uart_nvic.h" #include #include int _write(int32_t fd, char* ptr, int32_t len) { if (fd == STDOUT_FILENO || fd == STDERR_FILENO) { int32_t i = 0; while (i < len) { while (UART_GetFlagStatus(UART1, UART_IT_TXIEN) == RESET); UART_SendData(UART1, (uint8_t) ptr[i++]); // usart_data_transmit(EVAL_COM1, (uint8_t) ptr[i++]); // while (RESET == usart_flag_get(EVAL_COM1, USART_FLAG_TBE)) // ; } } return len; } int main(void) { u8 t=0; u8 len; u16 times=0; delay_init(); //Delay function initialization LED_Init(); //Initialize the hardware interface connected to the LEDKEY_Init(); //Initialize the hardware interface connected to the keyLED2=0; //Light up the LED // uart_initwBaudRate(115200u); NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);// Set the interrupt priority group 2 uart_nvic_init(115200); //Initialize the serial port to 115200 while(1) { // t=KEY_Scan(0); //Get the key value if(UART_RX_STA&0x8000) { len=UART_RX_STA&0x3fff; //Get the length of the data received this time printf("\r\n your message is \r\n"); for(t=0;t

Thanks for sharing

MM32F103 lighting and serial port experiment

MM32_1.PNG (16.15 KB, downloads: 0)

MM32_1.PNG

mm32.jpg (2.45 MB, downloads: 0)

mm32.jpg

mm32_1.jpg (135.27 KB, downloads: 0)

mm32_1.jpg

Latest reply

Thanks for sharing   Details Published on 2021-6-11 17:50
 
 

661

Posts

0

Resources
2
 

Thanks for sharing

 
 
 

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