Chapter 6
GPIB Programming Techniques
© National Instruments Corp.
6-9
NI-488.2M UM for Windows NT
Example 1: Using FindRQS
This example illustrates the use of
FindRQS
to find the first device that is requesting
service.
void GetASerialPollResponse
(
char *DevicePad, char
*DeviceResponse
)
{
char SerialPollResponse = 0;
int WaitResult;
Addr4882_t Addrlist[4] = {3,4,5,NOADDR};
WaitSRQ (0, &WaitResult);
if (WaitResult) {
printf (“SRQ is asserted.\n”);
FindRQS ( 0, AddrList, &SerialPollResponse );
if (!(ibsta & ERR)) {
printf (“Device at pad %x returned byte %x.\n”,
AddrList[ibcnt],(int) SerialPollResponse);
*DevicePad = AddrList[ibcnt];
*DeviceResponse = SerialPollResponse;
}
}
return;
}
Example 2: Using AllSpoll
This example illustrates the use of
AllSpoll
to serial poll three devices with a single
call.
void GetAllSerialPollResponses ( Addr4882_t AddrList[], short
ResponseList[] )
{
int WaitResult;
WaitSRQ (0, &WaitResult);
if ( WaitResult ) {
printf ( "SRQ is asserted.\n" );
AllSpoll ( 0, AddrList, ResponseList );
if (!(ibsta & ERR)) {
for ( i = 0; AddrList[i] != NOADDR; i++ ) {
printf ("Device at pad %x returned byte %x.\n",
AddrList[i], ResponseList[i] );
}
}
}
return;
}