User manual
depends on the operating voltage and is indicated in the data
sheet for the micro controller at Vcc x 0.7.
001 HIGH = 5V x 0,7
Before a HIGH level is recognised in the digital port, some time
will pass. We measure it within the Do-while-loop using the
variable
C_time
.
C_time
is approximately proportional to the
capacity of the capacitor, i.e. when
C_time
is very large, the
capacity to be measured is very large as well.
To get the proper measured value, we need to convert the variable
(
C_time
•
Factor
). The value (factor) must be determined ex-
perimentally with »a few calibration capacitors«, since
recognition of a HIGH level will deviate slightly from controller
to controller in spite of the information Vcc x 0.7 in the data
sheet, and the oscillator frequency of 16 MHz is not 100 % the
same in every board (quartz tolerances). Finally, the measured
value will be divided into Nanofarad (nF) and Mikrofarad (µF)
with a simple If()-query and output on the LCD before a new
measurement starts.
Get a few new capacitors – always use capacitors of which you
know precisely what capacity they have. You may have them
measured by an electronics specialist in the lab. New capacitors
usually have the printed-on values +/- 20 %, depending on type.