3-36 Agilent 4155C/4156C VXIplug&play Driver User’s Guide, Edition 4
Programming Examples for Visual Basic Users
Pulsed Sweep Measurements
Dim d_ib As Double ’secondary sweep step value (delta) ’45
If nop2 = 1 Then
d_ib = 0
Else
d_ib = (ib2 - ib1) / (nop2 - 1)
End If
Dim ibo As Double ’secondary sweep source output
ibo = ib1 ’53
Dim msg As String
i = 0 ’array counter for sweepIv returned data
For j = 1 To nop2
dib(j - 1) = ibo
ret = hp4156b_force(vi, m(1), hp4156b_IF_MODE, 0, ibo, vbcomp, 0) ’59
ret = hp4156b_setPiv(vi, m(0), hp4156b_SWP_VF_SGLLIN, 0, base, vc1, vc2, nop1,
hold, width, period, iccomp)
ret = hp4156b_sweepPiv(vi, m(0), hp4156b_IM_MODE, 0, rep, sc(i), md(i), st(i))
check_err vi, ret
ibo = ibo + d_ib
If rep = nop1 Then ’64
i = i + nop1
Else
msg = rep & " measurement steps were returned. It must be " & nop1 & " steps."
MsgBox msg, vbOKOnly, ""
ret = hp4156b_zeroOutput(vi, hp4156b_CH_ALL)
GoTo Bottom_sub
End If
Next j ’72
ret = hp4156b_zeroOutput(vi, hp4156b_CH_ALL) ’74
save_data nop1, nop2, md(), st(), sc(), dib(), vi, ret, m()
Bottom_sub:
End Sub ’77
Line Description
45 to 53 Declares variables, and defines the value. They are used for the secondary sweep
source, d_ib is the step value and ibo is the output value.
59 to 62 Applies current to device, sets the pulsed sweep voltage source, and performs the
pulsed sweep measurement. After that, calls the check_err subprogram (shown in
Table 3-1) to check if an error status is returned for the previous line.
64 to 71 Disables the channels and stops the program execution if the number of returned
data is not equal to the nop1 value.
74 Sets the specified port to the zero output state.
75 Calls the save_data subprogram (next page) to save measurement data.
77 End of the sweep_meas subprogram.