At 12:03 PM 10/18/01 +0100, you wrote: >Adjust PWM ratio on pin B until pin A switches. >To cope with full range, do it from both directions - i.e. start with >cap at 5V, PWM decreasing, look for high-low transition, then start at >0V, PWM increasing, look for low-to-high transition. >You are effectively finding how much PWM drive is required to push the >output past the pin threshold against the current from the sensor - >this should bear some reasonable resmblence to the sensor voltage, and >I would think would be good enough to discriminate 10 levels. Maybe duplicate the circuit using a third pin, one more cap and two more resistors (one to the test pin, one to the supply voltage), and divide the results. This would eliminate the threshold from the equation, assuming the inputs matched, and you could use 1% resistors for the small cost difference. 5V is handily right in the middle of your sensor range. Best regards, Spehro Pefhany --"it's the network..." "The Journey is the reward" speff@interlog.com Info for manufacturers: http://www.trexon.com Embedded software/hardware/analog Info for designers: http://www.speff.com /.-.\ (( * )) \\ // Please help if you can: \\\ http://dailynews.yahoo.com/fc/US/Emergency_Information/ //\\\ /// \\\ \/ \/ -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu