Confirming communication, Setting up event handling, Reading driver status – Measurement Computing Personal488 rev.3.0 For DOS & Windows 3.Xi User Manual
Page 168

II. SOFTWARE GUIDES - 9. Driver488/SUB
9E. C Languages
Personal488 User’s Manual, Rev. 3.0
II-153
Confirming Communication
With or without an open device handle, the application can, if desired, confirm communication with
Driver488/SUB via the
Hello
function:
Hello (ieee,response) ;
printf (“%s\n”,response) ;
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.
Setting Up Event Handling
If the event notification mechanism of Driver488/SUB is to be used, it should normally be set up
during application initialization and left in place until application shutdown. No special action is
required if event notification is not needed for the particular application. First, the
OnEvent
function
establishes the notification path by specifying the function to be called, as follows:
OnEvent (ieee,isr, (OpaqueP)0) ;
Either during initialization or at some appropriate later point in the application, specific event types
may be
Arm
ed or
Disarm
ed for use in the event system. Individual event types may be turned on and
off at will freely through the life of the application. In this case, we
Arm
to request notification of
IEEE 488 bus service requests:
Arm (ieee,acSRQ) ;
To cease recognizing bus service requests, we might
Disarm
just the one class of events:
Disarm (ieee,acSRQ) ;
Or, to completely disable event notifications:
Disarm (ieee,0) ;
Note that an external device handle is acceptable in this and other functions which actually refer to the
interface; the external device handle will simply be translated to the handle of the interface to which the
device is attached, prior to taking action. This translation is fully automatic within Driver488/SUB and
requires little overhead, so you need not and should not go to great lengths to pass an interface handle,
if your application structure makes the use of external device handles the more logical choice.
Reading Driver Status
Your application may interrogate Driver488/SUB at any time to determining its status and other
information.
Status
information is returned in a structure provided by the application and can be
displayed by the
showstat
function shown below:
Status (ieee,&substat) ;
showstat (&substat) ;
Another function to display the information contained in the
Status
structure could be:
void showstat (IeeeStatusT * substattt) {
printf (“SC
: %d\t”,substat->SC) ;
printf (“CA
: %d\t”,substat->CA) ;
printf (“Primaddr
: %d\t”,substat->Primaddr) ;
printf (“Secaddr
: %d\n”,substat->Secaddr) ;
printf (“SRQ
: %d\t”,substat->SRQ) ;
printf (“addrChange : %d\t”,substat->addrChange) ;
printf (“talker
: %d\t”,substat->talker) ;
printf (“listener
: %d\n”,substat->listener) ;
printf (“triggered
: %d\t”,substat->triggered) ;
printf (“cleared
: %d\t”,substat->cleared) ;
printf (“transfer
: %d\t”,substat->transfer) ;
printf (“byteIn
: %d\n”,substat->byteIn) ;
printf (“byteOut
: %d\n”,substat->byteOut) ;
}