
Agilent B1500A/B1505A Programming Guide, Edition 11 3-23
Programming Examples
Staircase Sweep Measurements
Dim ret_val As String : Dim status As String : Dim chan As String ’41
Dim type As String : Dim rdata As Double : Dim tdata As Double
Dim sdata As Double : Dim mdata As Double : Dim mstat As String
Dim disp_data As String : Dim k As Integer = 0
session.TerminationCharacter = 44 ’terminator=comma ’45
session.TerminationCharacterEnabled = True
For j = 0 To nop2 - 1 ’48
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)
For i = 0 To nop1 - 1
For k = 0 To 2 ’54
ret_val = session.ReadString(16)
status = Left(ret_val, 1) ’status
chan = Mid(ret_val, 2, 1) ’channel
type = Mid(ret_val, 3, 1) ’data type
rdata = Val(Mid(ret_val, 4, 12)) ’data
If type = "T" Then tdata = rdata ’time data
If type = "I" Then mdata = rdata : mstat = status ’meas data, status
If type = "V" Then sdata = rdata ’source data
Next k ’63
If mstat <> "N" Then session.WriteString("DZ" & vbLf) : GoTo Check_err
disp_data = "Vg = " & vg & " (V), "
disp_data = disp_data & "Vd = " & sdata & " (V), "
disp_data = disp_data & "Id = " & mdata * 1000 & " (mA), "
disp_data = disp_data & "Time = " & tdata & " (sec), "
disp_data = disp_data & "Status = " & mstat
Console.WriteLine(disp_data)
data(j, i) = Chr(13) & Chr(10) & vg & ", " & sdata & ", " & mdata * 1000
& ", " & tdata & ", " & mstat ’71
Next i
vg = vg + d_vg
Next j
Line Description
41 to 44 Declares the variables used to read and save the measurement data.
45 to 46 Declares that a comma is the data terminator needed to read data, and enables it.
49 to 52 Sets the sweep source, applies voltage to device, resets time stamp, and triggers the
staircase sweep measurement. Same as the lines 47 to 50 of the previous program.
54 to 63 Reads data and picks up the status, channel, data type, and data. And stores the time
data, measurement data, and source data into the variables, tdata, mdata, and sdata.
64 Checks the status of the measurement channel. And applies 0 V and goes to Check_err
if an error is detected.
65 to 71 Displays the data on the console window. And stores the data into the data array.
Kommentare zu diesen Handbüchern