General Program Steps And Examples - National Instruments NI-488.2M Software Reference Manual

For os/2
Hide thumbs Also See for NI-488.2M:
Table of Contents

Advertisement

Chapter 3

General Program Steps and Examples

The following steps demonstrate how to use the NI-488.2 routines in your
program. This example configures a digital multimeter, reads 10 voltage
measurements, and computes the average of these measurements.
Step 1. Initialization
Use the SendIFC routine to initialize the bus and the GPIB interface board so
that the GPIB board is CIC. The only argument of SendIFC is the GPIB
interface board number.
SendIFC(0);
if (ibsta & ERR) {
gpiberr("SendIFC error");
}
Step 2. Find All Listeners
Create an array of all the instruments attached to the GPIB. Use the FindLstn
routine. The first argument is the interface board number, the second argument
is the list of instruments that was created, the third argument is a list of
instrument addresses that the procedure actually found, and the last argument is
the maximum number of devices that the procedure may find (that is, it must
stop if it reaches the limit). The end of the list of addresses must be marked with
the NOADDR constant, which is defined in the header file that you included at the
beginning of the program.
for (loop = 0; loop <=30; loop++){
instruments[loop] = loop;
}
instruments[31] = NOADDR;
printf("Finding all Listeners on the bus...\n");
Findlstn(0, instruments, result, 30);
if (ibsta & ERR) {
gpiberr("FindLstn error");
}
© National Instruments Corp.
Developing Your Application
3-15
NI-488.2M SRM for OS/2

Advertisement

Table of Contents
loading

Table of Contents