PDA

View Full Version : Help with PBP 'SLEEP' command



dreadmaul
- 15th November 2006, 03:04
I am trying to get a battery operated pic to run for 8 hours... then sleep for 16.

Now.. i've tried 'sleep 57600' but it isn't anywhere close to 16 hours... it is WAY OFF...

then i read in a PBP book from amazon that the sleep command really means periods of 2.3 seconds.. so i tried 25043, which would have been off by 8 seconds.. but i would have been fine with that... but it's WRONG too...

Does anyone have any pointers??

Thanks...

PS: PBP on a 12F675

HenrikOlsson
- 15th November 2006, 06:27
Hi,
The time is ~2.3s per LSB but the Sleep command uses the Watchdog Timer as it's timebase and it is driven by a RC network internal to the PIC. The value of this RC network varies from PIC to PIC and also with temperature.

If I read the datasheet correct (it's 07.00 in the morning here) the watchdog period is 18mS typical but can vary between 7 and 33mS worst case.

So, you just can't expect any acuarcy from the SLEEP or NAP commands.

Datasheet DS41190A
Section 9.6 and Table 12.4, Param.31

/Henrik Olsson.

dreadmaul
- 18th November 2006, 02:41
So how can i ACCURATELY go to sleep for 16 hours or so.. with a 12F675 ??

and no extra parts??

Melanie
- 18th November 2006, 07:40
Nothing like wanting your cake and eating it too.

If you want accuracy, then you can't have the PIC asleep as it needs to be awake and working to maintain it's accuracy.

If you want to maintain accuracy and put the PIC to sleep, then you need something external to maintain that accuracy.

Chose a micropower PIC - there's plenty of them...

Take your choice.

The sleep features are just that, they put the PIC to sleep and not have it continue processing.