I guess, having done the calculations on sleep current draw, I could just stop worrying about switching the power, and instead use a wake-from-sleep GPIO change... Hmmm. should be ridiculously low power consumption if I get it right (<1uA). Yup, it seems to work just fine, and far fewer parts. Code does need to cater for bouncing switch-off though (not just switch on), otherwise the chip will activate when the button is pressed, and when released (even if you check the button state when reset). Had to re-read the datasheet *again*, but now got sleep power reading 0.00uA on my DMM (probably not precise enough at this level). You really do need to tie all pins to GND in sleep otherwise current can fluctuate all over the place from 50uA to 300uA in sleep. Thanks for the suggestion, and it appears to be a good solution. Rolf Mike Hord wrote: > Is there a reason software debouncing won't work? > > You should be able to edge trigger when the button > is pressed and then ignore it for a while thereafter. > Compared to the bounce time, even rapid pressing > of a button will be easily detected. > > Mike H. > > On 10/25/06, Rolf wrote: > >> Hi all. >> >> I am (slowly) learning this electronics thing, but before I build a >> circuit, I want to run a "debounced" power supply past people who know more. >> >> The application is a wireless remote control for a camera system. The >> control will transmit a start bit, and 8 data bits using manchester >> encoding over a 418MHz wireless link. I have the firmware working, and a >> working prototype circuit built in a breadboard. The core component is a >> PIC10f206. The intention is to run the system from a 3V lithium coin >> cell. I intended to put a momentary switch on the +3V line as the >> trigger for the remote. When power is applied, the 10F enables the TX, >> waits 1ms for it to settle, then transmits the data at 10kbaud. it then >> powers down the TX, and goes to sleep. The entire "awake time" is less >> than 3ms. >> >> Unfortunately the switch bounces, and I sometimes get garbled >> transmissions to the RX. >> >> I figured I could solve the problem by putting together a "bounce-proof" >> switch. I have attached a schematic. >> >> Using a P-Channel high-side switch, with the gate connected to the +3V >> via a parallel R and C. The momentary switch is connected between the >> gate and ground. The idea is that with the switch open, the resistor >> will bring the cap to equilibrium at +Vcc, thus putting 0Vgs on the >> gate, and switching off the p-channel mosfet. There will be no current >> drain from the battery then because of the high impedance of the mosfet. >> >> When the switch closes, it "discharges" the cap (effectively) >> instantaneously, bringing the gate to -3V relative to the source, and >> causing the mosfet to conduct. It will conduct until the switch >> re-opens, as well as the time it takes for the cap to recharge to above >> the Vth of the mosfet. The "recharge" time will be proportional to the >> resistor, and cap. >> >> I figure I need the mosfet to conduct for 10ms at least. Once the PIC >> goes to sleep I have measured that it consumes about 25uA, so I am happy >> to let it just sit there since I will have about 7000 hours of battery >> life at that level... ;-) All the mosfet needs to do is to conduct >> through the bounces. >> >> My math indicates that with a 3V supply, and a -2V Vth on the mosfet, >> and that an RC time constant is for about 2/3 charge of the cap, and I >> need 1/3 charge to cut-off, that the RC constant should be about 20ms >> for the RC. Using a 1MOhm resistor (to reduce current draw when the >> switch is closed to 3uA), I need a cap of about 20pF. >> >> The questions I have are: >> 1) will this system work reliably (it appears to work at 5V in my >> breadboard now)? >> 2) 20pF seems real small, I am thinking I should allow more current to >> flow, and use a larger cap, but this will have (small) implications on >> battery life. Perhaps I should go with 100K and 0.2uF, allowing 30uA >> current to ground if the switch is held closed (remeber, this is going >> to be jammed in a camera bag somewhere, and could potentially be held >> closed for a long time...). >> 3) Although I can find a number of SMT p-chan mosfets that have a max >> Vth of -2V, I can't seem to find parts that are Thru-home (can put in to >> breadboard...). At worst case I will just solder some leads right on to >> a DOT-23 package or something, but perhaps someone knows where I can >> find a -2Vth p-mosfet that is readily available (digikey hopefully) in a >> t-hole package. >> >> Thanks in advance for any insights/criticisms. >> >> Rolf >> >> >> >> -- >> http://www.piclist.com PIC/SX FAQ & list archive >> View/change your membership options at >> http://mailman.mit.edu/mailman/listinfo/piclist >> >> >> >> >> -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist