Depends on what exactly you are trying to monitor -- fluctations only, or a power-out problem condition. For the latter, this obviously won't work. Otherwise, I did something similar for an automotive voltmeter, but set up the voltage divider so that 25.5V translated to 5V at the analog input. This way, I was able to avoid a bunch of math, as 25.5V ==> 5V ==> 255 on the upper 8 bits of the A/D- converted value. Only other thing was to insert the decimal point in the right place. Be careful about the max voltage you put on any of the analog inputs. IIRC, max voltage at any pin is 0.3V above VDD, or 5.3V in this case. RA4 has a different spec which I don't remember offhand. You may want to protect it with a zener or something. Cheers, -Neil. -----Original Message----- From: pic microcontroller discussion list [mailto:PICLIST@MITVMA.MIT.EDU]On Behalf Of Brandon Stewart Sent: Wednesday, June 26, 2002 4:33 PM To: PICLIST@MITVMA.MIT.EDU Subject: [PIC]: Monitoring a voltage with a 16F877? the same voltage source?? I am building a project that fits into an empty computer bay and is powered from the computer's power supply. This is done off of a 12 volt line and through a 7805 -> which provides the 5V for the PIC to run on. Now, I plan to set up voltage dividers between the computer's 5 volt line and ground, and the 12 volt line and ground. This way I can use the A/D inputs of the PIC to monitor the computer's power supply voltage. This is done by choosing resistor values that provide monitoring voltages at 2.5 volts for each of the two lines being monitored. This is done to allow for the greatest fluctuation in the power supply voltage, whereby I can still monitor it without 'clipping'. ==> My question is, should I worry about sensing a voltage that is providing the power to my PIC to start with? Remember, I am monitoring a 5 & a 12 volt line, and this 12 volt line is the same one that powers my PIC through a 7805. Thanks, Brandon -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads