Confirming communications, Ieee 488 event message – Measurement Computing Personal488 rev.3.0 For DOS & Windows 3.Xi User Manual
Page 227

10E. C Languages
II. SOFTWARE GUIDES - 10. Driver488/W31
II-212
Personal488 User’s Manual, Rev. 3.0
Confirming Communications
With or without an open device handle, the application can, if desired, confirm communication with
Driver488/W31 via the
Hello
function:
Hello(ieee, textstr);
strcat(textstr, “\r\n”);
The function also fills in a string, from which information can be extracted if it is desirable to display
facts about the driver in use.
IEEE 488 Event Message
The IEEE 488 Event Message feature of Driver488/W31 allows a C program to respond to IEEE 488
bus events. Driver488/W31 will send the Windows Message
WM_IEEE488EVENT
to the application
when an enable event occurs. A listing of available events is shown in the table:
Event
Description
SRQ
The Service Request bus line is asserted.
Peripheral
An addressed status change has occurred and the interface is a Peripheral.
Controller
An addressed status change has occurred and the interface is an Active Controller.
Trigger
The interface has received a device
Trigger
command.
Clear
The interface has received a device
Clear
command.
Talk
An addressed status change has occurred and the interface is a Talker.
Listen
An addressed status change has occurred and the interface is a Listener.
Idle
An addressed status change has occurred and the interface is neither a Talker nor a
Listener.
ByteIn
The interface has received a data byte.
ByteOut
The interface has been configured to output a data byte.
Error
A Driver488/W31 error has occurred.
Change
The interface has changed its addressed state. The Controller/Peripheral or
Talker/Listener/Idle states of the interface have changed.
Note:
This Event table mirrors the Arm Condition table found under the topic “System Controller,
Not Active Controller Mode” in the Sub-Chapter “Operating Modes” of Chapter 9.
To trap the IEEE 488 Event Message: Simply check for the
WM_IEEE488EVENT
message in the default
switch of the application’s window handler. If the IEEE 488 Event Message is detected, execute code
to handle the event.
The following example uses the capability of the ADC488 to issue an IEEE 488
SRQ
when it needs
servicing. The IEEE 488 Event Message will be issued and trapped on the
SRQ
and the ADC488 will
be serviced.
In every C program using Driver488/W31, header files of declarations must be merged into the
program. In the following example, those declarations have been omitted from the listing for the sake
of brevity.
With the associated source files, the following program can be built using the file
EXAMPLE3.MAK
(for
Microsoft C or Quick C users) or
EXAMPLE3.PRJ
(for Borland C users) found on the Driver488/W31
disk.
This example has several declarations that will be used later:
HWND hDriver
/* handle for Driver488/W31 */
DevHandleT ieee;
/* handle for the IEEE board * /
char textstr[2048], response[64];
/* string for Driver488responses */
char hellomsg[256];
/* string to hold the hello response */
int i, hundred[100];
/* general counter and data buffer */
TermT noterm;
/* structure for disabling terminators */
Starting out like the previous example, this program then differs by adding an
Error
line to turn
ON
the
automatic error reporting: