Datasheet
PIC18F97J94 FAMILY
DS30575A-page 472 2012 Microchip Technology Inc.
FIGURE 22-12: SIMPLE COMPARISON OPERATIONS (GREATER THAN AND LESS THAN)
22.7.5.2 Inside Window Comparison
When the Compare Mode bits, CM<1:0>, are
programmed as '10', the converter compares the sam-
pled value to see if it falls between the threshold values
in the buffer and mirrored channel location. Since the
value in the mirrored channel location is always the
greater value of the two thresholds, the condition is met
when:
Threshold 2 > Converted Value > Threshold 1
In this case, both of the following occur:
• The Compare Hit bit (CHHn) for the correspond-
ing channel is set; the Compare Hit bit for the
mirrored channel remains cleared.
• If the Write Mode bits, WM<1:0>
(ADCON5L<3:2>), are programmed to '01', the
converted value is written to the buffer, replacing
the lower threshold value. If WM<1:0> = 10, the
converted value is discarded.
The changes to the result buffer and the Compare Hit
register are shown in Figure 22-14.
ADC1BUF15 —
ADC1BUF14 —
ADC1BUF13 —
ADC1BUF12 —
ADC1BUF11 —
ADC1BUF10 —
ADC1BUF9 —
ADC1BUF8 —
ADC1BUF7 —
ADC1BUF6 —
ADC1BUF5 —
ADC1BUF4 —
ADC1BUF3 —
ADC1BUF2 Threshold Value
ADC1BUF1 —
ADC1BUF0 —
Before Conversion and Comparison
AD1CHITL
15 14 13 12 11 10 9 8
0000000 0
765432 10
000001 00
After Conversion and Comparison
Compare Only
(‘10’)
Compare and
Store (‘01’)
ADC1BUF15 — —
ADC1BUF14 — —
ADC1BUF13 — —
ADC1BUF12 — —
ADC1BUF11 — —
ADC1BUF10 — —
ADC1BUF9 — —
ADC1BUF8 — —
ADC1BUF7 — —
ADC1BUF6 — —
ADC1BUF5 — —
ADC1BUF4 — —
ADC1BUF3 — —
ADC1BUF2 Threshold Value Conversion Value
ADC1BUF1 — —
ADC1BUF0 — —
AD1CHITL
15 14 13 12 11 10 9 8
00000000
76543210
00000000