Hi Mike,
Well, at a glance your code looks like it should let the Pic go to sleep, but I'm certainly not a pro!
On your two questions...
1) You don't have to use the built-in pullups if you don't want to - but be sure to use an external pullup / pulldown as needed otherwise. The entire port has its pullups enabled as a group (other Pic models allow setting individual pin pullups). When a pin is switched to output mode, the individual port pin pullup is automatically disabled.(1) If you're using the PORTB.0 interrupt, do you have to enable the PORTB pullups? If so, does it set the whole port or can you assign the pullups individually? (I'll have to use an external 10k...if I need to)
(2) When you come out of sleep and you see a high pulse on PORTB.0 and go to a routine.....at some point you need to reset the B.0 flag, right?
INTCON.1 = 0
2) The interrupt flag(s) should be cleared before exiting your interrupt service routine and resuming the 'normal' program.
You might consider putting some 'debugging' blinky LED outputs throughout your code for a visual indication of where the code is.
Arch
Bookmarks