English
Language : 

PIC32MX440F256H-80I Datasheet, PDF (505/646 Pages) Microchip Technology – 64/100-Pin General Purpose and USB 32-Bit Flash Microcontrollers
The start time for sampling can be controlled in soft-
ware by setting the SAMP control bit. The start of the
sampling time can also be controlled automatically by
the hardware. When the A/D converter operates in the
Auto-Sample mode, the SHA is reconnected to the
analog input pin at the end of the conversion in the
sample/convert sequence. The auto-sample function is
controlled by the ASAM control bit (AD1CON1<2>).
The conversion trigger source ends the sampling time
and begins an A/D conversion or a sample/convert
sequence. The conversion trigger source is selected by
the control bits SSRC<2:0> (AD1CON1<7:5>). The
conversion trigger can be taken from a variety of hard-
ware sources, or can be controlled manually in soft-
ware by clearing the SAMP control bit. One of the
conversion trigger sources is an auto-conversion. The
time between auto-conversions is set by a counter and
the ADC clock. The Auto-Sample mode and auto-con-
version trigger can be used together to provide endless
automatic conversions without software intervention.
An interrupt may be generated at the end of each sam-
ple sequence or multiple sample sequences as deter-
mined by the value of the SMPI<3:0>
(AD1CON2<5:2>). The number of sample sequences
between interrupts can vary between 1 and 16. The
user should note that the A/D conversion buffer holds
the results of a single conversion sequence. The next
sequence starts filling the buffer from the top even if the
number of samples in the previous sequence was less
than 16. The total number of conversion results
between interrupts is the SMPI value. The total number
of conversions between interrupts cannot exceed the
physical buffer length.
22.3 ADC Module Configuration
Operation of the ADC module is directed through bit
settings in the appropriate registers. The following
instructions summarize the actions and the settings.
Options and details for each configuration step are
provided in subsequent sections.
1. To configure the ADC module, perform the
following steps:
A-1. Configure analog port pins in
AD1PCFG<15:0>, as described in Section
22.3.1 “Configuring Analog Port Pins”.
B-1. Select the analog inputs to the ADC MUXs in
AD1CHS<32:0>, as described in Section
22.3.2 “Selecting the Analog Inputs to the
ADC MUXs”.
C-1. Select the format of the ADC result using
FORM<2:0> (AD1CON1<10:8>), as
described in Section 22.3.3 “Selecting the
Format of the ADC Result”.
PIC32MX3XX/4XX
C-2. Select the sample clock source using
SSRC<2:0> (AD1CON1<7:5>), as described
in Section 22.3.3.1 “Selecting the Sample
Clock Source”.
D-1. Select the voltage reference source using
VCFG<2:0> (AD1CON2<15:13>), as
described in Section 22.3.6 “Selecting the
Voltage Reference Source”.
D-2. Select the Scan mode using CSCNA
(AD1CON2<10>), as described in Section
22.3.7 “Selecting the Scan Mode”.
D-3. Set the number of conversions per interrupt
SMPI<3:0> (AD1CON2<5:2>), if interrupts
are to be used, as described in Section
22.3.8 “Setting the Number of Conver-
sions per Interrupt”.
D-4. Set Buffer Fill mode using BUFM
(AD1CON2<1>), as described in Section
22.3.9 “Buffer Fill Mode”.
D-5. Select the MUX to be connected to the ADC
in ALTS (AD1CON2<0>), as described in
Section 22.3.10 “Selecting the MUX to be
Connected to the ADC (Alternating Sam-
ple Mode)”.
E-1. Select the ADC clock source using ADRC
(AD1CON3<15>), as described in Section
22.3.11 “Selecting the ADC Conversion
Clock Source and Prescaler”.
E-2. Select the sample time using SAMC<4:0>
(AD1CON3<12:8>), if auto-convert is to be
used, as described in Section 22.3.12
“Acquisition Time Considerations”.
E-3. Select the ADC clock prescaler using
ADCS<7:0> (AD1CON3<7:0>), as described
in Section 22.3.11 “Selecting the ADC
Conversion Clock Source and Prescaler”.
F. Turn on ADC module using AD1CON1<15>,
as described in Section 22.3.13 “Turning
the ADC On”.
Note:
Steps A through E, above, can be per-
formed in any order, but Step F must be
the final step in every case.
2. To configure ADC interrupt (if required).
A-1. Clear AD1IF bit (IFS1<1>), as described in
Section 8.0 “Interrupts”.
A-2. Select ADC interrupt priority AD1IP<2:0>
(IPC<28:26>) and sub priority AD1IS<1:0>
(IPC<24:24>), as described in Section 8.0
“Interrupts”, if interrupts are to be used.
3. Start the conversion sequence by initiating
sampling, as described in Section 22.3.14 “Ini-
tiating Sampling”.
© 2008 Microchip Technology Inc.
Preliminary
DS61143E-page 503