beautypg.com

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

Page 126

background image

II. SOFTWARE GUIDES - 8. Driver488/DRV

8M. Data Transfers

Personal488 User’s Manual, Rev. 3.0

II-111

65,535

characters), and where the data is to be found in memory (the address of the data buffer). For

example, in C:

ieeewt(“HELLO\r\n”);

calls

Write Data

, telling it to send 7 characters to Driver488/DRV. In contrast, the BASIC command

PRINT#1,"HELLO"

causes the DOS

Write Data

command to be called 7 times, once for each character of the command,

and once for each carriage return and line feed that terminate the command. Each time

Write Data

is

called it is told to write just one character to Driver488/DRV from a specified location in memory.
Whether written all at once, or one character at a time, the command is transferred to DOS to be passed
to Driver488/DRV.

Once DOS has been told to write some data to Driver488/DRV, it calls Driver488/DRV with
essentially the same information that the program had told DOS: a command code that specifies

Write

Data

, a character count, and the location of the data. Driver488/DRV responds to DOS by processing

the data and returning the number of characters that have been accepted along with any error indicators.

When a program requests information from Driver488/DRV, it uses an MS-DOS

Read Data

command. It tells DOS where to get the data (from Driver488/DRV), the size of the data buffer (from

1

to

65,535

characters), and where the data is to be put in memory (the address of the data buffer). In

BASIC, for example, the command:

LINE INPUT#1,A$

causes the DOS

Read Data

command to be called repeatedly, reading one character at a time into

A$

until the carriage-return and line-feed combination that marks the end of the line, is read. Conversely,
in C:

ieeerd(response);

calls

Read Data

only once, requesting as many characters as there are in the array response.

When DOS has been told to read some data from Driver488/DRV, it calls Driver488/DRV with
essentially the same information that the program has told DOS: a command code that specifies

Read

Data

, a character count, and the location of the data buffer. Driver488/DRV responds to DOS by

filling some or all of the data buffer, and returning the number of characters that have been read along
with any error indicators. DOS then returns the number of characters read to the calling program.

If

EOL IN NONE

is specified, Driver488/DRV never appends terminators to data being read by the

program. This means that the program cannot search for a specified character or combination of
characters to know when to stop reading. Hence,

EOL IN NONE

cannot be used in languages such as

BASIC or Turbo Pascal which require carriage return and line feed at the end of input lines.
Languages such as C or True Basic, that use MS-DOS calls to communicate with Driver488/DRV, can
use

EOL IN NONE

by using the following procedure:

1.

Read data from Driver488/DRV into a buffer of reasonable size (typically 64 to 1024 bytes long).
DOS returns to the program the number of bytes read.

2.

If the number of bytes read is less than the length of the buffer, then the reading is done.
Otherwise, go on with step 3.

3.

Use the

IOCTL

function to check if Driver488/DRV has more information available. If it does

(

IOCTL

returned a

1

, ASCII

31h

), then go to step 1 to read more data into a new buffer.

Otherwise, the reading is done.