Which PIC are you using? Most that I've worked with have a 10-bit A/D, s= o=20 you'd actually get a range of 0-1023, and instead of 2.125, your steps wo= uld=20 be 8.5. I actually prefer to do the math and reduce the number of components, but= if=20 you need more resolution from the A/D, then how about using a 3-resistor=20 voltage divider with the 2 center points going to VREF+ and VREF- of the = A/D=20 converter. Something like this ... +V ^ | [R1] | o----> To Vref+ | [R2] | o----> To Vref- | [R3] | v GND In this case, the A/D will read "0" when the sampled voltage is equal to=20 V*(R1+R2)/R3 and 255 (or 1023 if using a 10-bit A/D) when the sampled vol= tage=20 is equal to V*R1/(R2+R3). Remember that there is a minimum difference=20 allowed between Vref+ and Vref- (~2V for some of the 16F-series chips IIR= C)=20 -- see the datasheet for the official spec. Cheers, -Neil. On Saturday 03 January 2004 10:25 pm, reinaldo@IHUG.CO.NZ scribbled: > sorry i was very vague > the headlight motor is a simple DC motor, and i'm going to > fit a resitor pot to the headlight to measure the angle of > the headlight, say this pot gives me 80 when the light is > down and 200 when fully open, the pot in the dash will give > 0 to 255 ofcourse. so i'll need 0 to equal 80, 200 to equal > 255, AND every 2.125 steps of the dash pot correspond to 1 > step of the headlight pot. i can't measure .125 from a pot. > but, i'll measure the dash pot(say 60) divided 2.125 =3D > 28.23.. so that's 28 steps for the headlight pot + the > bottom position(80) =3D 108, so now i work out wich way to > turn the motor untill i reach 108. that way i hope to use > the full range of the dash pot. > now you can see i need division routines, i need to store > top and bottom levels while the power is off, and i also > need to constantly calculate what position the dash pot > works out to be for the headlight pot. i don't dare remove > the current motor and replace it for a stepper, also > remember everything needs to be done for both headlights :( > can you think of a simpler method? > thanks for your advice -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.