© 2004 Microchip Technology Inc. DS70064C-page 17-39
Section 17. 10-bit A/D Converter
10-bit A/D
Converter
17
17.15.5 Example: Using Alternating MUX A, MUX B Input Selections
Figure 17-18 and Table 17-6 demonstrate alternate sampling of the inputs assigned to MUX A
and MUX B. In this example, 2 channels are enabled to sample simultaneously. Setting the ALTS
bit enables alternating input selections. The first sample uses the MUX A inputs specified by the
CH0SA, CH0NA, CHXSA and CHXNA bits. The next sample uses the MUX B inputs specified
by the CH0SB, CH0NB, CHXSB and CHXNB bits. In this example, one of the MUX B input
specifications uses 2 analog inputs as a differential source to the sample/hold, sampling
(AN3-AN9).
This example also demonstrates use of the dual 8-word buffers. An interrupt occurs after every
4th sample, resulting in filling 8-words into the buffer on each interrupt.
Note that using 4 sample/hold channels without alternating input selections results in the same
number of conversions as this example, using 2 channels with alternating input selections.
However, because the CH1, CH2 and CH3 channels are more limited in the selectivity of the
analog inputs, this example method provides more flexibility of input selection than using 4
channels.
Figure 17-18: Converting Two Sets of Two Inputs Using Alternating Input Selections
ADCLK
SAMP
ADCBUF0
ADCBUF1
DONE
ADCBUF2
ADCBUF3
Input to
AN1
TSAMP
ADIF
TCONVTCONV
AN0
Input to
ADCBUF4
ADCBUF5
ADCBUF6
ADCBUF7
AN15
TSAMP
TCONVTCONV
AN3-AN9
ASAM
BUFS
AN1
TSAMP
TCONVTCONV
AN0
AN15
TSAMP
TCONVTCONV
AN3-AN9
ADCBUF8
ADCBUF9
ADCBUFA
ADCBUFB
TCONVTCONV
TSAMP
AN15
AN3-AN9
Cleared by Software
CH0
CH1
Conversion
Trigger
Cleared
in software