Timer for RS232 input loop?? | Cypress Semiconductor
Timer for RS232 input loop??
I've been struggleing with how to add a timer to a loop that will exit after a discrete amount of time (say 10 seconds).
What I have going on is I'm collecting input from an RS232 interface to fill up a string (that includes a checksum at the end).
The loop exits when the checksum is received. I also want to exit if I don't receive it after a discrete amount of time (that 10 second value above).
I tried to implement it using a 8 bit counter that was clocked by a 1 seconds clock with the result that I could get the counter value to 10, exit, but never able to reset the counter back to 0 for the next pass (kept exiting every 10 seconds
How do folks that do this type of thing implement implement a time so your not stuck forever in the serial processing loop forever with garbage in the string buffer?