-
12c508 @sleep command?
I was wondering if it is possible to use the assembly command "@sleep" to have a 12c508a chip stop execution and then start again where it left off after sensing an input level change.
I am worried that it will reset execution at the start of the program.
-
It'll work just fine, but WDT must be OFF otherwise it'll reboot the PIC.
-
sleepy eyes
Thanks for the tip on WDT. I'll give it a try today.
It's amazing what can be accomplished by using PIC's.
-
12C508A & SLEEP
The 12C508A series can only wake-up from SLEEP with a device reset like /MCLR, WDT timeout, or wake-up on pin change.
The catch is - that even wake-up on pin change with the 12C508A causes a device reset, and you're starting over again from square #1 after any wake-up event.
The good news is - the 12C67x series can wake up from SLEEP & then continue execution at the instruction immediately after the SLEEP instruction if you have global interrupts disabled (GIE=0).
With global interrupts enabled (GIE=1), the 12C67x will wake-up, then execute the instruction after the SLEEP instruction, then branch to the interrupt vector at location 0004h assuming you have an interrupt handler in place.
-
12c508 vs. 12c67x
So on the '508 series it always reboots regardless of the enable WDT settings?
Bummer. The '508 series are typically the most inexpensive PIC's.
-
> Bummer.
Not quite... all you have to do at the start of your program is check the GPWUF bit in the STATUS register
eg...
If STATUS.7=1 then goto WakeFromSleep
See Datasheet section 8.7 and section 4.3. I keep saying to everyone, you gotta read those Datasheets - or if like me, reading Datasheets isn't your thing on cold winter nights, then at least get to know where things are found so you can jump straight to it - all Microchips Datasheets follow the same layout.
PS. If you want to play with little PIC's then 12F675 is the way to go... they're almost the price of the 12C508/9 and still dropping.
Melanie
-
Yep - you're still in charge if you know where to look...;o]
I agree with Melanie. If you want the best bang-for-the-buck, then go with the 12F675 or 12F629. They have a few more features, are re-programmable, and only a few pennies more than the 508 series.
-
Goin' with a new uP
Took a look at the 12F629. Goodbye '508, Hello Flash memory!
Thanks Melanie and Bruce for your good advice.