Intel 8XC196MC Microscope & Magnifier User Manual


 
8XC196MC, MD, MH USER’S MANUAL
5-34
To use the A/D scan mode, you must first set up a command/data table in memory (Table 5-7).
The command/data table contains A/D commands that are interleaved with blank memory loca-
tions. The PTS stores the conversion results in these blank locations. Only the amount of available
memory limits the table size; it can reside in internal or external RAM.
To initiate A/D scan mode, enable the A/D conversion complete interrupt and assign it to the PTS.
Software must initiate the first conversion. When the A/D finishes the first conversion and gen-
erates an A/D conversion complete interrupt, the interrupt vectors to the PTSCB and initiates the
A/D scan routine. The PTS stores the conversion results, loads a new command into
AD_COMMAND, and then decrements the number in PTSCOUNT. As each additional conver-
sion complete interrupt occurs, the PTS repeats the A/D scan cycle; it stores the conversion re-
sults, loads the next conversion command into the AD_COMMAND register, and decrements
PTSCOUNT. The routine continues until PTSCOUNT decrements to zero. When this occurs,
hardware clears the enable bit in the PTSSEL register, which disables PTS service, and sets the
PTSSRV bit, which requests an end-of-PTS interrupt.
The interrupt service routine could process the conversion results and then re-enable PTS service
for the A/D conversion complete interrupt. Because the lower six bits of the AD_RESULT regis-
ter contain status information, the end-of-PTS interrupt service routine could shift the results data
to the right six times to leave only the conversion results in the memory locations. See AP-483,
Application Examples Using the 8XC196MC/MD Microcontroller, for application examples with
code.
PTSCOUNT PTSCB + 0 Consecutive A/D Conversions
Defines the number of A/D conversions that will be completed during the
A/D scan routine. Each cycle consists of the PTS transferring the A/D
conversion results into the command/data table, and then loading a new
command into the AD_COMMAND register. Maximum number is 255.
Table 5-7. A/D Scan Mode Command/Data Table
Address Contents
XXXX + AH A/D Result 2
XXXX + 8H Unused A/D Command 3
XXXX + 6H A/D Result 1
XXXX + 4H Unused A/D Command 2
XXXX + 2H A/D Result 0
††
XXXX Unused A/D Command 1
Write 0000H to prevent a new conversion at the end of the
routine.
††
Result of the A/D conversion that initiated the PTS routine.
PTS A/D Scan Mode Control Block (Continued)
Figure 5-18. PTS Control Block – A/D Scan Mode (Continued)