问题
In my EFM32LG controller I receive UART data from PORT C pin 1 as shown in the table below, which is taken from EFM32LG data sheet. I would like to read the whole byte and decide what LED to blink depending on the received byte.
Where can I see the whole received byte?
The data sheet is available here.
回答1:
You can read the first byte of the received data from from the USARTn_RXDATA
register. The registers and functionality of the USART unit are described starting on page 447 of this reference manual. You can also learn more about programming the EFM32 from the Silabs getting started guide.
I am not familiar with the EFM32, but from the datasheet it would look something like this:
uint8_t read_byte = USART0->RXDATA;
It is important that you enable the USART receiver first by setting the RXEN
bit.
USART0->CMD = USART0->CMD | (1 << RXEN);
来源:https://stackoverflow.com/questions/62683711/where-do-i-read-data-from-uart