Microchip Technology DM183037 Data Sheet

Page of 696
PIC18F97J94 FAMILY
DS30575A-page 514
 2012 Microchip Technology Inc.
The CTMU current source may be trimmed with the
ITRIMx bits in CTMUCON1, using an iterative process
to get the exact current desired. Alternatively, the nom-
inal value without adjustment may be used. That value
may be stored by software for use in all subsequent
capacitive or time measurements.
To calculate the optimal value for R
CAL
, the nominal
current must be chosen.
For example, if the A/D Converter reference voltage is
3.3V, use 70% of full scale (or 2.31V) as the desired
approximate voltage to be read by the A/D Converter. If
the range of the CTMU current source is selected to be
0.55 
A, the resistor value needed is calculated as
R
CAL
= 2.31V/0.55
A, for a value of 4.2 MΩ. Similarly,
if the current source is chosen to be 5.5
A, R
CAL
 would
be 420,000Ω, and 42,000Ω if the current source is set
to 55
A.
FIGURE 26-2:
CTMU CURRENT SOURCE 
CALIBRATION CIRCUIT
A value of 70% of full-scale voltage is chosen to make
sure that the A/D Converter is in a range that is well
above the noise floor. If an exact current is chosen to
incorporate the trimming bits from CTMUCON1, the
resistor value of R
CAL
 may need to be adjusted accord-
ingly. R
CAL
 also may be adjusted to allow for available
resistor values. R
CAL
 should be of the highest precision
available in light of the precision needed for the circuit
that the CTMU will be measuring. A recommended
minimum would be 0.1% tolerance.
The following examples show a typical method for
performing a CTMU current calibration.
 demonstrates how to initialize the 
A/D Converter and the CTMU.
This routine is typical for applications using both
modules.
 demonstrates one method for the 
actual calibration routine.
This method manually triggers the A/D Converter to
demonstrate the entire step-wise process. It is also
possible to automatically trigger the conversion by
setting the CTMU’s CTTRIG bit (CTMUCON<0>).
A/D Converter
CTMU
ANx
R
CAL
Current Source
A/D
Trigger
MUX
A/D
PIC18F97J94