UART Interrupt on 5LP | Cypress Semiconductor
UART Interrupt on 5LP
I am having trouble figuring out how to set up the UART Receive interrupt. I managed to get gthe example TX and RX code and modified for TX and RX ok but I need to do the following and not sure how to set this up and how to access variables in the interrupt.
I have 2 applications. The first is as follows:
State Machine within RX interrupt as each Byte is received.
The RX pin is continuously toggling. A leading and sequence of bytes marks start of packet so I need to discard unwanted bytes until the lead-in sequence is detected and then gather bytes into a buffer until the correct number of bytes is received.
Do I just set the RX buffer to minimum so the program generates interrupt on each RX byte and then put my state machine into UART_RX.C ?
The second application is simpler in that it can receive the entire packet bvefore I need to process anything. But this one I want a timer to be reset every time a byte arrives and then 20ms after last byte the timer will expire and I set a flag to indicate DatainBuf. Alternately I can change packet structure if the PSOC has some sort of standard component tha can use XON/XOFF for packet reception.
The packet lengty is dynamic.