English
Language : 

PIC32MX440F256H-80I Datasheet, PDF (513/646 Pages) Microchip Technology – 64/100-Pin General Purpose and USB 32-Bit Flash Microcontrollers
PIC32MX3XX/4XX
22.4.8 AUTOMATIC ACQUISITION
Automatic acquisition control is enabled by setting the
ASAM (AD1CON1<2>) bit. Setting the ASAM bit initi-
ates automatic acquisition, and clearing the SAMP
(AD1CON1<1>) bit terminates sampling and starts
conversion. After the conversion completes, the mod-
ule will automatically return to an acquisition state. The
SAMP bit is automatically set at the start of the acquisi-
tion interval. The user software must time the clearing
of the SAMP bit to ensure adequate acquisition time of
the input signal, understanding that the time between
clearing of the SAMP bit includes the conversion time
as well as the acquisition time. See Example 22-2 for a
code example.
EXAMPLE 22-2: CONVERTING 1 CHANNEL, AUTOMATIC SAMPLE START, MANUAL
CONVERSION START CODE
AD1PCFG = ~(1 << 5);
// all PORTB = Digital but RB5 = analog
AD1CON1 = 0x0004;
// ASAM bit = 1 implies acquisition ..
// starts immediately after last conversion is done
AD1CHS = 5 << 16;
// Connect RB5/AN5 as CH0 input
AD1CSSL = 0;
AD1CON2 = 0;
AD1CON3 = 0x0002;
// Sample time manual, Tad = 6 TPB
AD1CON1SET = 0x8000;
// turn ADC ON
while (1) // repeat continuously
{
DelayNmSec(100);
// sample for 100 mS
AD1CON1CLR = 0x0002;
// start Converting
while (!(AD1CON1 & 0x0001));
// conversion done?
ADCValue = ADC1BUF0;
// yes then get ADC value
}
// repeat
22.4.9 CLOCKED CONVERSION TRIGGER
When SSRC<2:0> = 111, the conversion trigger is
under ADC clock control. The SAMC bits
(AD1CON3<4:0>) select the number of TAD clock
cycles between the start of acquisition and the start of
conversion. This trigger option provides the fastest
conversion rates on multiple channels. After the start of
acquisition, the module will count a number of TAD
clocks specified by the SAMC bits.
EQUATION 22-1: CLOCKED CONVERSION
TRIGGER TIME
TSMP = SAMC<4:0>* TAD
SAMC must always be programmed for at least one
clock cycle. See Example 22-3 for a code example.
© 2008 Microchip Technology Inc.
Preliminary
DS61143E-page 511