HP 9000 Series 300 Tutorials Manual page 92

Device i/o and user interfacing hp-ux concepts and tutorials
Hide thumbs Also See for HP 9000 Series 300:
Table of Contents

Advertisement

The following code segment illustrates the use of hpib_status_wai t:
#include <dvio.h>
#include <fcntl.h>
#include <errno.h>
extern int service_routine();
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);
/*Set a 10-second timeout*/
if (hpib_status_wait(eid, WAIT_FOR_SRQ)
==
0)
service_routine();
/*SRQ is asserted; service the request*/
else
printf("Either a timeout or an error occurred\n");
Another solution is to periodically check the value of the SRQ line by calling
hpi b_bus_status as follows:
hpib_bus_status(eid, SRQ_STATUS);
where, as before, eid is the entity identifier for the open interface file and
SRQ_STATUS indicates that you want the logical value of the SRQ line
returned. hpib_bus_status returns 1 if SRQ is asserted, 0 if not, and -1 if an
error occurred.
The most practical way to monitor SRQ is to set up an interrupt handler for
that condition (see "Interrupts" section of Chapter 2).
3-32
Controlling the HP-IB Interface

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Hp 9000 series 800

Table of Contents