This is a general framework, we first open the serial port, and then type the data into u8 u16 type of rec_data years. Note look behind the green word can be known 'S''E' respectively represent the start and end of the protocol identifier, the bottom is determined that said transmitted data bytes is performed is between 0 ~ UART3_REC_NUM.
That is our normal execution order if in the function, then a second one in the compound statement else if, else if finally first in the compound statement.
Now, I release the first and third compound statement
The first number of bytes in a compound statement, we accepted in the serial interrupt accumulate
The third compound statement, we will rec_data in data into receive_str [uart_byte_count-1]
Finally, we will execute the code in the second compound statement
We there are two control statements if (strcmp (A, B) == 0) LED0 = 0; That is, if // A, B can be performed the same as the following statement
The 'A' is converted to A ASCLL code string, and then determination.
This code may be implemented to receive data from the PC board side, after the received data is sent back to the PC. The problem is as follows: 1. start running code, automatically transmit interrupt ...
See the function that is not clear in the interrupt? How to do? Ways to see below...
It seems that the hardware cleared the interrupt flag. Let's change our mind. I want an interrupt when the serial port send register is empty! #define UART_IT_TXE See it globally (...
STM32F031 serial port (RS485) interrupt + DMA transmission Preface GPIO transplantation process (some differences with F1 series) Serial port DMA Preface Recently I am working on the project of STM32F...
The HAL library is too rigid HAL serial port interrupt receiving The HAL library is too inflexible to use and has too many restrictions. If there is time later, a mixed operation of registers and HAL ...
Don't make fifo wheels, just use ready-made ones. There is the strongest FIFO based on C language written by humans in the linux kernel. Please search and study "Kfifo" by yourself, or my ot...
The key points of the above code are: 1, open the serial port free interrupt 2, serial port allows DMA request...
It is not to say that the data cannot be received without enabling the interrupt, just to prevent the program from interrupted to receive the reception of the serial port data when the serial port is ...
Environment: stm32f107, mdk The DMA channel of each serial port is different: Serial port configuration: u8 receive_data[1280]={0}; u8 RX_data[26] = {0}; void uart_init(u32 bound) { GPIO_InitTypeDef G...