UART without Interrupts

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
adpac_1560036
Level 4
Level 4
First like received First like given

Hi. Ive initialized my UART Rx Buffer to 24 Bytes in a Project to receive the bytes from a NEC Decoder. What would be the best way to read the data as the Receive on Rx ISR is internally handled (because buffer size is greater than 4).

0 Likes
1 Solution
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

When using the internal interrupt, you can register an interrupt handler at the UART component. Otherwise, you can do a busy wait by checking the size of the RX buffer.

View solution in original post

0 Likes
4 Replies
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

When using the internal interrupt, you can register an interrupt handler at the UART component. Otherwise, you can do a busy wait by checking the size of the RX buffer.

0 Likes

Thank you.

   

How could I make sure that it wont read any unwanted values?

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

There is an API UART_GetRxBufferSize() which returns the number of bytes in the Rx buffer (not the total size). While this returns non-zero you may read using UART_GetByte() from buffer. Mask off the status-byte with 0x00ff and convert to an uint8.

   

 

   

Bob

Ok Bob.Thank you.

0 Likes