>I use the method you described, charging the cap for several RC periods >till it's pretty much flat. >Then I enter the discharge timing loop, and all I can do is exit when the >pic tells me the pin is low. >The loop is two instructions at 1 MHz, and I'm getting timing values in the >range of 0AXh for 10k, so I've got plenty of resolution, but I see it in >the data, and on the scope, that the discharge termination point (and >presumably the low threshold) is bouncing around like crazy. Only difference is I used it the opposite way around, measuring the time it takes to charge. Your method should be more accurate. Actually I counted T0 interrupts, so my loops were very long and I used a bigger cap, but that should make my results even worse than yours. Don't know why it's not working for you, but you're smart so I imagine you'll squash the gremlin. Cheers, Bob -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.