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

8M. Data Transfers
II. SOFTWARE GUIDES - 8. Driver488/DRV
II-112
Personal488 User’s Manual, Rev. 3.0
Notice that the ability to use
EOL IN NONE
requires the ability to use the character count returned by
the DOS
Read Data
command, and the ability to check Driver488/DRV status using
IOCTL
. The
advantage of using
EOL IN NONE
is that only data is returned to the program. Driver488/DRV does
not have to add terminators to the data, and the program does not need to search for terminators to
know the amount of data it received.
RawMode Communication
When communicating with character devices, DOS normally checks the transferred data for control
characters such as
X-ON
,
X-OFF
and
control-Z
. However, when communicating with
Driver488/DRV, this is not desirable. First, it might interfere with control characters that are supposed
to be transferred to or from Driver488/DRV. Second, and more importantly, when DOS is checking
for control characters, it only transfers one character at a time to or from Driver488/DRV. This is
much less efficient than transferring large blocks of data. Therefore, whenever possible DOS should be
configured not to check for control characters when communicating with Driver488/DRV. This is
typically accomplished by a function called
RawMode
in the language-specific support files (such as
IEEEIO.C
) provided with Driver488/DRV. The assembly-language fragment, provided in the
following table, performs this function.
mov
AX,4400h
;DOS Get Device Data Function
mov
BX,ieee
;File handle for Driver488/DRV
int
21h
;Execute DOS function
mov
DH,0
;Must clear DH
or
DL,20h
:Set “don’t check for control characters” bit
mov
AX,4401h
;DOS Set Device Data Function
mov
BX,ieee
;File handle
int
21h
;Execute DOS function
The first part of this code fragment reads the current device control settings from DOS. These are
returned in the
DX
register which is then modified to tell DOS not to check for control characters.
Finally, DOS is again called to implement the new control settings.
RawMode
can greatly improve the efficiency of communication with Driver488/DRV, and should be
used whenever possible, but it is not required unless
EOL OUT NONE
is to be used.
EOL OUT NONE
Once DOS has been told not to check for control characters, and we have chosen a programming
language (such as C or True Basic, but not BASIC) that can send an entire command in one DOS
Write Data
call, we can use
EOL OUT NONE
so that we do not have to append termination characters
to Driver488/DRV commands.
If
EOL OUT NONE
is specified, Driver488/DRV assumes that the data it receives from DOS is the
complete command. Obviously,
EOL OUT NONE
cannot be used with the BASIC
PRINT#
statement
because
PRINT#
transfers characters one at a time to DOS, which passes them along individually to
Driver488/DRV. Commands are not given to Driver488/DRV in a single transfer. Even when the
language does pass the command to DOS in a single transfer, DOS does not pass the command to
Driver488/DRV in one transfer unless we have configured DOS to use
RawMode
as described above.
The following C code fragment reads data using the above procedure:
#define bufsize 256
char response[bufsize],
/* holds read data */
ioctlbuf[1];
/* holds IOCTL status */
int len,
/* number received this time */
total=0;
/* total received */
do {len=ieeerd(response);
/* read some data */
if (len==-1) {...error...} /* check for error */
total += len;
/* add len to total */
/* process len characters at this point */
if (len
/* done if partial */
ioctl_rd(ieee,ioctlbuf,1); /* repeat while more */
} while (ioctlbuf==’1’);