Timing issues within SimpleIDE?
Rsadeika
Posts: 3,837
I am having some timing issues with PUB wait(time), it runs correctly up to 53, 54 to 60 it falls apart. I am not sure what is causing this to occur.
Ray
Ray
CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000
PUB wait(time) waitcnt((80_000_000 * time) + cnt)
Comments
54 * 8e7 > 2^32 ;-)
-j
Ray
Totally untested code from top of my cog ;-)
HTH
-j
This eliminates the little errors you get for the calls of the 1 second delays.
Basically waitcnt can only handle delays up to 54 seconds (@ 80MHz) because cnt is a 32 bit register. But you can repeat shorter delays as much as you like.
Andy
Ray
It seems most folks back into the 53 second delay the other way.
"I set my timer for some <too short> period and my Prop goes to sleep for almost a minute before it wakes up" or they don't wait the minute and just thinks it hangs.
If they just say hang or long period delay, most of the older forum members ask "is it about a minute?" :0)