Example 1 - National Instruments NI-488.2M Software Reference Manual

For os/2
Hide thumbs Also See for NI-488.2M:
Table of Contents

Advertisement

Chapter 6
ReadStatusByte is similar to AllSpoll, except that it only serial polls a
single device. It is also analogous to the device-level NI-488 ibrsp function.
FindRQS serial polls a list of devices until it finds a device that is requesting
service or until it has polled all the devices on the list. The routine returns the
index and status byte value of the device requesting service.
TestSRQ determines whether the SRQ line is asserted or unasserted, and it
returns to the program immediately.
WaitSRQ is similar to TestSRQ, except that WaitSRQ suspends the
application program until either SRQ is asserted or the timeout period is
exceeded.
The following examples use NI-488.2 routines to detect SRQ, then determine
which device requested service. In these examples, three devices are present on
the GPIB at addresses 3, 4, and 5, and the GPIB interface is designated as bus
index 0. The first example uses FindRQS to determine which device is
requesting service, and the second example uses AllSpoll to serial poll all
three devices. Both examples use WaitSRQ to wait for the GPIB SRQ line to
be asserted.
Note:
Automatic serial polling is not used in these examples because you
cannot use it with NI-488.2 routines.

Example 1

This example illustrates the use of FindRQS to determine which device is
requesting service.
void GetASerialPollResponse ( char *DevicePad,
{
char SerialPollResponse = 0;
int WaitResult;
Addr4882_t Addrlist[4] = {3,4,5,NOADDR};
WaitSRQ (0, &WaitResult);
if (WaitResult) {
printf ("SRQ is asserted.\n");
© National Instruments Corp.
GPIB Programming Techniques
char *DeviceResponse )
6-7
NI-488.2M SRM for OS/2

Advertisement

Table of Contents
loading

Table of Contents