Hi - I had to deal with the same problem recently. As for uC damage - I'd guess no, but I'm not sure. As for how to deal with it - if possible a mechanical switch is easiest, so when the unit is turned off the battery voltage line is disconnected as well. Note that if you leave things as-is the PIC is never fully turned off, and there will be a constant battery drain even when "off". For the design I have, for various reasons I couldn't just measure the voltage after the on/off switch, and I couldn't use the other pole on the on/off switch. So what I did: I put a PFET on the battery voltage line to where my divider is, and the PFET gate is pulled up w/100K to the battery voltage. The PFET gate is also connected to an NFET to ground, the NFET gate is pulled down to ground with a 10K and goes to a PIC pin. Now when the PIC is off, the NFET is pulled down (off), and the PFET is pulled up (off). When the PIC is on, and the PIC pin control line is 0, the NFET gate is grounded (off), and pfet is off. When the PIC pin control line is 1 (3.3V in my case), the NFET is on, which connects the PFET gate to ground, turning on the PFET, so the battery voltage is now put across the resistor divider (2.2K and 1K in my use) and an A/D measurement is made. This happens in about 1msec every 300msec or so, so the drain on the battery is slight. Anyway, it works. No opamp needed, but a bunch of (small, cheap) parts. And essentially zero battery drain when the PIC is off. J Padu wrote: > Hi, > > I'm doing some tests with the PIC (18F452) internal ADC on port RA3. > Although everything is working perfectly, I noticed something that I > found very curious. > > I'm using the RA3 as an ADC to measure voltage levels on a battery > pack (typical 14.4V). Between the battery pack and the PIC port, > there is a resistor divider circuit and a unit gain opamp working as > a voltage buffer. When the unit is on, I set one of the PORTB pins up > to turn a LED on, and I notice that when I turn my device off, the > "ON LED" is still lit, though not as bright as when the unit is > powered on. I measure the VDD pin and there is some voltage there > (around 2.5V when RA3 is around 4V). > > Is this bad for the uC? Should I have some kind of switch to > disconnect the voltage measurement circuit when device is turned off? > > > Cheers > > Padu -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist