# Vault 7: Projects

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

### Protego

# PIC24FJ32MC10X -- 10-Bit ADC

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

PIC24F Family Reference Manual
DS39737A-page 49-28 Preliminary © 2010 Microchip Technology Inc.
Example 49-4: Code Sequence to Set Up ADC for Alternate Input Selection Mode for 4-Channel
Simultaneous Sampling
Figure 49-14: Alternate Input Selection in 4-Channel Simultaneous Sampling Configuration
AD1CON2bits.CHPS = 3; // Select 4-channel mode
AD1CON1bits.SIMSAM = 1; // Enable Simultaneous Sampling
AD1CON2bits.ALTS = 1; // Enable Alternate Input Selection
AD1CON2bits.SMPI = 1; // Select 8 conversion between interrupt
AD1CON1bits.ASAM = 1; // Enable Automatic Sampling
AD1CON1bits.SSRC = 2; // Timer3 generates SOC trigger
// Initialize MUXA Input Selection
AD1CHS0bits.CH0SA = 4; // Select AN4 for CH0 +ve input
AD1CHS0bits.CH0NA = 0; // Select AVss for CH0 -ve input
AD1CHS123bits.CH123SA = 0; // Select CH1 +ve = AN0, CH2 +ve = AN1, CH3 +ve = AN2
AD1CHS123bits.CH123NA = 0; // Select AVss for CH1/CH2/CH3 -ve inputs
// Initialize MUXB Input Selection
AD1CHS0bits.CH0SB = 5; // Select AN5 for CH0 +ve input
AD1CHS0bits.CH0NB = 0; // Select AVss for CH0 -ve input
AD1CHS123bits.CH123SB = 1; // Select CH1 +ve = AN3, CH2 +ve = AN4, CH3 +ve = AN5
AD1CHS123bits.CH123NB = 0; // Select AVss for CH1/CH2/CH3 -ve inputs
Sample
(AN4)
Sample
(AN0)
CH0
CH1
Sample
(AN1)
Sample
(AN2)
CH2
CH3
Convert
(AN4)
Convert
(AN0)
Convert
(AN1)
Convert
SOC
Trigger
Convert
(AN2)
Sample
(AN5)
Sample
(AN3)
Sample
(AN4)
Sample
(AN5)
Convert
(AN5)
Convert
(AN3)
Convert
(AN4)
Convert
(AN5)
Sample/Convert Sequence 1 Sample/Convert Sequence 2
Sample
(AN4)
Sample
(AN0)
Sample
(AN1)
Sample
(AN2)
2
3
5
ADC
Interrupt
1
4
AN4
AN0
AN1
AN2
AN5
AN3
AN4
AN5
ADC1BUF0
ADC1BUF1
ADC1BUF7
Note 1: CH0-CH3 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-CH3 sample capacitor is disconnected from the multiplexer to simultaneously sample the analog inputs. The
analog value captured in CH0/CH1/CH2/CH3 is converted sequentially to equivalent digital counts.
3: CH0-CH3 input multiplexer selects 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-CH3 sample capacitor is disconnected from the multiplexer to simultaneously sample the analog inputs. The
analog value captured in CH0/CH1/CH2/CH3 is converted sequentially to equivalent digital counts.
5: ADC interrupt is generated after converting 8 samples. CH0-CH3 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
…
- 26
- 27
- 28
- 29
- 30
…
- 57
- 58