|On this page…|
To illustrate how to use some of the Instrument Control Toolbox™ elements in the SystemTest™ software, this section provides a step-by-step example.
In this example a SystemTest element configures a signal generator to produce signals of various frequencies, which are measured by an oscilloscope configured by other SystemTest elements.
The signal generator is a Hewlett-Packard 33120A at GPIB address 5, and the oscilloscope is a Tektronix TDS 210 at GPIB address 4. For this example, the generator output is fed directly to the scope input. The generator will be programmed to generate signals of 1500, 5000, and 7500 Hz, while the oscilloscope will measure each signal's frequency.
The following sections explain the steps in this example.
The first element in the test programs the generator to output signals of various frequencies. To test at three frequencies, the test be comprised of three test cases, i.e., three iterations. This is a one-way communication to the generator, so you use a To Instrument element.
The element appears in the browser as To Instrument.
From the Properties pane's Select an instrument resource list, select New Instrument Resource. The instrument resource is the communication channel between MATLAB and your instrument, in this case the generator at GPIB address 5.
In the New Object Creation dialog box, select GPIB in the Instrument object type list. Select the appropriate Vendor (in this example, ni for National Instruments), Board index (0), and instrument Primary address (in this example, 5).
In the Command text field, enter frequency followed by a space to separate the text from the variable that will follow. This is the command to set the frequency of the 33120A generator, as described in the instrument's reference manual proved by the vendor.
Click Data source and select New Test Vector. The name of the vector you create for setting the generated frequencies is called genfreq. In the Insert Test Vector dialog box, enter that text in the Name field, and set the Expression field to [1500 5000 7500], including the brackets.
Notice that the Main Test node in the tree now says (3 Iterations). Because you entered three values in the test vector, the test is comprised of three iterations, one for each frequency value in the test vector.
The element should now resemble the following figure:
You use a To Instrument element, which provides a one-way communication to the oscilloscope, to program the scope to measure frequency.
There is no test variable or pause required for this element, so the element looks like the following figure:
To see the resources you created for communications with your two instruments, click the Resources tab at the bottom of the SystemTest window. You can see the Generator and Scope resources, along with their GPIB settings.
With the generator and scope set up, you can take the measurement with the scope using a Query Instrument element, which sends the command to the scope for taking the measurement.
The element now looks like the following figure:
To view the results of your test, you must first specify the test variables you want to save as test results. This is done in the Save Results Properties pane.
Now that the test elements are all created, you can run the test.
format short g scopefreq scopefreq = 1501.5 5000 7500
This verifies that the signal generator is producing the expected signal frequencies.