© 2004 Microchip Technology Inc. DS70065C-page 18-27
Section 18. 12-bit A/D Converter
12-bit A/D
Converter
18
18.16 Reading the A/D Result Buffer
The RAM is 12-bits wide, but the data is automatically formatted to one of four selectable formats
when a read from the buffer is performed. The FORM<1:0> bits (ADCON1<9:8>) select the for-
mat. The formatting hardware provides a 16-bit result on the data bus for all of the data formats.
Figure 18-12 shows the data output formats that can be selected using the FORM<1:0> control
bits.
Figure 18-12: A/D Output Data Formats
Table 18-3: Numerical Equivalents of Various Result Codes
RAM Contents: d11 d10 d09 d08 d07 d06 d05 d04 d03 d02 d01 d00
Read to Bus:
Integer 0 0 0 0 d11 d10 d09 d08 d07 d06 d05 d04 d03 d02 d01 d00
Signed Integer d11
d11 d11 d11 d11 d10 d09 d08 d07 d06 d05 d04 d03 d02 d01 d00
Fractional d11 d10 d09 d08 d07 d06 d05 d04 d03 d02 d01 d00 0 0 0 0
Signed Fractional (1.15) d11
d10 d09 d08 d07 d04 d03 d02 d01 d00 d01 d00 0 0 0 0
VIN/VREF
12-bit
Output Code
16-bit Unsigned
Integer Format
16-bit Signed
Integer Format
16-bit Unsigned
Fractional Format
16-bit Signed
Fractional Format
4095/4096 1111 1111 1111 0000 1111 1111 1111
= 4095
0000 0111 1111 1111
= 2047
1111 1111 1111 0000
= 0.9998
0111 1111 1111 0000
= 0.9995
4094/4096 1111 1111 1110 0000 1111 1111 1110
= 4094
0000 0111 1111 1110
= 2046
1111 1111 1110 0000
= 0.9995
0111 1111 1110 0000
= 0.9990
• • •
2049/4096 1000 0000 0001 0000 1000 0000 0001
= 2049
0000 0000 0000 0001
= 1
1000 0000 0001 0000
= 0.5002
0000 0000 0001 0000
= 0.0005
2048/4096 1000 0000 0000 0000 1000 0000 0000
= 2048
0000 0000 0000 0000
= 0
1000 0000 0000 0000
= 0.500
0000 0000 0000 0000
= 0.000
2047/4096 0111 1111 1111 0000 0111 1111 1111
= 2047
1111 1111 1111 1111
= -1
0111 1111 1111 0000
= 0.4998
1111 1111 1111 0000
= -0.0005
• • •
1/4096 0000 0000 0001 0000 0000 0000 0001
= 1
1111 1000 0000 0001
= -2047
0000 0000 0001 0000
= 0.0002
1000 0000 0001 0000
= -0.9995
0/4096 0000 0000 0000 0000 0000 0000 0000
= 0
1111 1000 0000 0000
= -2048
0000 0000 0000 0000
= 0.000
1000 0000 0000 0000
= -1.000