beautypg.com

Data & command communication – Measurement Computing Personal488 rev.3.0 For DOS & Windows 3.Xi User Manual

Page 117

background image

8K. Other Languages

II. SOFTWARE GUIDES - 8. Driver488/DRV

II-102

Personal488 User’s Manual, Rev. 3.0

0

: A response of

0

indicates that Driver488/DRV is ready to receive a command. It has no data to

read, nor is it expecting data for output to the IEEE 488 bus. Driver488/DRV is forced into this
state by the

IOCTL BREAK

command.

1

: A response of

1

indicates that Driver488/DRV has a response ready to be read by the user’s

program. The program must read the response before sending a new command (except

IOCTL BREAK

) or a

SEQUENCE - DATA HAS NOT BEEN READ

error occurs.

2

: A response of

2

indicates that Driver488/DRV is waiting for data to

OUTPUT

to the IEEE 488

bus. The user’s program must send the appropriate data with terminators as needed to
Driver488/DRV. Attempting to read from Driver488/DRV while it is waiting for data causes a

SEQUENCE - NO DATA AVAILABLE

error.

3

: A response of

3

indicates that Driver488/DRV is waiting for the completion of a command.

This is similar to a response of

2

except that Driver488/DRV is waiting for a command, rather than

for data to

OUTPUT

.

The

IOCTL Read

response can be read from Driver488/DRV as:

ioctlbufDB

0

;IOCTL Read response buffer

ioctllenEQU

$-ioctllen

;Length of buffer

mov

AX,4402h

;IOCTL Read

mov

BX,ieee

;File handle

mov

CX,ioctllen

;# chars to read

mov

DX,offset
ioctlbuf

;DS:DX - buffer

int 21h

;Execute DOS function

jc error

;Check for error

Data & Command Communication

Once Driver488/DRV has been opened, configured for

RawMode

communication, and reset with the

IOCTL Write

command

BREAK

, we are ready to communicate with Driver488/DRV and control the

IEEE 488 bus. The BASIC commands:

PRINT#1,"HELLO"
LINE INPUT#1,A$

might be implemented in assembly language as:

cr

EQU

0Dh

;Carriage-return

lf

EQU

0Ah

;Line-feed

hello

DB

“HELLO”,,cr,,lf

;HELLO command with terminators

hellolen

EQU

$-hello

;HELLO command length

response

DB

256 DUP (?)

;Place to put Driver488/DRV response

responselen

EQ

$-response

;Length of response buffer

recvdlen

DW

?

;Place to keep # chars in response

mov

AH, 40h

;DOS Write function

mov

BX, ieee

;File handle

mov

CX, hellolen

;Command length

mov

DX, offset hello

;DS:DX - command

int

21h

;Execute DOS function

jc

error

;Check for error

mov

AH, 3Fh

;DOS Read function

mov

BX, ieee

;File handle

mov

CX, responselen

;Buffer length

mov

DX, offset
response

;DS:DX - buffer

int

21h

;Execute DOS function

jc

error

;Check for error

mov

recvdlen, AX

;Save # of characters received

In this way, data and commands can be transferred to or from Driver488/DRV.