National Instruments NI-488.2 ユーザーズマニュアル

ページ / 134
Chapter 4
Developing Your NI-488.2 Application
© National Instruments Corporation
4-11
Device Communication
Step 4. Communicate with the Devices
Communicate with the devices by sending them the 
"*IDN?"
 query and 
then reading back the responses. Many devices respond to this query by 
returning a description of the device. Refer to the documentation that came 
with your GPIB devices to see specific instruction on the proper way to 
communicate with them.
Step 4a.
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.
Step 4b.
Use 
Receive
 for each device to read the responses from each device.
Continue communicating with the GPIB devices until you are finished.
Cleanup
Step 5. Place the Interface Offline before Exiting Your Application
Use 
ibonl
 to put the interface offline before you exit the application.
Language-Specific Programming Instructions for 
Windows
The following sections describe how to develop, compile, and link your 
Windows NI-488.2 applications using various programming languages.
Microsoft Visual C/C++ (Version 2.0 or Later)
Before you compile your Win32 C application, make sure that 
the following lines are included at the beginning of your program:
#include <windows.h>
#include "ni488.h"
To compile and link a Win32 console application named 
cprog
 
in a DOS shell, type the following on the command line:
cl cprog.c gpib-32.obj