![VersaLogic VL-12CT96 Reference Manual Download Page 53](http://html.mh-extra.com/html/versalogic/vl-12ct96/vl-12ct96_reference-manual_1006747053.webp)
VL-12CT96/7 Analog & Digital I/O Card
6-5
Parallel Port Code Example
The following code example shows how to operate the digital I/O port. In this example, half of the port
signals are arbitrarily defined as inputs.
The key program sections are:
MAIN :
Direction initialization and calling syntax.
INIT_PAR :
Defines the signal direction of the parallel port channels. All output channels
are turned off.
CHANNEL_READ :
Returns the ON/OFF state of the channel specified by the AL register in the
CPU carry flag.
CHANNEL_ON :
Turns the channel specified by the AL register ON.
CHANNEL_OFF :
Turns the channel specified by the AL register OFF.
0000 .model small
0000 .stack
0000 .data
0000 ???? dir dw ? ;Port direction pattern
0002 .code
;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
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 B8 00FF mov ax,00FFh ;Parallel port direction control
0008 E8 001C call init_par ;D15 0 MD0 Direction = Input
;D14 0 MD1 Direction = Input
;D13 0 MD2 Direction = Input
;D12 0 MD3 Direction = Input
;D11 0 MD4 Direction = Input
;D10 0 MD5 Direction = Input
;D9 0 MD6 Direction = Input
;D8 0 MD7 Direction = Input
;D7 1 MD8 Direction = Output
;D6 1 MD9 Direction = Output
;D5 1 MD10 Direction = Output
;D4 1 MD11 Direction = Output
;D3 1 MD12 Direction = Output
;D2 1 MD13 Direction = Output
;D1 1 MD14 Direction = Output
;D0 1 MD15 Direction = Output
000B B0 0F mov al,15 ;Turn MD15 ON
000D E8 0031 call channel_on
0010 B0 0F mov al,15 ;Turn MD15 OFF
Software Examples — Parallel Port
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 ...