User`s manual
Dim Actual As Long
’ Use the "SetCommands" array to setup the AFG
SetCommands(1) = "SOUR:LIST1:SSEQ:DEL:ALL" ’ Clear sequence memory
SetCommands(2) = "SOUR:LIST1:SEGM:DEL:ALL" ’ Clear segment memory
SetCommands(3) = "SOUR:ROSC:SOUR INT1;" ’ Select the Ref. Oscillator
SetCommands(3) = SetCommands(3) + ":TRIG:STAR:SOUR INT1;" ’ Select the sample source"
SetCommands(3) = SetCommands(3) + ":SOUR:FREQ1:FIX 100E3;" ’ Set the sample frequency
SetCommands(3) = SetCommands(3) + ":SOUR:FUNC:SHAP USER;" ’ Command to select the user
function
SetCommands(3) = SetCommands(3) + ":SOUR:VOLT:LEV:IMM:AMPL 5.1V" ’ Set the amplitude
SetCommands(4) = "SOUR:LIST1:SEGM:SEL ramp" ’ Define the "ramp" segment name
SetCommands(5) = "SOUR:LIST1:SEGM:DEF 100" ’ Define the segment size
’ Use the "OutCommands" array to generate output
OutCommands(1) = "SOUR:LIST1:SSEQ:SEL ramp_out" ’ Define the sequence name as "ramp_out"
OutCommands(2) = "SOUR:LIST1:SSEQ:DEF 1" ’ Define the sequence size
OutCommands(3) = "SOUR:LIST1:SSEQ:SEQ ramp" ’ Set the segment execution order
OutCommands(4) = "SOUR:FUNC:USER ramp_out" ’ Define the user name
OutCommands(5) = "INIT:IMM" ’ Start waveform generation
’ Use "SegCommand" to store segments
SegCommand = "SOUR:LIST1:SEGM:VOLT " ’ Command to send volts data
’ Setup the AFG
Call CmdExe(SetCommands())
’ Call sub to check for AFG errors
Call CheckError("GenSeg (SetCommands)")
’ Generating and storing segments into string
For I = 0 To 99
If I = 99 Then
SegCommand = SegCommand + Str$(I * .0505)
Else
SegCommand = SegCommand + Str$(I * .0505) + ","
End If
Next I
’ Send command with segment data
Call iwrite(Addr, ByVal SegCommand + Chr$(10), Len(SegCommand) + 1, 1, Actual)
’ Call sub to check for AFG errors
Call CheckError("GenSeg (SegCommand)")
’ Setup the AFG for output
Call CmdExe(OutCommands())
Continued on Next Page
36 Getting Started Chapter 1