Vault 7: Projects

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

PIC24F Family Reference Manual
DS39724B-page 11-14 © 2010 Microchip Technology Inc.
Example 11-1: Setup for CTMU Calibration Routines for Devices with the
CTMUCON Register
#include “p24Fxxxx.h
/**************************************************************************/
/* Set up CTMU ************************************************************/
/**************************************************************************/
void setup(void)
{ //CTMUCON - CTMU Control register
CTMUCON = 0x1090; //make sure CTMU is disabled
// 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=0x0004; // Set channel 2 as an input
AD1PCFG=0x0004; //
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
}

e-Highlighter

Click to send permalink to address bar, or right-click to copy permalink.

Un-highlight all Un-highlight selectionu Highlight selectionh