On Mon, 18 May 1998 14:22:16 -0400 Andy Kunz writes: >Either I'm not seeing it, or Microchip doesn't specify it, but I have >a >question that perhaps somebody in-the-know can answer (maybe by >experience). > > >I need to get an accurate measurement of voltage which may range from >30V >down to about 3V. What I was thinking of doing was using a resistor >ladder >with multiple taps going to the various ADC inputs on the PIC. I >would >start my measurements on the greatest division (ANx in the picture >below) >and if the input voltage was sufficiently low that I could use the >next >higher division (ANn-1), I would do that, repeating until I had the >smallest V/div on the ADC (best resolution). > >Question is, do the ADC inputs have diode protection like the digital >inputs? Will my scheme work properly? > >Concept: > > 3-30V+ > | > | > R1 > | > +-----> AN0 input > | > | > R2 > | > | > +-----> AN1 input This isn't going to work. When the open-circuit voltage for the AN0 input rises above Vdd, the protection diode will clamp it. Then voltages at the rest of the taps will be wrong. Why not just divide the input voltage by 5.4 and subtract 0.55V, converting 3-30 V to 0 - 5V? If you want an adjustable divider for finer steps on the lower voltages, there are a several ways to go: Use seperate voltage dividers so the output of one being clamped doesn't affect the other. Or use analog switches to change resistors. PIC pins make reasonable analog switches to ground or Vdd by setting to input for open and output for closed. For example Vin --R1---------PIC analog in | --R2---PIC digital switch With the "PIC digital switch" pin set for input, no current can flow through R2 so the analog input is essentially Vin. Voltages from 0-Vdd can be measured. Changing the PIC digital switch pin to output zero will form a voltage divider of R1 and R2, so higher input voltages can be measured. Outputting a one would allow measuring negative voltages, but only with the high range. It's probably a good idea to back the PIC protection diodes with external diodes especially if the circuit will be taking an analog reading from one pin while another one has a voltage higher than Vdd. _____________________________________________________________________ You don't need to buy Internet access to use free Internet e-mail. Get completely free e-mail from Juno at http://www.juno.com Or call Juno at (800) 654-JUNO [654-5866]