Creating, Capturing and Transferring Waveforms for AWGs Using SBench 6
The Arbitrary Waveform Generator (AWG) is a powerful and flexible signal generator capable of outputting any wave shape within the bandwidth of the generator. Once you have the AWG you will need to populate it with waveforms. The cost of creating, capturing, modifying, and transferring test waveforms can easily match the cost of the generator. This application note is intended to make the process easier by providing examples of creating, capturing, modifying, and transferring waveforms to your AWG. We will cover function generator mode, waveform creation using equations, transferring acquired waveforms from digitizers, oscilloscopes, and third party math software like MATLAB. It also covers the editing and processing of these waveforms. Our hardware focus will be on the Spectrum Instrumentation models M2p.65xx and M4i.66xx PCIe AWG's, an example of which is shown in Figure 1.
These modular AWG products offer 16 models with 1 to 4 channels and sampling rates from 20 MS/s to 1.25 GS/s with bandwidths from 10 MHz to 400 MHz at 8, 14, or 16 bit resolution. All the AWG products use a common set of drivers and support software.
Using Your AWG's Function Generator Mode
Every AWG provides the ability to use it as a simple function generator. This allows creation and output of sine, rectangular (square), triangle, saw tooth, and DC waveforms directly without any complex operations. Spectrum Instruments offer the Easy Generator function within its SBench 6 Instrumental software package. SBench 6 is a powerful and intuitive interactive measurement software for acquiring, processing, and creating signals. It is designed to work with all Spectrum's digitizers, AWG's, and LAN based digitizerNETBOX systems.
Easy Generator is a component of Spectrum's SBench 6 software as shown in Figure 2.
Easy Generator facilitates the selection of any of six function generator waveforms including sine, rectangular, triangle, saw tooth, SINC, and DC waveforms. The frequency, phase, and amplitude of each waveform is user adjustable, as is the duty cycle for the rectangular, triangle and saw tooth waveforms.
Individual waveforms setups can be selected for each available output channel and a simple press of the Start button transfers all enabled waveforms to the AWG outputs.
Easy Generator provides a simple means of outputting standard function generator waveforms to the AWG.
Creating Waveform Using Equations in SBench 6
The most accurate way to create waveforms is to base them on mathematical equations. They are precise and repeatable and offer a great range of test signals. SBench 6 includes a function generator editor which supports the generation of waveforms using text based equations as shown in Figure 3.
The function generator editor accepts the equation in text format and allows for the selection of the sampling rate, amplitude, and duration of the waveform. Figure 4 shows an example of creating the sine sweep waveform using the operators and functions shown above.
Spectrum offers an application note which shows 24 examples of waveform creation using equations. Please see the separate product note for this topic: Creating AWG Waveforms with SBench 6 using Equations
Importing Waveforms
Waveforms can be created locally in Spectrum's SBench 6 software, as we have seen. Waveforms can also be created or acquired from other sources including instruments like digitizers and digital oscilloscopes and software tools like spreadsheets, math programs, and system integration software. Waveforms from these sources can be imported into SBench 6 and sent to the AWG using one of the following import formats.
Import SBench 6
This function will load a previously stored SBench 6 data file including all the signals contained.
Import SBench 5
This function will import a SBench 5 format data file. The data format is used by the previous version of SBench.
Import ASCII
This function will import an ASCII file that contains column based signal data. The function will try to determine the data format and then converts the data into a valid signal.
Import Wave
This function will import a standard wave audio file identified by the file extension .wav, a worldwide standard. One or multiple signals are derived from the wave file and displayed within SBench 6. Data information that is not included in the wave file is set to a standard value.
Import Binary
This function imports a pure binary file containing only signal data with no header information. The function will look for an additional header as written by SBench 6 and will use the information stored here. If no header file is found in the basic information SBench 6 will prompt for the required information.
The following table shows the most common import formats for a variety of signal sources:
Waveform Source | File Format for transfer |
---|---|
Spectrum Digitizer | .sb6dat, ASCII, Binary |
Spectrum AWG | .sb6dat, ASCII, Binary |
Spectrum digitizerNETBOX | .sb6dat, ASCII, Binary |
Digitizer (Non-Spectrum) | ASCII |
Digital Oscilloscope | ASCII |
Spreadsheet (Excel) | ASCII |
Math Program (MATLAB) | ASCII, Binary |
System Integration Software (LabVIEW) | ASCII, Binary |
Audio Recording | Wave |
Importing Waveforms from a Spectrum Digitizer
Importing waveforms from a Spectrum digitizer is easy using SBench 6. There will be one instance of SBench 6 for each Spectrum device (digitizer and AWG). Capture the desired waveform using the digitizer making sure that the signal amplitude, bandwidth, and sample rate are within the range of the AWG. Once the waveform is captured use the File pull down menu to Export the acquired waveform in SBench 6 format (.sb6dat). Note the path and file name under which the exported waveform file was saved.
Open the AWG instance of SBench 6. Figure 5 shows the steps to import the waveform into the AWG.
From the file pull down select Import/Load. Select the SBench6 format. Navigate using the "Select file to import"
To the desired file (previously exported from the digitizer instance of SBench 6) then press Open. The waveforms stored in the selected file will appear in the Input Channels pane in the upper left corner of SBench 6 under the import heading. Right click on the desired waveform and select Add to Display to see the waveform.
Find the Output Channels Pane in the lower left corner of the AWG instance of SBench6. Note the desired output channel. Click and drag the desired input channel to the desired output channel. The assigned data field of the output channel should now indicate the name of the imported waveform.
Right click on the output channel and select the Settings selection. The Setup Channel pop up will show the configuration of the output channel including the new assigned data file. Check the Output Enable box to output the waveform from the selected AWG channel as shown in Figure 6.
It should be noted that the desired waveform can be assigned to the selected output channel using the Setup Channel pop up as well. Note also that the output channel amplitude range and related configuration items can be controlled from this pop up.
Transferring a Waveform to the AWG after Signal Processing
Consider the situation shown in Figure 7 where five ultrasonic waveforms were acquired using the digitizers multiple acquisition mode. This collection of waveforms was imported into the AWG's instance of SBewnch6. The desired waveform to simulate this action is the average of the five waveforms. This calculation can be made in SBench 6 by right clicking on the imported waveform and selecting Calculation from the resulting pop up. The next pop-up offers a choice of calculations, select Signal Averaging. Then select Average Multi from the next pop up. The Average Multi setup allows the number of segments to be averaged to be entered. In the example all segments are set to be averaged. Clicking Start initiates the calculation with the result appearing in the Input Channel Pane as trace MAV_Ch-1. Add this waveform to the display to inspect it and make sure it is the desired simulation waveform. If it is the correct waveform click and drag MAV_Ch-1 to the desired output channel. Now the averaged ultrasonic waveform will be the AWG output. This can be done with any time domain waveform resulting from a calculation.
Importing a Waveform from a Digital Oscilloscope or Digitizer
Digital oscilloscopes can acquire and save waveforms in a number of file formats. Generally, there is a proprietary binary format used for internal storage. There are also text based formats including ASCII, MATLAB (.dat) and spreadsheet (.csv) formats. These text based formats are the easiest to bring over into an AWG using the import feature of SBench 6.
SBench 6 can deal with ASCII imports of single column amplitude (Y) data or dual columns containing amplitude (Y) and time(X) data. It scans the file and automatically attempts to determine the data format including the length of the file, clock rate, and amplitude range.
The signal should be acquired using settings such as amplitude range, sample rate, and memory length that are compatible with the AWG. Save the waveform either as single column amplitude data or in the dual column time and amplitude format. Note the format and file name that the waveform file is stored under.
Import the waveform file into SBench 6 using the file pull down import/load selection as shown in Figure 8.
Select ASCII import, a pop up will prompt for the selection of the import source file name After the source file name is selected the Basic File Setup dialog will appear. Enter the details of the ASCII file format you are using and the relevant device settings. The overlay in Figure 8 shows the oscilloscope screen along with part of the ASCII file to which it was saved. The DSO file header provides the file length and sample period, SBench 6 should have already captured that information. The data is organized as two columns the first with the time information and the second with the amplitude information using scientific number format. The delimiter is comma and the newline control is using carriage return and line feed. The final setup is the number of lines to skip in order to prevent the header from being included. In this case the header contains ten items. Once this data is entered or verified in the Basic file setup dialog press the OK button to import the waveform.
Once the waveform has been imported either drag the source waveform from the import field in the channels pane to the desired output channel as was done in the previous import example for a Spectrum digitizer.
Importing Waveforms from Third Party Software
Waveforms can also be generated in third party math, spreadsheet, and system integration programs such as MATLAB, Excel, or LabVIEW. The general procedure is identical in that the waveform data is stored as an ASCII file and imported into SBench 6. Figure 9 provides an example using MATLAB. The sampling rate and amplitude range of the waveform should be in the range of the AGW being used. A one Volt SINC2 function, common in optical measurements, is computed using a sample rate of 100 MS/s and saved as an ASCII file. The ASCII import function is again evoked using the File pull down, the source waveform is selected and the basic setup is used to select the appropriate ASCII setup. On accepting the ASCII setup the waveform will be imported and appear in the Input Channel pane in the upper left corner of SBench 6. At this point it can be dragged to the desired output channel or analog display. The waveform, in SBench 6, can also be processed using the Calculation tools and then transferred into an output channel.
MATLAB and LabVIEW have formidable tools for formatting files. With some programming skill users can output data in binary format. They can also load their waveforms directly into the AWG using the appropriate Spectrum drivers to communicate with it. These drivers and related manuals are available on the Spectrum website at: download drivers
Importing .wav Formatted Waveform Files
Waveform audio or .wav files are used to encode sound, music, and related waveforms. SBench 6 can also import these files as shown in Figure 10.
The import function is again reached using the File pull down. SBench 6 will prompt for a file name and an amplitude range. As in the other waveform import processes clicking and dragging on the imported waveform allows it to be dragged to the desired output port or one of the analog displays.
Conclusion
SBench6 is a very powerful waveform creation tool that supports Spectrum's full line of arbitrary waveform generators. Its range of operation varies from simple function generator operation, sophisticated waveform creation, advance signal processing, to rapid imports of multiple waveform formats. It serves as a bridge between the AWG and other waveform sources by loading waveforms directly into the AWG without the need for any programming.