This article describes how to measure values of a variable resistor or a variable capacitor using a microcontroller to measure the RC charge time to a constant threshold voltage. A variety of these “one-shot” circuits are described and the accuracy of the various methods is measured. Sample programs for the 87C51 family are presented at the end of the article.
The old “one-shot” monostable multivibrator circuit has been around since the discovery of the electron. Popular IC versions of this variable pulse width generator include the 74123 and the famous (Philips) Signetics NE555 timer. These circuits use the time to charge a capacitor to a predefined voltage as their time delay. If the threshold voltage is 1-1/e (e is the natural log base), then the time delay in seconds is exactly the product of the resistance in ohms and the capacitance in Farads (t=RC). This is a linear equation and it can be used to measure an unknown value of R if C and t are known. The purpose of this article is to describe ways to measure a RESISTANCE by using this technique with an 80C51 type of microcontroller.
by Don Sherman AN449 – NXP Application Notes