PDA

View Full Version : 18F2320 and sleep function



Brian
- 9th March 2005, 16:08
For some reason the sleep command on the 18f2320 will not work correctly as I have it setup. If I use the sleep command to go into low power mode for say 6 seconds or any time frame the pic will not wake. I know the PIC has power managed modes and I am guessing that is where my mistake is but can't seem to get to work.

I tried setting the OSCON register with all combinations so the watch dog timer would wake it but it still will not work.

I have the internal oscillator working great with code that needs to the microsecond timing with no errors. The pause command works too but the ability to change modes has me stumped on getting the sleep command to work.

Is there anything off hand that I am missing that is simple?

Just a simple

High led
Sleep 2
Low led

Will lock it up and never wake up.

I have the center frequency set with no adjustment and the OSCON register set as %01100000 for normal run with 4 Mhz and according to the sheet this should allow me to go into sleep mode too and wake. I tried all other combinations of the OSCON with no luck. I also made sure the watchdog timer was on.

Any help would be appreciated. This should be simple but has me stumped.

Brian
- 10th March 2005, 13:11
Got it!

I was leaving out the

_WDTPS_512_2H

Setting. So the WDT I guess was set at its max. I guess if I waited long enough it would have timed out.

It appeared I needed the 512 for a 1 second resolution.

Thanks goes out to Bruce.