270M
Rapid Scanning Imaging Spectrograph
5
Communicating
with
the
SPEX.SYS
Driver:
Each
of
the following subsections discusses a mode
of
communication from a
programming language,
or
from
DOS
or
a text file.
5.1
Communicating
from
"C"
language:
To begin communications with the device driver, use "fopeno• with the name
of
the
device driver as the filename
hDevice = fopen("SPEXOOOO","r+");
To terminate communications with the device driver, use "fcloseQ" with the file handle
that was returned from the ''fopenQ
0
call.
fclose(hDevice);
To send a command
to
the device, use "fprintfQ" in conjunction with ''fflushQ".
''fflushQ" empties C's internal file buffer.
fprintf(hDevice, "%s" ,command);
fflush(hDevice);
To
read the device (only in the case of using the device driver query function), use
''fgetsQ". Use "fseekQ" before and after the use of "fgetsQ" because C requires that
the calls
to
read and write not be adjacent
to
one another.
static void ReadQuery(char * buffer)
{
}
fseek(hDevice,
OL,
SEEK SET);
fgets0pBuffer, cbBUFFERLEN, hDevice);
fseek(hDevice,
OL,
SEEK_ SET);
5.2
Communicating
from
GWBasic:
To
begin communications with the device driver, use "OPEN" with the name
of
the
device driver as the filename. This let us send commands
to
the driver
by
virtue of the
attribute
FOR
OUTPUT.
68
Revised
November 24.
1992
Leica Microsystems, Inc.'s Ex. 1033