Wednesday, March 23, 2011

Creating Arbitrary Waveform Sequences on the 33521A and 33522A

This blog post explains and demonstrates how to create an arbitrary waveform sequence with Agilent's 33522A or 33521A function arbitrary waveform generators. Waveform sequencing is the ability to seamlessly transition (no discontinuities in the output) from one waveform in memory to another waveform somewhere else in memory. Waveform sequencing allows you to create complex easily reconfigurable waveforms by pasting together other simpler waveforms in memory. It is analogous to creating a custom playlist on your MP3 player. Some example sequencing applications include generating serial protocols, simulating the output of environmental sensors over a wide range of conditions, or simulating a biomedical signal such as an ECG signal over a wide range of conditions.
Currently there are two ways to create a arb waveform sequence: using SCPI commands or editing an existing sequence file (.seq file). I will cover both methods in this post. The example sequence we will create consists of three built-in arb waveforms so if you own a 33521A or a 33522A you have these waveforms on your instrument. The three waveforms used are: Negative Ramp, Lorentz, and Sinc. Lets start with the SCPI example. In the following SCPI example, all text preceded by "//" are comments explaining the command and are not part of the command (commands in blue). You can send these commands to the 3352xA either by putting them in your software code, using Agilent Connection Expert interactive IO feature, or using the interactive IO feature on the 3352xA's web interface.
The first four commands reset the 3352xA to a known condition and load an instance each waveform used in the sequence from  non-volatile memory to volatile waveform memory:

*RST //reset the 33522A or 33521A to known state
MMEM:LOAD:DATA "INT:\BUILTIN\NEG_RAMP.arb" //load negative ramp
The following command creates our three waveform sequence. The "DATA:SEQ" part tells the 3352xA that this is a sequence command. The numbers "#3152" tell the 3352xA how long, in ASCII characters, the body of the sequence command is. In our example the "3" tells how long the character count number is ("1", "5", and "2" are three digits). The 152 tells the 3352xA that there are 152 characters in the body of the sequence command. "TESTseq" is the name of the sequence.

DATA:SEQ #3152TESTseq,"INT:\BUILTIN\NEG_RAMP.arb",0,once,lowAtStart,10,"INT:\BUILTIN\LORENTZ.arb",3,repeat,highAtStart,10,"INT:\BUILTIN\SINC.arb",0,once,lowAtStart,10

Lets look at the Lorentz waveform definition in the sequence: "INT:\BUILTIN\LORENTZ.arb",3,repeat,highAtStart,10,
The part in quotes gives the location and name of the waveform being used in the sequence. The "3" tells the 3352xA to play this waveform for 3 cycles. The "repeat" option tells the 33522A that we want to play this waveform more than one time. Notice the other two waveform definitions use the option "once" to play just a single cycle of the waveform. The "highAtStart" option tells the sync output to go high at the start of this waveform. The "10" tells the 3352xA at what point in the waveform to change the sync output (must be at least 4). Refer to the 3352xA Programming Reference guide for a complete list of the settings for defining a sequence. Okay now lets continue on with the rest of the commands we need to output our new sequence:

FUNC ARB  //put the 3352xA into arb waveform mode
FUNC:ARB TEXTseq  //load our sequence into channel 1
SOUR1:FUNC:ARB:SRAT 130e6  //sample rate to 130 MS/s
VOLT 1 VPP  //set the amplitude
OUTP1 ON  //turn on the channel 1 output

Now your 3352xA should be outputting the TESTseq we just created. We still have one more step to go. The sequence is only in volatile memory so if you shut off or reset the 3352xA the sequence will be erased. The following command stores the sequence in internal non-volatile memory. 


Below is a scope screen shot of the sequence we just created. The waveform in green is the sync output of the 3352xA. Notice the Lorentz waveform is played three times and the sync output goes high at the start (point 10) of the Lorentz waveform.

A second way to create a sequence is to modify an existing sequence (.seq file) to create a new one. Whenever you create a new sequence via SCPI commands and store it in non-volatile memory it is stored as a .seq file. To modify it to create a new sequence copy the .seq file from the 3352xA to a USB memory stick.  Transfer it to a computer and open it with a text file editor like Windows Notepad. The .seq file that we just created is below:

File Format:1.10
Sample Rate:130000000.000000
High Level:0.500000
Low Level:-0.500000
Header:Arb Name, Repeat Count, Play Control, Marker Mode, Marker Point

Ignore the first line "File Format: 1.10." The next four lines are the amplitude, sample rate, and filter setting for the sequence. This can all be modified if you wanted to change the settings of the sequence. The next line is the header for the waveforms and settings in the sequence. Notice the waveforms and settings are defined the same way they were in the SCPI example. You can modify the waveform names, settings, or add another waveform to create a whole new sequence. You could also copy and paste the sequence text above into a .txt file, modify it, and save it as a .seq file to create a new sequence without any SCPI commands. Whatever you name the .seq file will be the name of the sequence. From there just copy it from the USB memory stick to the 3352xA internal memory and you have a new sequence.

No comments:

Post a Comment