User manual

Table Of Contents
Analog-to-Digital Converter Peripheral Labs
© 2009 Microchip Technology Inc. DS41369A-page 83
5.2.3.4 TESTING THE APPLICATION
Program the PIC16F690. Turning the potentiometer connected to pin 13 should light
the LEDs sequentially in a binary fashion. Note that these are the 4 Most Significant
bits of the ADC result. Adding 6 more LEDs and I/O pins would allow the complete
10-bit value to be displayed. To determine the significance of each bit in the
ADRESH:ADRESL 10-bit result, see Figure 5-4.
FIGURE 5-4: ADC RESULT BIT SIGNIFICANCE
V
DD
1
2
V
DD
1
4
V
DD
1
8
V
DD
1
16
V
DD
1
32
V
DD
1
64
V
DD
1
128
V
DD
1
256
V
DD
1
512
V
DD
1
1024
10-BIT ADC RESULT (ADRESH: ADRESL)
Example:
If following an ADC, the ADRESH:ADRESL contains the following 10-bit
value:
10-BIT ADC RESULT (ADRESH: ADRESL)
1100100001
V
DD
2
1
+
V
DD
4
1
+
V
DD
32
1
+
V
DD
1024
1
=
5V
2
1
+
5V
4
1
+
5V
32
1
+
5V
1024
1
=
2.5V
+
1.25V
+
0.15625V
+
0.000488V
=
3.911V
(rounded to the nearest mV)
Note: Assumes that VDD is used as the ADC reference. If an external
reference is used, the voltage present on V
REF pin is substituted
for V
DD.
Bit positions set to ‘1
are added together
Note: Using a 5V reference voltage with a 10-bit provides a resolution of
0.000488V or 4.88mV (5V/1024).