Enabling The A/D Interrupt; Determining A/D Status And Conversion Results - Intel 8XC196K Series User Manual

Table of Contents

Advertisement

11.4.5 Enabling the A/D Interrupt

The A/D converter can set the A/D interrupt pending bit when it completes a conversion or when
the input voltage crosses the threshold value in the selected direction. To enable the interrupt, set
the corresponding mask bit in the interrupt mask register (see Table 11-2 on page 11-2) and exe-
cute the EI instruction to globally enable servicing of interrupts. The A/D interrupt can cause the
PTS to begin a new conversion. See Chapter 5, "Standard and PTS Interrupts," for details about
interrupts and a description of using the PTS in A/D scan mode.

11.5 DETERMINING A/D STATUS AND CONVERSION RESULTS

You can read the AD_RESULT register (Figure 11-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:
RESULT (8-bit)
=
You can also read the interrupt pending register (see Table 11-2 on page 11-2) to determine the
status of the A/D interrupt.
V
ANG ND
IN
×
------------------------------------------ -
255
V
ANGND
REF
ANALOG-TO-DIGITAL CONVERTER
RESULT (10-bit)
1023
=
V
ANGND
IN
×
------------------------------------------ -
V
ANGND
REF
11-9

Advertisement

Table of Contents
loading

Table of Contents