3-42 Agilent 4155C/4156C VXIplug&play Driver User’s Guide, Edition 4
Programming Examples for Visual Basic Users
Multi-Channel Pulsed Sweep Measurements
Measurement
Result Example
Vb (V), Ib (mA), Ic (mA), Status_b, Status_c
0.3,0,-0.005,0,0
0.35,0,-0.005,0,0
0.4,0,-0.005,0,0
0.45,0,-0.005,0,0
0.5,0,0,0,0
0.55,0.0001,0.015,0,0
0.6,0.0005,0.085,0,0
0.65,0.00305,0.605,0,0
0.7,0.01915,3.89,0,0
0.75,0.09975,19.625,0,0
0.8,0.34745,59.38,0,0
Data save completed.
Do you want to perform measurement again?
Sub save_data(nop As Long, m() As Long, sc() As Double, md1() As Double, md2() As Double,
vi As Long, ret As Long) ’1
Dim i As Integer ’array counter for primary sweep ’2
Dim val As String ’data to be saved to a file
val = "Ve (V), Ic (mA), Ib (mA)"
For i = 1 To nop
val = val & Chr(13) & Chr(10) & sc(i) & "," & md1(i) * 1000 & "," & md2(i) * 1000
Next i
Dim fname As String ’data file name ’8
Dim fnum As Integer ’file number
fname = "
C:\Agilent\data\data5.txt"
fnum = 1
Open fname For Output Access Write Lock Read Write As fnum
Print #fnum, val
Close fnum
Dim title As String ’15
Dim rbx As Integer
title = "Pulsed Sweep Measurement Result"
val = val & Chr(10) & Chr(10) & "Data save completed."
val = val & Chr(10) & Chr(10) & "Do you want to perform measurement again?"
rbx = MsgBox(val, vbYesNo, title)
If rbx = vbYes Then
sweep_meas vi, ret, m()
End If
End Sub ’24
Line Description
1 Beginning of the save_data subprogram.
2 to 7 Declares variables, and creates data to be saved and displayed on a message box.
8 to 14 Saves measurement data into a file (C:\Agilent\data\data5.txt, CSV file).
15 to 23 Displays measurement data on a message box. If Yes is clicked on the message box,
performs the sweep_meas subprogram again. If No is clicked, returns to the
perform_meas subprogram.
24 End of the save_data subprogram.