Calculated timeout from repeat loop
average joe
Posts: 795
I'm a bit lost on the best way to handle a timeout from a repeat loop. Basically, I'd like to repeat until a condition is true, or a timeout period has elapsed. My trouble is handling a clock wraparound.
Example :
This will work perfectly fine, as long as cnt + _syncTimeout is less than $7FFF_FFFF. If not, it causes tout to be evaluated improperly. I've been thinking about the best way to do this and still drawing a blank. Any help would be greatly appreciated as always!
Example :
PRI GetMark | tout tout := _syncTimeout tout += cnt repeat RX(@d) until GetPacketType == _mark or (cnt > tout)
This will work perfectly fine, as long as cnt + _syncTimeout is less than $7FFF_FFFF. If not, it causes tout to be evaluated improperly. I've been thinking about the best way to do this and still drawing a blank. Any help would be greatly appreciated as always!
Comments