Rainbow Electronics АDC0805 User Manual
Page 30

3D00
3E90
MVI 90
3D02
D3E7
Out Control Port
Program PPI
3D04
2601
MVI H 01
Auto-Zero Subroutine
3D06
7C
MOV A H
3D07
D3E6
OUT C
Close SW1 open SW2
3D09
0680
MVI B 80
Initialize SAR bit pointer
3D0B
3E7F
MVI A 7F
Initialize SAR code
3D0D
4F
MOV C A
Return
3D0E
D3E5
OUT B
Port B
4 SAR code
3D10
31AA3D
LXI SP 3DAA
Start
Dimension stack pointer
3D13
D3E4
OUT A
Start A D
3D15
FB
IE
3D16
00
NOP
Loop
Loop until INT asserted
3D17
C3163D
JMP Loop
3D1A
7A
MOV A D
Auto-Zero
3D1B
C600
ADI 00
3D1D
CA2D3D
JZ Set C
Test A D output data for zero
3D20
78
MOV A B
Shift B
3D21
F600
ORI 00
Clear carry
3D23
1F
RAR
Shift ‘1‘ in B right one place
3D24
FE00
CPI 00
Is B zero
If yes last
3D26
CA373D
JZ Done
approximation has been made
3D29
47
MOV B A
3D2A
C3333D
JMP New C
3D2D
79
MOV A C
Set C
3D2E
B0
ORA B
Set bit in C that is in same
3D2F
4F
MOV C A
position as ‘1‘ in B
3D30
C3203D
JMP Shift B
3D33
A9
XRA C
New C
Clear bit in C that is in
3D34
C30D3D
JMP Return
same position as ‘1‘ in B
3D37
47
MOV B A
Done
then output new SAR code
3D38
7C
MOV A H
Open SW1
close SW2 then
3D39
EE03
XRI 03
proceed with program
Preamp
3D3B
D3E6
OUT C
is now zeroed
3D3D
Normal
Program for processing
proper data values
3C3D
DBE4
IN A
Read A D Subroutine
Read A D data
3C3F
EEFF
XRI FF
Invert data
3C41
57
MOV D A
3C42
78
MOV A B
Is B Reg
4 0 If not stay
3C43
E6FF
ANI FF
in auto zero subroutine
3C45
C21A3D
JNZ Auto-Zero
3C48
C33D3D
JMP Normal
Note
All numerical values are hexadecimal representations
FIGURE 20 Software for Auto-Zeroed Differential A D
5 3 Multiple A D Converters in a Z-80
Interrupt Driven
Mode (Continued)
The following notes apply
1) It is assumed that the CPU automatically performs a RST
7 instruction when a valid interrupt is acknowledged (CPU
is in interrupt mode 1) Hence the subroutine starting ad-
dress of X0038
2) The address bus from the Z-80 and the data bus to the Z-
80 are assumed to be inverted by bus drivers
3) A D data and identifying words will be stored in sequen-
tial memory locations starting at the arbitrarily chosen ad-
dress X 3E00
4) The stack pointer must be dimensioned in the main pro-
gram as the RST 7 instruction automatically pushes the
PC onto the stack and the subroutine uses an additional
6 stack addresses
5) The peripherals of concern are mapped into I O space
with the following port assignments
HEX PORT ADDRESS
PERIPHERAL
00
MM74C374 8-bit flip-flop
01
A D 1
02
A D 2
03
A D 3
04
A D 4
05
A D 5
06
A D 6
07
A D 7
This port address also serves as the A D identifying word in
the program
30