USART RX interrupt - capturing data
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2013-07-12 12:46 AM
Posted on July 12, 2013 at 09:46
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.thanks
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2013-07-12 4:09 AM
Posted on July 12, 2013 at 13:09
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.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Up vote any posts that you find helpful, it shows what's working..
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2013-07-12 7:06 AM
Posted on July 12, 2013 at 16:06thanks for reply,i agree with you but in my received streams have different sizes how can surely configuring time or timeout.ex.xxxxx\r\nxxxxxxxxxxx\r\nxxxxxxxxxxxxxxxxxx\r\nxxxx\r\n they are coming one by one.now i am using ''compare \r\n characters'' and it works properly but i doubt because what if ''\r\n'' set does not come and i miss data..
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2013-07-12 8:11 AM
Posted on July 12, 2013 at 17:11
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.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Up vote any posts that you find helpful, it shows what's working..
