Chapter 7 NI-488.2 Programming Techniques
NI-488.2 User Manual for Windows 7-16 www.natinst.com
Example 1: Using FindRQSThis example shows you how to use 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 AllSpollThis example shows you how to use 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] );
}
}
}