3- 20 Keysight E5260/E5270 Programming Guide, Edition 4
Programming Examples
Staircase Sweep Measurements
session.WriteString("MM 2," & t(0) & vbLf) ’2: staircase sweep measurement
session.WriteString("CMM " & t(0) & ",1" & vbLf) ’1: current measurement
session.WriteString("RI " & t(0) & ",0" & vbLf) ’0: auto ranging
session.WriteString("WT " & hold & "," & delay & "," & s_delay & vbLf) ’41
session.WriteString("WM 2,1" & vbLf) ’stops any abnormal
session.WriteString("ERR? 1" & vbLf) : err = session.ReadString(4 + 2)
If err <> 0 Then session.WriteString("DZ" & vbLf) : GoTo Check_err
For j = 0 To nop2 - 1 ’46
session.WriteString("WV " & t(0) & ",1,0," & vd1 & "," & vd2 & "," & nop1 &
"," & idcomp & "," & p_comp & vbLf)
session.WriteString("DV " & t(1) & ",0" & "," & vg & "," & igcomp & vbLf)
session.WriteString("TSR" & vbLf)
session.WriteString("XE" & vbLf)
session.WriteString("*OPC?" & vbLf) : rep = session.ReadString(1 + 2)
session.WriteString("ERR? 1" & vbLf) : err = session.ReadString(4 + 2)
If err <> 0 Then session.WriteString("DZ" & vbLf) : GoTo Check_err
session.WriteString("NUB?" & vbLf) : rep = session.ReadString(3 + 2) ’54
If rep <> nop1 * 3 Then session.WriteString("DZ" & vbLf) : GoTo Check_nop
mret = session.ReadString(16 * 3 * nop1 + 1)
For i = 0 To nop1 - 1
tm(i) = Val(Mid(mret, 4 + 16 * 3 * i, 12))
st(i) = Mid(mret, 17 + 16 * 3 * i, 3)
md(i) = Val(Mid(mret, 20 + 16 * 3 * i, 12))
sc(i) = Val(Mid(mret, 36 + 16 * 3 * i, 12))
data(j, i) = Chr(13) & Chr(10) & vg & ", " & sc(i) & ", " & md(i) * 1000 &
", " & tm(i) & ", " & st(i) ’63
Next i
vg = vg + d_vg
Next j
session.WriteString("DZ" & vbLf) ’67
save_data(fname, title, value, data, nop1, nop2, session, t)
Exit Sub
Line Description
38 to 40 Sets the measurement mode, channel measurement mode, and measurement range.
41 to 44 Sets the timing parameters and sweep mode of the staircase sweep source. And checks
if an error occurred. If an error is detected, forces 0 V and goes to Check_err.
46 to 66 Sets the sweep source, applies voltage to device, resets time stamp, and performs the
staircase sweep measurement. And stores the returned data into the mret string
variable. Finally, stores the measured data into the data array.
54 to 55 Checks number of returned data. If it is not correct, forces 0 V and goes to Check_nop.
63 Stores the measured data into the data array.
67 to 69 Applies 0 V from all channels. And transfers the data stored in the data variable to the
save_data subprogram (see
Table 3-1). And the subprogram will save the data into a
CSV file specified by the fname variable and displays the data on a message box.