2013-07-12 12:46 AM
Hi all,
I am working USART RX interrupt.I am sending command through rs485 interface (usart TX) and waiting(delay) response from external device.What i wonder is , there is a flag for waiting last received data?i dont want to use delay function , i want to end session when last data received from usart rx interrupt.thanks2013-07-12 04:09 AM
How do you know which is the last byte, other than the passage of time with no data received?
I'd think you need to check in subsequent SysTick ticks, or set up a timer in one-shot mode each time you receive a character as a timeout window for the next.2013-07-12 07:06 AM
2013-07-12 08:11 AM
Each symbol is transmitted in a uniform amount of time, if you don't have any inter-symbol gap demarcating one transmission from the next then you're going to have to think a bit harder about how you transmit it to your device, and how your device determines when the transmission has stopped.
If you are basing the line demarcation on CR/LF pairs, then you could accumulate data in a line buffer until you receive them, and then pass the buffer off for processing, or you could process character as they arrive with a state-machine type implementation.