Measurement Computing Personal488 rev.3.0 For DOS & Windows 3.Xi User Manual
Page 81

8G. QuickBASIC
II. SOFTWARE GUIDES - 8. Driver488/DRV
II-66
Personal488 User’s Manual, Rev. 3.0
must be opened, one for input, and one for output. Other languages may allow the same file to be
opened for both input and output. Three file names are allowed:
\DEV\IEEEOUT
,
\DEV\IEEEIN
, and
\DEV\IEEE
. By convention, they are used for output, input, and both input and output, respectively.
But in actuality, they are all the same and any one of them can be used for input, output, or both,
depending on the programming language.
In BASIC, the files are opened with the following commands:
110 OPEN “\DEV\IEEEOUT” FOR OUTPUT AS #1
200 OPEN “\DEV\IEEEIN” FOR INPUT AS #2
Of course, file numbers may change as desired, but throughout this manual, file
#1
is assumed to output
to Driver488/DRV, and file
#2
is assumed to input from Driver488/DRV.
Once these files are opened, we can send commands and receive responses from Driver488/DRV.
While Driver488/DRV should normally be in a reset, inactive state, it is possible that it was left in
some unknown state by a previous program failure or error. In order to force Driver488/DRV into its
quiescent state we can use the
IOCTL
statement:
160 IOCTL#1,"BREAK"
IOCTL
is a BASIC statement that sends commands through a “back door” to Driver488/DRV.
Driver488/DRV recognizes this “back door” command regardless of what else it might be doing and
resets itself so that it is ready to accept a normal command. We can then completely reset the
Driver488/DRV with the
RESET
command:
170 PRINT#1,"RESET"
which resets the operating parameters of the Driver488/DRV back to their normal values (those that
were set during system boot by the
DRVR488
DOS command).
The
IOCTL BREAK
and
RESET
commands guarantee that Driver488/DRV is ready for action. Note
that the
IOCTL BREAK
and
RESET
commands are placed before the
OPEN
statement for file
#2
. This
guarantees that BASIC is able to open Driver488/DRV for input. For more details, see the
FILL
command in “Section III: Command References.”
With the initialization commands and some comments, the program now appears as:
100 ‘Establish communications with Driver488/DRV
110 OPEN “\DEV\IEEEOUT” FOR OUTPUT AS #1
120 ‘
150 ‘Reset Driver488/DRV
160 IOCTL#1,"BREAK"
170 PRINT#1,"RESET"
180 ‘
190 ‘Open file to read responses from Driver488/DRV
200 OPEN “\DEV\IEEEIN” FOR INPUT AS #2
Once everything is reset, we can enable the
SEQUENCE - NO DATA AVAILABLE
error detection by
setting the
FILL
mode to
ERROR
:
225 PRINT#1,"FILL ERROR"
We can also test the communications and read the Driver488/DRV revision number with the
HELLO
command:
310 PRINT#1,"HELLO"
320 INPUT#2,A$
330 PRINT A$
First we
the
HELLO
command to file
#1
, then we
INPUT
the response from file
#2
into the
character string variable
A$
(“A-string”). Finally we display the response with a
to the screen.
Because BASIC cannot both
and
INPUT
from the same file, we use two
OPEN
statements, and
two different file numbers to communicate with Driver488/DRV.
must reference the file
opened for output (in these examples, file
#1
) and
INPUT
must reference the file opened for input (file
#2
). Attempting to communicate with the wrong file (such as
INPUT#1
) results in an error.