Tie the top end of your voltage divider to +5V instead of to ground. When your supply is at -21V, you'll have 26V across the voltage divider. Calculate the resistor between +5V and the PIC A/D when you have -21V on the supply to give you 5V. When the supply goes to 0V, you'll have 5V - 5/26 V across the resistor between +5V and the A/D input. The full range on the input to the voltage divider would be: +5V = ADC Full Scale -21V = ADC Zero Do the rest in software! Harold > I've built a triple variable power supply with two 0...+21V outputs and > one 0...-21V outputs. I want to finish it with a dedicated triple > voltmeter, > using an 16f877 and a 2x40 character LCD. > > I'll use a voltage divider to get each supply into the + or -5V range > and then multiply in software to get the actual value to display. > Just one problem - how to change the minus voltage to positive voltage, > so that I can measure all three sources using a single 16f877? > (Each 16f877 ADC input must be 0...+5V.) > -- FCC Rules Updated Daily at http://www.hallikainen.com -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist