Microchip Technology DM183037 Data Sheet

Page of 696
 2012 Microchip Technology Inc.
DS30575A-page 481
PIC18F97J94 FAMILY
22.8.3
USING DUAL BUFFERS
 and 
 demonstrate using
dual buffers and alternating the buffer fill.
Setting the BUFM bit enables dual buffers. In this
example, an interrupt is generated after each sample.
The BUFM setting does not affect other operational
parameters. First, the conversion sequence starts
filling the buffer at ADCBUF0. After the first interrupt
occurs, the buffer begins to fill at ADCBUF8. The BUFS
status bit is toggled after each interrupt.
FIGURE 22-18:
CONVERTING A SINGLE CHANNEL, ONCE PER INTERRUPT, USING DUAL, 
8-WORD BUFFERS    
A/D CLK
SAMP
ADC1BUF0
BSET AD1CON1, #ASAM
Analog Input
AN3
T
SAMP
AD1IF
ADC1BUF8
AN3
T
SAMP
AN3
T
SAMP
BUFS
Conversion
Trigger
T
CONV
T
CONV
T
CONV
T
CONV
T
CONV
T
CONV
T
CONV
T
CONV
T
CONV
T
CONV
BCLR IFS0, #AD1IF
BCLR IFS0, #AD1IF
T
CONV
T
CONV
Instruction Execution