TMP91C824
91C824-191
2008-02-20
Example:
a. Convert the analog input voltage on the AN3 pin and write the result, to memory
address 0800H using the AD interrupt (INTAD) processing routine.
Main routine:
7
6
5
4 3 2 1 0
INTE0AD
←
– 1 0 0 – – – –
Enable INTAD and set it to interrupt level 4.
ADMOD1
←
1 1 X X 0 0 1 1
Set pin AN3 to be the analog input channel.
ADMOD0
←
– – 0 0 X 0 0 1
Start conversion in channel fixed single conversion mode.
Interrupt routine processing example:
WA
←
ADREG37
Read value of ADREG37L and ADREG37H into 16-bit
general-purpose register WA.
WA
> > 6
Shift contents read into WA six times to right and zero-fill
upper bits.
(0800H)
←
WA
Write contents of WA to memory address 0800H.
b. This example repeatedly converts the analog input voltages on the three pins
AN0, AN1 and AN2, using channel scan repeat conversion mode.
INTE0AD
←
– 0 0 0 – – – –
Disable INTAD.
ADMOD1
←
1 – X X 0 0 1 0
Set pins AN0 to AN2 to be the analog input channels.
ADMOD0
←
– – 0 0 X 1 1 1
Start conversion in channel scan repeat conversion mode.
X
:
Don’t care; –
:
No change