Enabletime affected by Sleep?

jon_nic

New Member
is Enalbletime command affected by sleep command?

I want to start the eleapsed time counter by "enabletime" command, do some other code then put the Picaxe to sleep using "sleep xx" command. Will the elapsed timer still continue to count the seconds when in sleep mode ?

thanks
 

hippy

Technical Support
Staff member
The elapsed time will not increment whilst executing a sleep command.
 

AllyCat

Senior Member
Hi Jon,

Note that enabletime (on) is the default after a power-up/reset, and that the accuracy of "time" may be affected by any "blocking" commands.

As hippy says, sleep stops the updating of the time variable. What you could try is a SLEEP 5, followed by a TIME = TIME + 6, since a SLEEP 1 lasts about 1.2 seconds.

It really depends what accuracy you want. TIME is only moderately accurate, it should be better than +/- 1%, and can be adjusted a little with CALIBFREQ, but it depends on the code instructions used in your program. The Microchip specification for the SLEEP period is much worse (it uses the Watchdog timer) but in practice may be acceptable.

Cheers, Alan
 
Top