Vault 7: Projects
This publication series is about specific projects related to the Vault 7 main publication.
© 2010 Microchip Technology Inc. Preliminary DS39737A-page 49-35
Section 49. 10-Bit ADC with 4 Simultaneous Conversions
10-Bit ADC with
4 Simultaneous
Conversions
49
Example 49-8: ADC Configuration Code for 1.1 Msps
void initAdc1(void)
{
AD1CON1bits.FORM = 3; // Data Output Format: Signed Fraction (Q15 format)
AD1CON1bits.SSRC = 7; // Internal Counter (SAMC) ends sampling and starts conversion
AD1CON1bits.ASAM = 1; // ADC Sample Control: Sampling begins immediately after
// conversion
AD1CON2bits.SIMSAM = 0; // Sequential sampling of channels
AD1CON2bits.CHPS = 1; // Converts channels CH0/CH1
AD1CON3bits.ADRC = 0; // ADC Clock is derived from Systems Clock
AD1CON3bits.SAMC = 0; // Auto Sample Time = 0 * T
AD
AD1CON3bits.ADCS = 0; // ADC Conversion Clock TAD = TCY * (ADCS + 1) = (1/13.3M) * 1 =
// 75 ns (13.3 MHz)
// ADC Conversion Time for Tconv = 12 * T
AD = 900 ns (1.1 MHz)
AD1CON2bits.SMPI = 0; // SMPI must be 0
//AD1CHS0/AD1CHS123: A/D Input Select Register
AD1CHS0bits.CH0SA = 0; // MUXA +ve input selection (AIN0) for CH0
AD1CHS0bits.CH0NA = 0; // MUXA -ve input selection (AV
SS) for CH0
AD1CHS123bits.CH123SA = 0; // MUXA +ve input selection (AIN0) for CH1
AD1CHS123bits.CH123NA = 0; // MUXA -ve input selection (AV
SS) for CH1
//AD1PCFGL: Port Configuration Register
AD1PCFGL = 0xFFFF;
AD1PCFGLbits.PCFG0 = 0; // AN0 as Analog Input
IFS0bits.AD1IF = 0; // Clear the A/D interrupt flag bit
IEC0bits.AD1IE = 0; // Do Not Enable A/D interrupt
AD1CON1bits.ADON = 1; // Turn on the A/D converter
}
Protego_Release_01_05-Related-OEM-Documentation-PIC24FJ32MC10X-Reference_Manual-Section49-10-Bit_ADC_with_4_Simultaneous_Conversions.pdf