Items to include, With multiple gpib devices -11, Items to include -11 – National Instruments NI-488.2 User Manual
Page 48: Applications that use

Chapter 4
Developing Your NI-488.2 Application
© National Instruments Corporation
4-11
Device Communication
Step 3. Communicate with the Device
Communicate with the device by sending it the
"*IDN?"
query and then
reading back the response. Many devices respond to this query by returning
a description of the device. Refer to the documentation that came with your
GPIB device to see specific instructions on the proper way to communicate
with it.
Step 3a.
Use
ibwrt
to send the
"*IDN?"
query command to the device.
Step 3b.
Use
ibrd
to read the response from the device.
Continue communicating with the GPIB device until you are finished.
Cleanup
Step 4. Place the Device Offline before Exiting Your Application
Use
ibonl
to put the device handle offline before you exit the application.
Applications That Use Multiple Interfaces or Communicate with
Multiple GPIB Devices
This section describes items you should include in your application and
provides general program steps with an NI-488.2 example.
Items to Include
Include the following items in your application:
•
Header files—In a C application, include the header file
ni4882.h
,
which contains prototypes for the NI-488.2 calls and constants that you
can use in your application.
•
Error checking—Check for errors after each NI-488.2 call.
•
Error handling—Declare and define a function to handle NI-488.2
errors. This function takes the device offline and closes the application.
If the function is declared as:
void gpiberr (char * msg); /*function prototype*/