6-2
VL-1225/6 Analog Input/Output Board
Interrupt Mode Analog Input
The following code example shows how to operate the VL-1225/6 using interrupts. This specific example
requests an A/D conversion from channel 0. When the data is ready, an interrupt is generated causing
the DONE flag to be set. Data can be read from the variable named VALUE.
The key program sections are:
MAIN
Execution begins at this point. Installation and setup are coordinated.
INIT_188
Initializes the VL-188 interrupt controller to accept interrupts from the STD Bus.
Installs interrupt vector into low RAM.
INIT_1225
Initializes the VL-1225/6 to generate interrupts upon conversion complete.
ISR
Interrupt Service Routine. This subroutine is responsible for reading, processing,
and/or storing the A/D results from the VL-1225/6.
;VL-1225/6 REGISTER ADDRESSES
= 0300
istat
equ
00300h
;Interrupt Status Register
= 0300
ictrl
equ
00300h
;Interrupt Control Register
= 0303
select
equ
00303h
;Input Channel Select Register
= 0304
idlow
equ
00304h
;Input Data Low Register
= 0305
idhigh
equ
00305h
;Input Data High Register
= 0306
od0
equ
00306h
;Channel 0 Output Data Register
= 0307
od1
equ
00307h
;Channel 1 Output Data Register
;VL-188 I/O PORT ADDRESSES
= FF22
eoi
equ
0FF22h
;80188 EOI Register
= FF3A
int1
equ
0FF3Ah
;80188 INT1 Control Register
0000
stack
segment public ‘STACK’
0000 0100[ ?? ]
db
100h dup (?)
0100
stack
ends
0000
data
segment public ‘DATA’
0000 ????
value
dw
?
0002 ????
done
dw
?
0004
data
ends
0000
vector
segment public ‘VECTOR’
0034
org
0034h
0034 ????????????????
vec
dq
?
003C
vector
ends
0000
code
segment para public ‘CODE’
assume
cs:code,ds:data
0000
main:
;MAINLINE CODE
0000 B8 ---- R
mov
ax,data
;Set data segment register
0003 8E D8
mov
ds,ax
0005 C7 06 0000 R 0000
mov
value,0
;Initialize A/D results variable
000B E8 0027 R
call
init_188
;Initialize VL-188 interrupts
000E E8 0045 R
call
init_1225
;Initialize VL-1225/6 interrupts
0011 FB
sti
;Enable CPU interrupt flag
Software Examples – Interrupt Mode Analog Input