I'm guessing that your using 5% resistors, and +-20% caps? That is where the errors are going to creep in, even with 1% resistors and +-10 caps. You'll find your time constant will change from resistor to resistor of the same value, and it can really change a lot when using different capacitors of the same value. If you are testing this for usage with a potentiometer later, there is a simple way around the inaccuracies of analog pots and caps (both are typically +-20%). Just connect another pin to the 3rd (usually unused) leg of your pot, and see what the RC is on that port at the beginning of your program to get what the total time constant is for the pot at its maximum resistance. That figure is your "scale" that you can then use to calculate where the position of the pot is (potval%=(potval/scale)*100). If your project is subject to wide temperature variances, you can check your scale every now and again during the program, to see that it hasn't changed do to a temperature change (just use the new value in your calculations). You can do the same thing, only faster, using a PIC that has a couple of ADC's on board. But you'll want to stick to a pot under 10k in most cases, to get an accurate reading from your ADC ports. Hope this helps you out, or at least gives you a few ideas on how to remedy your problem. Regards Pat >Hi! > >I use a PIC 16F84 with a R/C Circuit connected to a port to measure the >resistor in it. (will be variable in future) > >I use the formular R=t / (C * ln (U0 / UC)) > >where R = resitance in Ohms >C = capacity in Farad >U0 = Voltage on full charged Capacitor >UC = Tereshold > >With the configuration of R=1k and C=1u it works fine but with R=3k and C=1u >the result (time) is to high. > >Here're some results i get: > >calculated: 1k the dischage time until the thereshold is reached sould be >1,370 ms, and with a 3 k it sould be 4,112 ms. (U0 = 5.12 Volt, UC = 1.3 >Volt) >Measured with scope i become the following results: with the 1k resistor >1,389 ms (more or less perfect) and with the 3k around 5,324 ms. > >Does anyone know a correction method to fix this or a better/other formular? >Or a other reason which explains the vary of the measurement? > >TIA > >cu, Doc ... > >-- >http://www.piclist.com hint: The list server can filter out subtopics >(like ads or off topics) for you. See http://www.piclist.com/#topics > > > > > -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.