June
2005, Issue 179
Accurate
Capacitance Meter
Cypress
PSoC High Integration Challenge 2004 Contest Winner
by
Alexander Popov, Jordan Popov, and Peter Popov
NORMAL
OPERATION
We
wrote the software in C language using the PSoC Designer
V.4.1 environment. The blocks are initialized after
power-up. All parameters except VREF are set to predefined
defaults. VREF is then calibrated. This completes the
initialization procedure and the normal measuring cycle
begins.
If
the capacitor’s voltage is higher than VLOW, the CurSet
DAC is programmed to discharge CX. After the voltage
drops below VLOW, Timer32 resets and the CurSet DAC
is set to charge the capacitor. When VHIGH (COMP1) switches
to logic 1, Timer32 is read and the capacitance is calculated
and stored in the capup variable. The procedure then
reverses and another measurement is taken. Timer32 is
reset and CurSet is programmed to discharge CX. When
the voltage across the capacitor drops below VLOW, another
CX value is calculated and stored in the capdown variable.
The
average of capup and capdown is displayed on the top
row of the LCD. On the bottom row is a running average
of values that are considered accurate enough. It’s
ignored if the current value differs from the running
average by more than 10% in either direction.
When
a capacitor isn’t attached, the device measures the
parasite capacity of the circuit, board, and connectors.
After an actual measurement, this value is subtracted
from the calculated value of CX. The device indicates
a detached capacitor and holds the last average value
on the LCD.