Vault 7: Projects

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

PIC24F Family Reference Manual
DS39737A-page 49-26 Preliminary © 2010 Microchip Technology Inc.
49.6 ANALOG INPUT SELECTION FOR CONVERSION
The ADC module provides a flexible mechanism to select analog inputs for conversion:
Fixed input selection
Alternate input selection
Channel scanning (CH0 only)
49.6.1 Fixed Input Selection
The 10-bit ADC configuration can use up to four S&H channels, designated CH0-CH3. The S&H
channels are connected to the analog input pins through the analog multiplexer.
When ALTS = 0, the CH0SA<4:0>, CH0NA, CH123SA and CH123NA<1:0> bits select the
analog inputs.
Table 49-8: Analog Input Selection
All four channels can be enabled in Simultaneous or Sequential Sampling modes by configuring
the CHPS bit and the SIMSAM bit.
Example 49-3 shows the code sequence to set up ADC inputs for a 4-channel ADC
configuration.
Example 49-3: Code Sequence to Set Up ADC Inputs
MUXA
Control bits Analog Inputs
CH0 +ve CH0SA<4:0> AN0 to AN5
-ve CH0NA AVss, AN1
CH1 +ve CH123SA AN0, AN3
-ve CH123NA<1:0> AVss
CH2 +ve CH123SA AN1, AN4
-ve CH123NA<1:0> AVss
CH3 +ve CH123SA AN2, AN5
-ve CH123NA<1:0> AVss
Note: Not all inputs are present on all devices.
// Initialize MUXA Input Selection
AD1CHS0bits.CH0SA = 3; // Select AN3 for CH0 +ve input
AD1CHS0bits.CH0NA = 0; // Select AVss for CH0 -ve input
AD1CHS123bits.CH123SA=0; // Select AN0 for CH1 +ve input
// Select AN1 for CH2+ve input
// Select AN2 for CH3 +ve input
AD1CHS123bits.CH123NA=0; // Select AVss for CH1/CH2/CH3 -ve inputs

e-Highlighter

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

Un-highlight all Un-highlight selectionu Highlight selectionh