-
Sleep Mode question
Well, I've plowed the manual until my eyes are blurry with no joy, so I thought I'd ask the experts:
I'm using an 18F2580. I have an external device that every once in awhile toggles asynchronously. I'm using the Timer3 input to count those toggles. Everything works as expected.
Now I'd like to save some power. If I put the device to sleep for 30 seconds will it miss toggles on the Timer3 input while sleeping, or not?
Thanks for any insight - testing it is sort of painful because of the board layout, but track cutting might be my next step after this...
-
Re: Sleep Mode question
As I understand it you will miss it, unless you are using an interrupt to wake the device when the pin is toggled.
-
Re: Sleep Mode question
Hi,
With TMR3 configured as a counter I would think you should 'get' the count. However the datasheet isn't really clear on this as far as I can see. It does say that, when entering sleep, all peripherals are shut down so perhaps it'll stop working even if configured as a counter. If configured as a timer it'll definitely stop since the main oscillator is shut down when in sleep.
If it turns out that TMR3 stops counting when in sleep you could try OSCON.7 = 1 which, when the SLEEP instruction is executed puts the processor in Idle mode instead of sleep. In idle mode the CPU is shut down but the peripherals are kept ON. Draws a bit more current obviously but what are going to do.... Make sure you read up on the various idle-modes available. But again, I think you should be fine when configured as a counter.
/Henrik.
-
Re: Sleep Mode question
Hi,
probably you could do something interesting with comparators that can wake up your device ... as you stated toggling happens @ a very very very low rate ...
Alain