12-9
ANALOG-TO-DIGITAL (A/D) CONVERTER
12.5 DETERMINING A/D STATUS AND CONVERSION RESULTS
You can read the AD_RESULT register (Figure 12-6) to determine the status of the A/D convert-
er. The AD_RESULT register is cleared when a new conversion is started; therefore, to prevent
losing data, you must read both bytes before a new conversion starts. If you read AD_RESULT
before the conversion is complete, the result is not guaranteed to be accurate.
The conversion result is the ratio of the input voltage to the reference voltage:
You can also read the interrupt pending register (see Table 12-2 on page 12-2) to determine the
status of the A/D interrupt.
AD_RESULT (Read)
Address:
Reset State (MC, MD):
Reset State (MH):
1FAAH
FFC0H
7FC0H
The A/D result (AD_RESULT) register consists of two bytes. The high byte contains the eight most-
significant bits from the A/D converter. The low byte contains the two least-significant bits from a ten-
bit A/D conversion, indicates the A/D channel number that was used for the conversion, and indicates
whether a conversion is currently in progress.
15 8
ADRLT9 ADRLT8 ADRLT7 ADRLT6 ADRLT5 ADRLT4 ADRLT3 ADRLT2
7 0
ADRLT1 ADRLT0 — STATUS ACH3 ACH2 ACH1 ACH0
Bit
Number
Bit
Mnemonic
Function
15:6 ADRLT9:0 A/D Result
These bits contain the A/D conversion result.
5 — Reserved. This bit is undefined.
4 STATUS A/D Status
Indicates the status of the A/D converter. Up to 8 state times are required
to set this bit following a start command. When testing this bit, wait at
least the 8 state times.
0 = A/D is idle
1 = A/D conversion is in progress
3:0 ACH3:0 A/D Channel Number
These bits indicate the A/D channel number that was used for the
conversion.
Figure 12-6. A/D Result (AD_RESULT) Register — Read Format
RESULT (8-bit) 255
V
IN
ANGND–
V
REF
ANGND–
-------------------------------------------
×= RESULT (10-bit) 1023
V
IN
ANGND–
V
REF
ANGND–
-------------------------------------------
×=