Hi guys... thank you for the info.
Yes, I'm using a 16F818 chip... not really my choice but rather something that my buddy chose for his paintball gun and I'm stuck writing the software for it.
Anyway, thanks to your suggestions I'm getting close. However, what I've noticed is that on wake up the TMR1 interrupt is disabled.
I'm curious if this is normal and I just wonder if I need to re-enable it via the PIE register. I'll try that and see what happens.
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
OK guys... got it going. Here is the snippet of the the code around the sleep command. Works like a charm.
What I've done is I gave it a delay of 3 seconds from the closure of the switch to make sure PortB is undisturbed, then I took a snapshot of PortB (read it into a dummy variable), set up the interrupt and put the PIC to sleep. Once awoken, I read PortB again and cleared the flag.
Now here is another question... I'm also running Darrel Taylor's interrupt routine based on TMR1. I use it to flash a LED if a battery is low.
However, once the chip awakens from sleep, it would appear that this interrupt isn't working anymore (ie. no flashing).
I've noticed the same thing happens if I try to declare INTCON=00001000 at the top of the program... does this make sense?
Code:pause 3000 dummyread=PortB intcon=%00001000 @ sleep @ nop dummyread=PortB intcon.0=0
Bookmarks