David VanHorn wrote: > > Easy: > > Use a pair of diodes. > One charges the cap through a known 1% resistor. > The other discharges the cap through the unknown. > > The cap value is common to both measurements, and cancels out. > > You need a schmidt input for this, something with high and low thresholds > that are not both at VCC/2. An HC14 works well. > > You are measuring the time it takes to charge/discharge C from VthLow, to > VthHigh and back down again. > > Measurement is a little complicated, but not bad. > Start with the cap charged (reading a "1") > Discharge till you get a zero, then IMMEDIATELY change the output to charge > again, and measure the time taken to get there. > When you get there, IMMEDIATELY set to discharge, and measure the time it > takes to get to "0" again. > You can average up the measurements. > > If you don't immediately reverse on hitting the threshold, then you risk > charging to some unknown voltage, (not the threshold) > > If this isn't practical, then arrainge the HC14 as an RC oscillator through > the diodes and resistors, and simply measure the high and low times. Why do it the hard way (diodes)? You just need ONE 74HC14, and your unknown R is the feedback resistor and the C hangs off the input pin. You get an oscillator period which is proportional to R if the thresholds don't move with temperature. -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.