# 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
…
- 13
- 14
- 15
- 16
- 17
…
- 33
- 34

© 2010 Microchip Technology Inc. DS39724B-page 11-15
Section 11. CTMU
CTMU
11
Example 11-2: Setup for CTMU Calibration Routines for Devices with CTMUCON1 and
CTMUCON2 Registers
#include “p24Fxxxx.h”
/**************************************************************************/
/ Set up CTMU *************************************************************/
/**************************************************************************/
void setup(void)
{ //CTMUCON - CTMU Control register
CTMUCON1 = 0x1000; //make sure CTMU is disabled
CTMUCON2 = 0xC0C0;
// CTMU continues to run when emulator is stopped, CTMU continues
// to run in idle mode, Time Generation mode enabled, Edges are
// blocked. No edge sequence order, Analog current source not
// grounded, trigger output disabled, Edge2 polarity = positive level,
// Edge2 source = source 0, Edge1 polarity = positive level,
// Edge1 source = source 0, Set Edge status bits to zero
//CTMUICON - CTMU Current Control Register
CTMUICON = 0x0100; // 0.55uA, Nominal - No Adjustment
/**************************************************************************/
/ Set up AD converter *****************************************************/
/**************************************************************************/
TRISB = 0x0001; // Set channel 2 as an input
AD1PCFG = 0x0001; //
AD1CHS = 0x002; // Select the analog channel(2)
AD1CSSL = 0x0000; //
AD1CON1 = 0x8000; // Turn On A/D Converter, continue in Idle mode,
// Unsigned fractional format, Clear SAMP bit to
// start conversion, Sample when SAMP bit is set,
// sampling on hold
AD1CON2 = 0x0000; // VR+ = AVDD, V- = AVSS, Don't scan,
// always use MUX A inputs
AD1CON3 = 0x0000; // A/D uses system clock, conversion clock = 1xTcy
}

- 1
- 2
…
- 13
- 14
- 15
- 16
- 17
…
- 33
- 34