PDA

View Full Version : Wake up little PIC!



George
- 20th May 2007, 22:07
I'm having issues getting a 12F675 to wake up after a sleep command, I put a toggle LED routine either side of the sleep command to see that it was firstly getting to the sleep command (which it is) then I put the toggle routine after the sleep command - but it never seems to wake - any clues? Here's the snippet of code that's causing me greif

Batt: 'check battery level

adcin 3,battlvl
if battlvl < 26 then battflat = 0
if battlvl > 26 then battflat = 1 'battery near flat
if battlvl > 28 then pwrdwn 'battery flat goto power save mode
return

pwrdwn: 'power down mode


led = 0
hallpwr = 0
sleep 5
for b2 = 0 to 30 'toggle led routine
toggle led
pause 50
next b2
led = 1
pause 50
gosub batt
if battflat = 0 then start 'if battery getting topped up then turn back on
goto pwrdwn

gandora
- 20th May 2007, 22:33
Have you tried to just use the sleep command with an led project? Maybe its a different part of your code giving you the trouble.

But the best way to tell that, is just a lil project to test the command on its own.

Could always have something to do with the watchdog timer. Hopefully that helps. If it works in the project then its a problem with the way your other code configures the pic or maybe a loop of death somewhere.

George
- 21st May 2007, 00:02
Got it sorted sorry - the WDT was turned off - had to be something silly like that Thanks fro mentioning the WDT

gandora
- 21st May 2007, 05:31
Got it sorted sorry - the WDT was turned off - had to be something silly like that Thanks fro mentioning the WDT

No problem glad I could help. ^^