Agilent 4155C/4156C VXIplug&play Driver User’s Guide, Edition 4 3-37
Programming Examples for Visual Basic Users
Pulsed Sweep Measurements
Sub save_data(nop1 As Long, nop2 As Long, md() As Double, st() As Long, sc() As
Double, dib() As Double, vi As Long, ret As Long, m() As Long) ’1
Dim i As Integer ’array counter for sweepPiv returned data ’3
Dim j As Integer ’array counter for secondary sweep output data
Dim val As String ’data to be saved to a file
val = "Ib (uA), Vc (V), Ic (mA), Status"
For j = 1 To nop2 ’8
For i = nop1 * (j - 1) To nop1 * j - 1
val = val & Chr(13) & Chr(10) & dib(j - 1) * 1000000# & "," & sc(i) & "," &
md(i) * 1000 & "," & st(i)
Next i
Next j
Dim fname As String ’data file name ’14
Dim fnum As Integer ’file number
fname = "C:\Agilent\data\data4.txt"
fnum = 1
Open fname For Output Access Write Lock Read Write As fnum
Print #fnum, val
Close fnum
Dim title As String ’22
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 ’32
Line Description
1 Beginning of the save_data subprogram.
3 to 6 Declares variables, and defines the value.
8 to 12 Creates data to be saved and displayed on a message box.
14 to 20 Saves measurement data into a file (C:\Agilent\data\data4.txt, CSV file).
22 to 30 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.
32 End of the save_data subprogram.