# Vault 7: Projects

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

### Protego

# PIC24FJ32MC10X -- 10-Bit ADC

- 1
- 2
…
- 27
- 28
- 29
- 30
- 31
…
- 57
- 58

© 2010 Microchip Technology Inc. Preliminary DS39737A-page 49-29
Section 49. 10-Bit ADC with 4 Simultaneous Conversions
10-Bit ADC with
4 Simultaneous
Conversions
49
Example 49-5 shows the code sequence to set up the ADC module for Alternate Input Selection
mode in a 2-channel sequential sampling configuration.
Example 49-5: Code Sequence to Set Up ADC for Alternate Input Selection for 2-Channel
Sequential Sampling
Figure 49-15: Alternate Input Selection in 2-Channel Sequential Sampling Configuration
AD1CON2bits.CHPS=1; // Select 2-channel mode
AD1CON2bits.SMPI = 3; // Select 4 conversion between interrupt
AD1CON1bits.ASAM = 1; // Enable Automatic Sampling
AD1CON2bits.ALTS = 1; // Enable Alternate Input Selection
AD1CON1bits.SIMSAM = 0; // Enable Sequential Sampling
AD1CON1bits.SSRC = 2; // Timer3 generates SOC trigger
// Initialize MUXA Input Selection
AD1CHS0bits.CH0SA = 5; // Select AN5 for CH0 +ve input
AD1CHS0bits.CH0NA = 0; // Select AV
SS for CH0 -ve input
AD1CHS123bits.CH123SA=0; // Select AN0 for CH1 +ve input
AD1CHS123bits.CH123NA=0; // Select AV
SS for CH1 -ve inputs
// Initialize MUXB Input Selection
AD1CHS0bits.CH0SB = 4; // Select AN4 for CH0 +ve input
AD1CHS0bits.CH0NB = 0; // Select AV
SS for CH0 -ve input
AD1CHS123bits.CH123SB=1; // Select AN3 for CH1 +ve input
AD1CHS123bits.CH123NB=0; // Select AV
SS for CH1-ve inputs
Sample
(AN5)
Sample
(AN0)
CH0
CH1
Convert
(AN5)
Convert
(AN0)
SOC
Trigger
Sample
(AN4)
Sample
(AN3)
Convert
(AN4)
Convert
(AN3)
Sample/Convert Sequence 1
Sample/Convert Sequence 2
Sample
(AN4)
Sample
(AN5)
1 2
3
4
5
ADC
Interrupt
Sample
(AN5)
Sample
(AN0)
AN5
AN0
AN4
AN3
ADC1BUF0
ADC1BUF1
ADC1BUF2
ADC1BUF3
Note 1: CH0-CH1 input multiplexer selects the analog input for sampling using MUXA control bits (CHySA/CHyNA). The selected analog
input is connected to the sample capacitor.
2: On SOC Trigger, CH0/CH1 inputs are sequentially sampled and converted to equivalent digital counts.
3: CH0-CH1 input multiplexer selects the analog input for sampling using MUXB control bits (CHySB/CHyNB). The selected analog
input is connected to the sample capacitor.
4: On SOC Trigger, CH0/CH1 inputs are sequentially sampled and converted to equivalent digital counts.
5: ADC interrupt is generated after converting 4 samples. CH0-CH1 input multiplexer selects the analog input for sampling using
MUXA control bits (CHySA/CHyNA). The selected analog input is connected to the sample capacitor.

- 1
- 2
…
- 27
- 28
- 29
- 30
- 31
…
- 57
- 58