National Instruments NI-488.2 Benutzerhandbuch

Seite von 134
Chapter 8
NI-488.2 Programming Techniques
© National Instruments Corporation
8-17
Example 2: Using AllSpoll
This 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] );
}
}
}
return;
}
Parallel Polling
Although parallel polling is not widely used, it is a useful method 
for obtaining the status of more than one device at the same time. 
The advantage of parallel polling is that a single parallel poll can easily 
check up to eight individual devices at once. In comparison, eight separate 
serial polls would be required to check eight devices for their serial poll 
response bytes. The value of the individual status bit (
ist
) determines the 
parallel poll response.
Implementing a Parallel Poll
You can implement parallel polling with either the traditional or 
multi-device NI-488.2 calls. If you use multi-device NI-488.2 calls to 
execute parallel polls, you do not need extensive knowledge of the parallel 
polling messages. However, you should use the traditional NI-488.2 calls 
for parallel polling when the GPIB interface is not the Controller, and the 
interface must configure itself for a parallel poll and set its own individual 
status bit (
ist
).