To request service, invoke hpib_rqst_srvce as follows:
#include <fcntl.h>
#include <errno.h>
mainO
{
}
int eid;
if «eid
=
open("/dev/raw_hpib",
O_RDWR»
==
-1) {
printf("open failed, errno
=
%d\n", errno);
exit(2) ;
}
io_reset(eid);
io_timeout_ctl(eid, 10000000);
hpib_rqst_srvce(eid,64);
/*Bit 6 of serial poll response is set*/
/*and SRQ is asserted
*/
Note that by setting
response
to 64, the only information that the Active
Controller receives when it serially polls your computer is that you are
asserting the SRQ line. Therefore, other data bits in
response
must be set or
cleared to indicate the type of service you are requesting, and the program
controlling the current Active Controller must be capable of interpreting the
data correctly before transfer of control between computers connected to the
same bus can be handled in an orderly manner.
hpib_rqst_srvce returns 0 if it executes correctly or -1 if an error occurred.
Once you have asserted SRQ, the line remains asserted until the Active
Controller serially polls you or you call hpib_rqst_srvce again and clear bit
6 using a sequence such as hpib_rqst_srvceCeid, 0) . Once the serial poll
response is configured, your computer's HP-IB interface responds automatically
to any serial polls from the Active Controller.
A couple of notes of caution are in order here:
If another device on the bus is also asserting SRQ when your service request
is detected by the current Active Controller, SRQ remains asserted, even
after your service request is processed by the Active Controller. Thus, if you
receive control of the bus before the requesting device is serviced, you must
handle that device's service request correctly in order to maintain correct bus
operation.
Controlling the HP-IB Interface
3-59