uart_Interrput
This is an example of UART Interrput
-
Select the UART TX/RX pins
// in main.c #define CONFIG_UART_IO_TX_PORT GPIOA #define CONFIG_UART_IO_TX_PIN GPIO_Pin_01 #define CONFIG_UART_IO_TX_AF_MODE GPIO_AF_1 #define CONFIG_UART_IO_RX_PORT GPIOA #define CONFIG_UART_IO_RX_PIN GPIO_Pin_00 #define CONFIG_UART_IO_RX_AF_MODE GPIO_AF_1 -
Configure the parameters related to UART
// in main.c #define CONFIG_BAUD_RATE_VALUE 38400 UART_WordLength_8b //Data bit 8 UART_StopBits_1 //Stop bit 1 UART_Parity_No //No check bit UART_Mode_TxRx //Transmit-Receive Mode -
Select the UART interrupt mode
-
It can be modified according to the requirements
// in main.c UART_ITConfig(UART0, UART_IE_RXNEE_Msk, ENABLE);
Log
Use serial port with baudrate 38400, 8bit, no parity check
- SET different uart flag bits to enable interrupts
- Send the corresponding success log in the interrupt function