![VersaLogic VL-12CT96 Reference Manual Download Page 50](http://html.mh-extra.com/html/versalogic/vl-12ct96/vl-12ct96_reference-manual_1006747050.webp)
6-2
VL-12CT96/7 Analog & Digital I/O Card
Analog Input Interrupt Mode Code Example
The following code example shows how to use analog input with interrupts. An A/D conversion is
started in the normal manner, when the data is ready, an interrupt is generated.
The key program sections are:
MAIN :
Execution begins here. Installation and setup are coordinated here.
INIT_188 :
Initializes the VL-188 interrupt controller to accept interrupts from the STD
Bus. Installs interrupt vector into low RAM.
INIT_1296 :
Initializes the VL-12CT96/7 to generate interrupts upon conversion complete.
ISR :
Interrupt Service Routine. This subroutine is responsible for reading, process-
ing, and/or storing the A/D results from the VL-12CT96/7.
0000 .model small
0000 .stack
0000 .data
0000 ???? value dw ? ;Holding variable for A/D input
0002 .code
0000 vector segment at 0 ;CPU Interrupt Vector Table
0000 vector ends
;VL-12CT96/7 I/O PORT ADDRESSES
= 0300 control equ 0300h ;Control Register
= 0300 status equ 0300h ;Status Register
= 0301 select equ 0301h ;Channel Select Register
= 0302 convert equ 0302h ;Convert Register
= 0303 adclo equ 0303h ;A/D Data Low Register
= 0304 adchi equ 0304h ;A/D Data High Register
= 0309 clrflg equ 0309h ;Clear Flags Register
= 030A parlo equ 030Ah ;Parallel Port Data Low Register
= 030B parhi equ 030Bh ;Parallel Port Data High Register
= 030C dac0lo equ 030Ch ;D/A Channel 0 Data Low Register
= 030D dac0hi equ 030Dh ;D/A Channel 0 Data High Register
= 030E dac1lo equ 030Eh ;D/A Channel 1 Data Low Register
= 030F dac1hi equ 030Fh ;D/A Channel 1 Data High Register
;VL-188 I/O PORT ADDRESSES
= FF22 eoi equ 0FF22h ;80188 EOI Register
= FF3A int1 equ 0FF3Ah ;80188 INT1 Control Register
0000 main:
main:
main:
main:
main: ;MAINLINE CODE
0000 B8 0000s mov ax,@data ;Set data segment register
0003 8E D8 mov ds,ax
0005 C7 06 0000r 0000 mov value,0 ;Initialize holding variable
000B E8 000D call init_188 ;Initialize VL-188 interrupts
000E E8 0028 call init_1296 ;Initialize VL-12CT96/7 interrupts
0011 FB sti ;Enable CPU interrupt flag
0012 BA 0301 mov dx,select ;Begin conversion of channel 0
0015 B8 0000 mov ax,0
0018 EF out dx,ax
;VL-12CT96/7 will generate an interrupt
;request when the conversion is
;complete (takes about 15 uS)
;The ISR is responsible for reading
;the data.
0019 EB FE stop: jmp stop ;Rest of mainline goes here
001B init_188:
init_188:
init_188:
init_188:
init_188: ;VL-188 INTERRUPT INITIALIZATION
Software Examples — Analog Input Interrupt Mode
Summary of Contents for VL-12CT96
Page 2: ...ii VL 12CT96 7 Analog Digital I O Card ...
Page 26: ...2 20 VL 12CT96 7 Analog Digital I O Card ...
Page 32: ...3 6 VL 12CT96 7 Analog Digital I O Card ...
Page 62: ...7 4 VL 12CT96 7 Analog Digital I O Card ...
Page 65: ...VL 12CT96 7 Analog Digital I O Card 8 3 VL 12CT96 7 Parts Placement Reference ...