4-32 Agilent 4155C/4156C VXIplug&play Driver User’s Guide, Edition 4
Programming Examples for Visual Basic .NET Users
Sampling Measurements
Ag415x.SetSample(hold, interval, nop1)
’37
Ag415x.AddSampleSyncIv(t(0), Hp4156b.ModeEnum.VoltageOutput, 0, base, bias,
icomp)
Ag415x.AddSampleSyncIv(t(1), Hp4156b.ModeEnum.VoltageOutput, 0, base, bias,
icomp)
Ag415x.ErrorQuery(err, msg)
If err <> 0 Then Ag415x.ZeroOutput(0) : GoTo Check_err
Ag415x.Force(t(2), Hp4156b.ModeEnum.VoltageOutput, 0, vlout, ilcomp, 0)
’43
Ag415x.Sample(mch, mode, range, point, index, value, status)
Ag415x.ClearSampleSync()
If point <> nop1 Then Ag415x.ZeroOutput(0) : GoTo Check_err
For i = 0 To nop1 - 1
’48
Dim r1 As Double = Math.Round(bias / value(2 * i), 3)
Dim r2 As Double = Math.Round(bias / value(2 * i + 1), 3)
data(j, i) = Chr(13) & Chr(10) & index(i) & "," & value(2 * i) * 1000
data(j, i) = data(j, i) & "," & r1 & "," & value(2 * i + 1) * 1000
data(j, i) = data(j, i) & "," & r2 & "," & status(i)
Next i
Ag415x.ZeroOutput(0)
’56
save_data(fname, title, val, data, nop1, nop2, Ag415x)
Check_err:
’59
If err <> 0 Then MsgBox("Instrument error: " & err & Chr(10) & msg, vbOKOnly, "")
If point <> nop1 Then MsgBox("No. of data: " & point & " (not " & nop1 & ")",
vbOKOnly, "")
End Sub
Line
Description
37 to 41
Sets the timing parameters, sets the dc voltage sources for sampling measurement, and
checks if an error occurred. If an error is detected, forces 0 V and goes to Check_err.
43 to 46
Applies voltage to device and performs sampling measurement. After the measurement,
clears the setup of the dc voltage sources for the sampling measurement. And then, checks
if an error occurred. If an error is detected, forces 0 V and goes to Check_err.
48 to 54
Stores the measured data into the
data
valiable.
56 to 57
Applies 0 V from the all channels. And transfers the data stored in the
data
variable to the
save_data subprogram (see Table 4-1). And the subprogram will save the data into the
C:\Agilent\data\data11.txt file (CSV) and displays the data on a message box.
59 to 61
Displays a message box to show an error message if the error is detected.
Summary of Contents for 4155C
Page 3: ......
Page 13: ...1 Installation...
Page 19: ...2 Driver Function Reference...
Page 89: ...3 Programming Examples for Visual Basic Users...
Page 147: ...4 Programming Examples for Visual Basic NET Users...
Page 183: ...5 Programming Examples for C Users...
Page 225: ...6 Programming Examples for VEE Users...