You can't insert an optical isolator input into the -21V output? You'll need to get a fairly linear output; if I recall the H11D1 is fairly linear. Then calibrate the H11D1 and the A/D converter, and attach the H11D1 to a pullup resistor and GND. Pretty cheap design. --Bob Kenneth Lumia wrote: > This is OK, but it assumes that the power supply voltages ramp up/down > in such a way that the +5V rail is valid before and after the -21V > supply is turned on/off. If not, you will have a negative voltage on > the pin, that will cause the protection diodes to turn on and conduct > into an unknown > impedance. Depending on the design, you could even put a negative > bias on the 5V rail. Be careful and think about the transition > states, especially concern yourself with loading on the -21V line. > > In a previous design, I used a LM358 op amp running off of +5 and > ground to squeeze a +/-15v input into a 0 to 5V range output. It > added complexity, however the input circuits of the LM358 can take the > -15V and not do anything bad, even if 5V isn't present (bipolar input > transistors were reverse biased). > > Ken > klumia@adelphia.net > >> 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 > > > -- Note: To protect our network, attachments must be sent to attach@engineer.cotse.net . 1-866-263-5745 USA/Canada http://beam.to/azengineer -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist