HP 9000 Series 300 Tutorials Manual page 128

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 determines whether the interface is currently
addressed as a bus talker:
#include <dvio.h>
#include <fcntl.h>
#include <errno.h>
main()
{
}
int eid;
i f
«eid
=
open ("/dev/raw_hpib" . O_RDWR»
==
-1) {
printf("open failed. errno
=
%d\n". errno);
exit(2);
}
if (hpib_bus_status(eid. TALKER_STATUS)
==
1)
{
printf("the interface is addressed as a talker\n") ;
write(eid. "data message". 12);
/*do the expected data transfer*/
}
else
printf("the interface is not addressed as a talker\n") ;
In the above call to hpi b_bus_status, eid is the entity identifier for the
interface device file and TALKER_STATUS indicates that you want to know if
it is addressed to talk. The routine returns the value 1 if the answer is yes; 0 if
not.
To determine whether the interface is currently addressed as a bus listener use
the following:
if (hpib_bus_status(eid. LISTENER_STATUS)
==
1)
{
printf("the interface is addressed as a listener\n");
read(eid. buffer. 12);
/*do the data transfer*/
}
else
printf("the interface is not addressed as a listener\n");
3-68
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