Application Examples
Chapter 2
NI-488.2M UM for Windows NT
2-4
© National Instruments Corp.
Example 2: Clearing and Triggering Devices
This example illustrates how you can clear and trigger GPIB devices.
Two freshman physics lab partners are learning how to use a GPIB digital oscilloscope.
They have successfully loaded the NI-488.2M software on a personal computer and
connected their GPIB board to a GPIB digital oscilloscope. Their current lab assignment
is to write a small application to practice using the oscilloscope and its command set
using high-level GPIB commands. The following steps correspond to the program
flowchart in Figure 2-2.
1.
The application initializes the GPIB by bringing the interface board in the computer
online.
2.
The application sends a GPIB clear command to the oscilloscope. This command
clears the internal registers of the oscilloscope, reinitializing it to default values and
settings.
3.
The application sends a command to the oscilloscope telling it to read a waveform
each time it is triggered. Predefining the task in this way decreases the execution
time required. Each trigger of the oscilloscope is now sufficient to get a new run.
4.
The application sends a GPIB trigger command to the oscilloscope which causes it to
acquire data.
5.
The application queries the oscilloscope for the acquired data. The oscilloscope
sends the data.
6.
The application reads the data from the oscilloscope.
7.
The application calls an external graphics routine to display the acquired waveform.
Steps 4, 5, 6, and 7 are repeated until all of the desired data has been acquired by the
oscilloscope and received by the computer.
8.
As a cleanup step before exiting, the applicati on returns the interface board to its
original state by taking it offline.