just use a inline resistor and a cap to GND on the output of your switch.
V+ --- [resistor, 10K?]----[reed switch]----[Capacitor from this line to GND]----pic I/O
The cap will "store" the switch closure event so that when the unit wakes up it can tell the reed switch was closed while it was sleeping.
The PIC can then, once it wakes up, flip the input bit to a grounded output to "reset" the circuit. Then just before SLEEP it can make the pin back into an input.
Note that if the circuit board is damp or dirty and you don't reset the circuit on every wake up from sleep, that eventually the cap can charge up.
The cap can be very small, 0.01uF (10nF) would work just fine. I tried to make
a proper ascii schematic but this forum has no code mode that I can see.
Bookmarks