The following steps show you how to use the multi-device NI-488.2 calls in your application.
Use SendIFC to initialize the bus and the GPIB interface so the GPIB interface is Controller-In-Charge (CIC). The only argument of SendIFC is the GPIB interface number, typically 0 for GPIB0.
Use FindLstn to find all the devices attached to the GPIB. The FindLstn function requires the following parameters:
Use FindLstn to test for the presence of all of the primary addresses in the list. If a device is present at a particular primary address, then the primary address is stored in the GPIB addresses list. Otherwise, all secondary addresses of the given primary address are tested, and the GPIB address of any devices found are stored in the GPIB addresses list. When you have the list of GPIB addresses, you can determine which one corresponds to your instrument and use it for subsequent calls.
Alternatively, if you already know your GPIB device's primary and secondary address, you can create an appropriate GPIB address to use in subsequent NI-488.2 calls, as follows: a GPIB address is a 16-bit value that contains the primary address in the low byte and the secondary address in the high byte. If you are not using secondary addressing, the secondary address is 0. For example, if the primary address is 1, then the 16-bit value is 0x01; otherwise, if the primary address is 1 and the secondary address is 0x67, then the 16-bit value is 0x6701.
Use DevClearList to clear the devices on the GPIB. The first argument is the GPIB interface number. The second argument is the list of GPIB addresses that were found to be listening as determined in step 2.
Communicate with the devices by sending them a "*IDN?" query and then reading back the responses. Many devices respond to this query by returning a description of the device. You must refer to the documentation that came with your GPIB devices to see specific instruction on the proper way to communicate with them.
Use SendList to send the "*IDN?" query command to multiple GPIB devices. The address is the list of GPIB devices to be queried. The buffer that you pass to SendList is the command message to the device.
Use Receive for each device to read the responses from each device.
Continue communicating with the GPIB devices until you are finished.