# Vault 7: Projects

This publication series is about specific projects related to the Vault 7 main publication.

### Protego

# PIC24FJ32MC10X -- Charge Time Measurement Unit

- 1
- 2
…
- 22
- 23
- 24
- 25
- 26
…
- 33
- 34

PIC24F Family Reference Manual
DS39724B-page 11-24 © 2010 Microchip Technology Inc.
11.7 MEASURING TIME WITH THE CTMU MODULE
Time can be precisely measured after the ratio (C/I) is measured from the current and
capacitance calibration step by following these steps:
1. Initialize the A/D Converter and the CTMU.
2. Set EDG1STAT.
3. Set EDG2STAT.
4. Perform an A/D conversion.
5. Calculate the time between edges as T = (C/I) * V, where I is calculated in the current
calibration step (Section 11.5.1 Current Source Calibration), C is calculated in the
capacitance calibration step (Section 11.5.2 Capacitance Calibration) and V is
measured by performing the A/D conversion.
It is assumed that the time measured is small enough that the capacitance, COFFSET, provides a
valid voltage to the A/D Converter. For the smallest time measurement, always set the A/D Chan-
nel Select register (AD1CHS) to an unused A/D channel; the corresponding pin for which is not
connected to any circuit board trace. This minimizes added stray capacitance, keeping the total
circuit capacitance close to that of the A/D Converter itself (4-5 pF). To measure longer time inter-
vals, an external capacitor may be connected to an A/D channel and this channel selected when
making a time measurement.

- 1
- 2
…
- 22
- 23
- 24
- 25
- 26
…
- 33
- 34