Hi,
When using the NAP command the PIC goes to sleep, for a while, wakes up, goes to sleep, wakes up and so on, keeping track of how many "cycles" in order to give you roughly the amount the sleeptime you tell it to. It uses the WDT to do this.
Using Wake-on-change will put the PIC to sleep and it'll stay there until a change occurs. I've never used the feature and I've never used the 10F parts but it looks like all you need to do is enable GPWU (like you are doing). Then when you're ready to go to sleep you do a read of the GPIO register to get the current state and then put the chip to sleep using the assembly instruction SLEEP (not the PBP command) ie, @ SLEEP
At this point the PIC will go to sleep until a change occurs on one of the GPIO pins which are set to be inputs. I think that you'll have to disable the WDT otherwise IT will timeout and Wake the PIC up.
Code:
start_here: ' ------------------------------finally the program
adcon0 = 0 ' I read somewhere that after a reset you need to set this register again
state = gpio ' read the gpio ports
if switch = 0 then gosub light_LED ' looking for the button
@ SLEEP
goto start_here
Again, I've never actually tried this, just read the datasheet so take it for what it is.
With that said I really wouldn't want to run it at anything above 5.5V......
/Henrik.
Bookmarks