Relevant Documents
Download article (474KB)

In this tutorial, we will give an example on how to load an arbitrary waveform file to Tabor AWG using the IVI driver.

If you haven’t been acquainted with controlling Tabor AWGs using MATLAB’s Instrument Control Toolbox, please refer to Tabor’s website for the previous tutorials in the series ““How to Control Tabor AWGs with MATLAB”:

  • ‘Getting started’.
  • ‘Using SCPI commands’.
  • ‘Using the IVI driver’.

In order to control instruments using MATLAB, the instrument control toolbox is required. Please note that the Instrument Control Toolbox is an additional application that needs to be added. For more information you can visit the Mathworks website.

For this tutorial, we will use MATLAB version R2014a 32bit and a USB interface. To ensure you successfully established all the necessary settings for remote control over the Tabor instrument using LAN/USB/GPIB, please go over the connectivity tutorials on the Tabor’s website.

  • Load an arbitrary waveform file using the IVI driver functions

1. First, you will have to create a Device Object using the ‘WX218x_IVI_COM.mdd’ file as shown in the previous tutorial. After doing so, connect to the Tabor instrument as shown below.

20210125160408.946.png

On the Device Object dialog box you will see ‘Functions’, ‘Properties’ and ‘Session Log’.

  • Functions - Allows you to communicate with the device using its driver functions.
  • Properties – Allows you to set parameters and modes regarding the device under control.
  • Session Log – Allows you to save the last session as MATLAB script.

 

2. After you are successfully connected, go to the ‘Functions’ folder. Under ‘Utility group object functions’, execute the ‘Reset’ function as follows. Make sure that each time you execute a function, you don’t get any errors as shown below:

 20210125160607.142.jpg

3. Go to the ‘Properties’ folder, under ‘Arbitrary group object properties’, set the ‘SampleRate’ to 2Gs/s as shown below:

20210125160722.437.jpg

4. Under ‘Arbitrarywaveform group object properties’, set the ‘TraceMode’ to ‘WX218xTraceModeDuplicate’ as shown below:

 20210125161348.359.jpg

5. Go to ‘functions’ folder, under ‘Arbitrarywaveform group object functions’ execute the ‘LoadArbWfmFromFile’ function as shown below. Make sure to type the full path of the waveform file you wish to download. Make sure the waveform file is with *.wav ending. For *.csv ending files, use the corresponding function.

20210125161502.107.jpg

6. Go to ‘Properties’ folder, under ‘Output group object properties’, set ‘OutputMode’ to ‘WX218xOutputModeArbitrary’ as shown below:

20210125161547.389.jpg

7. Go to ‘Functions’ folder, under ‘Output group object functions’ execute the ‘Enabled’ function as shown below. After doing so click on ‘Disconnect’:

20210125161553.059.jpg

8. Using Tabor Arbitrary mode we have control over the output signal frequency as follows:

20210125161709.705.jpg


The ‘sin.wav’ file holds 1024 samples. The SCLK was set to 2Gs/s, so we would expect to get a 1.953MHz sine wave as can be seen on scope. If not programmed differently, Amplitude (500mV) and Offset (0V) are set to default values:

The outputted sine waveform.

20210125161717.198.jpg

9. To save all the steps we just made as MATLAB script, go to ‘Session Log’. Click on ‘Save Session’ and name your ‘*.m’ file.

20210125161726.385.jpg

Here is the full code generated by the ‘Session Log’:

%      LOADWAVEFORMFROMFILEWITH_IVI_DRIVER.m Code for communicating with an instrument.
%
%       This is the machine generated representation of an instrument control
%       session using a device object. The instrument control session comprises
%       all the steps you are likely to take when communicating with your
%       instrument. These steps are:
%
%             1. Create a device object
%             2. Connect to the instrument
%             3. Configure properties
%             4. Invoke functions
%             5. Disconnect from the instrument
%       To run the instrument control session, type the name of the file,
%       LoadWaveformFromFileWith_IVI_driver, at the MATLAB command prompt.
%
%    The file, LOADWAVEFORMFROMFILEWITH_IVI_DRIVER.M must be on your MATLAB PATH. For additional information
%       on setting your MATLAB PATH, type 'help addpath' at the MATLAB command
%       prompt.
%       Example:
%       LoadWaveformFromFileWith_IVI_driver;
%
%       See also ICDEVICE.

%       Create a device object.
deviceObj = icdevice('wx218x_IVI_COM.mdd', 'USB0::0x168C::0x2184::0000215470::INSTR');

%      Connect device object to hardware.
connect(deviceObj);

%       Execute device object function(s).
groupObj = get(deviceObj, 'Utility');
groupObj = groupObj(1);
invoke(groupObj, 'Reset');

%        Configure property value(s).
set(deviceObj.Arbitrary(1), 'SampleRate', 2E9);
set(deviceObj.Arbitrarywaveform(1), 'TraceMode', 'WX218xTraceModeDuplicate');

%        Execute device object function(s).
groupObj = get(deviceObj, 'Arbitrarywaveform');
groupObj = groupObj(1);
[waveHandle1] = invoke(groupObj, 'LoadArbWfmFromFile', 'C:\\Program Files(x86)\IVI Foundation\IVI\Drivers\wx218x\Examples\Matlab\waves\sine.wav');

%       Configure property value(s).
set(deviceObj.Output(1), 'OutputMode', 'WX218xOutputModeArbitrary');

%       Execute device object function(s).
groupObj = get(deviceObj, 'Output');
groupObj = groupObj(1);
invoke(groupObj, 'Enabled', 'channel1',1);

%       Disconnect device object from hardware.
disconnect(deviceObj);

%       Delete object.
delete(deviceObj);

 

This example ‘LoadWaveformFromFileWith_IVI_driver.m’ can also be found after installation of the latest Tabor IVI driver through this path on your computer:
‘C:\Program Files (x86)\IVI Foundation\IVI\Drivers\wx218x\Examples\Matlab’.

 20210125161841.008.jpg

In the next tutorials, we will show 3 more examples:

  • Example #2: Generate A Sequence Of 3 Waveform Files Using The IVI Driver Functions. 
  • Example #3: Synchronize Between Two Tabor AWGs Using The IVI Driver Functions.
  • Example #4: Create an arbitrary waveform from binary data using SCPI commands.

 

For More Information

For more of Tabor’s solutions or to schedule a demo, please contact your local Tabor representative or email your request to [email protected]