Initialization of the system – Measurement Computing Personal488 rev.3.0 For DOS & Windows 3.Xi User Manual
Page 88

II. SOFTWARE GUIDES - 8. Driver488/DRV
8H. Turbo C
Personal488 User’s Manual, Rev. 3.0
II-73
•
IEEEIO.C:
Communications routines for Driver488/DRV
•
IEEEIO.H:
Header file, contains declarations from
IEEEIO.C
•
CRITERR.ASM:
Critical error handler assembly language source file (included with Microsoft C
and Turbo C, only)
•
CRITERR.OBJ:
Object file produced from
CRITERR.ASM
(included with Microsoft C and Turbo
C, only)
•
CRITERR.H:
Header file, contains declarations for using
CRITERR.ASM
The actual demonstration program is contained in
195DEMO.C
(described by the project file
195DEMO.PRJ
in Turbo C, only).
All files for Microsoft C are in the
\MSC
directory; all files for Turbo C are in the
\TURBOC
directory.
To execute the demonstration program, enter Turbo C and perform the following steps:
1.
Type
(for Project)
p
(for Project Name)
195demo
.
2.
Press
to set up the project to run.
3.
Then type
to compile and run the demonstration program.
The above process assumes that you have Turbo C, and that the files have been copied into the
appropriate directory for use with your C compiler. Note that the program uses a small data model
because it uses less than 64K of code and data.
Initialization of the System
Any program using Driver488/DRV must first establish communications with the Driver488/DRV
software driver. In C, this is accomplished using the
OPEN
statement. Communication both to and
from Driver488/DRV is required. Thus, the file must be opened for both reading and writing (
RDWR
).
Also, in Microsoft C and Turbo C, the file must be opened in
BINARY
mode so that end-of-line
characters are not translated.
In Microsoft C and Turbo C, the file is opened with the following statement:
ieee=open(“ieee”,O_RDWR | O_BINARY);
In Aztec C, the file is opened with the following statement:
ieee=open(“ieee”,O_rdwr);
which is part of the
IEEEINIT
function contained in
IEEEIO.C
.
IEEEIO.C
supplies several other
useful routines and definitions. These are described in more detail in “Interrupt Handling,” an
upcoming topic in this Sub-Chapter.
In the above statement, the value returned by
OPEN
and placed into the integer variable
IEEE
, is either
the handle of the opened file or
-1
if some error has occurred. The
IEEEINIT
routine checks for this
error indication and returns a
-1
if there has been such an error.
Of course, the file descriptor variable name
IEEE
may be changed as desired, but throughout this
manual and the program files,
IEEE
has been used. Once the file is opened, we can send commands
and receive responses from Driver488/DRV.
Normally, when DOS communicates with a file, it checks for special characters, such as control-Z
which can indicate end-of-file. When communicating with IEEE 488 devices, DOS’s checking would
interfere with the communication. The
RAWMODE
function prevents DOS from checkings for special
characters:
rawmode(ieee);
As an additional benefit, communication with Driver488/DRV is much more efficient when DOS does
not check for special characters.