How do I......
Paul M
Posts: 95
Some pseudo code:
This doesn't work properly presumably due to the signed arithmetic(??)
How do you do this?
. . repeat . . 'do stuff . if <somecondition> now:=cnt . . 'do more stuff . if cnt > now + 5*80_000_000 ' 5 seconds should have elapsed since <somecondition> . .
This doesn't work properly presumably due to the signed arithmetic(??)
How do you do this?
Comments
if cnt - now > 5*80_000_000
It's also more reliable to do
if cnt - now > 5 * clkfreq
You may not always run your program with a 80MHz clock.
After reading your reply I realised that·I had used the difference method elsewhere in my code to get·'time between events'.
You say "..works better.." but actually you mean works always.
and yes, I neglected to note in my pseudo code .. "assuming an 80MHz clock.."
Thanks again