Hi, Regular PIC inputs are standard CMOS inputs and the threshold DOES change linearly with supply voltage. The threshold is close to 1/2 Vdd, so if your Vdd falls by 1 volt, the threshold will fall by 1/2 volt, so it won't work to use it as a reference. I'm not sure about the Schmitt Trigger inputs, but I'd suspect that their threshold is highly Vdd dependent, too. You could use a regular NPN transistor, though, to generate a Vdd independent means of detecting low supply voltage. Just use a voltage divider connected to the base of an NPN transistor, with the emitter grounded and the collector connected to Vdd via a large resistor. When the battery drops below a given threshold (set by your divider ratio times 0.6 volts), the collector will go high (it will normally be low). You just need to select the values of the resistors so that the circuit draws very little current (I think it will work easily with only 1 microamp or so, probably even considerably less) and to make sure that the amount of current drawn by the base is much less than the current through the divider. If you need more than just a yes/no indication, you could buy a small reference to drive Vref, or again, if you are not concerned about real accuracy, you could make one using a few 1N4148 diodes and a resistor. You need to check on how low the ref impedance needs to be (check PIC datasheet) and you might need to include a transistor in there as a buffer if it requires a low impedance. Also, since (if I remember correctly) Vref sets the maximum ADC level, you would have to use a voltage divider to divide down Vdd a few times before you feed it to the ADC input. Sean At 11:47 AM 1/12/02 -0700, you wrote: >At 10:54 AM 1/10/02 +0000, Nigel Duckworth wrote: >>Hi All, >> >>I have to measure my PIC16C711's own battery supply (2 x AA cells) so need to >>generate a reference for the A to D, cost is everything on this one. > >What supply voltage does the PIC run from? Is there a boost convertor to >5V or does the PIC run directly from the battery? > >Since this is such a non-precise requirement, I'd be tempted to just use >the logic 1 threshold of a PIC pin - I belive it stays relatively constant >at about 1.4 Vdc regardless of supply voltage. You would need 1 i/o line, >2 resistors, 1 cap. > >100R resistor from PIC pin to 100n cap (other side of cap to gnd), 10K from >battery to same PIC pin. Turn PIC pin into output and LO, wait a few dozen >cycles until cap is discharged, turn pin into input, time how long it takes >for pin to go HI. Time is dependant on battery voltage. > >Give it a try - should work fine. > >dwayne > > > >Dwayne Reid >Trinity Electronics Systems Ltd Edmonton, AB, CANADA >(780) 489-3199 voice (780) 487-6397 fax > >Celebrating 17 years of Engineering Innovation (1984 - 2001) > >* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * >Do NOT send unsolicited commercial email to this email address. >This message neither grants consent to receive unsolicited >commercial email nor is intended to solicit commercial email. > >-- >http://www.piclist.com hint: PICList Posts must start with ONE topic: >[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads > ---------------------------------------------------- Sign Up for NetZero Platinum Today Only $9.95 per month! http://my.netzero.net/s/signup?r=platinum&refcd=PT97 -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads