Agilent 4155C/4156C VXIplug&play Driver User’s Guide, Edition 4 3-51
Programming Examples for Visual Basic Users
Sampling Measurements
Sub save_data(vi As Long, ret As Long, nop As Long, index() As Long, bias As
Double, value() As Double, status() As Long, m() As Long)
’1
Dim i
As Integer
’3
Dim data1 As Double
Dim data2 As Double
Dim r1
As Double
Dim r2
As Double
Dim val
As String
val = "Index, I1 (mA), R1 (ohm), I2 (mA), R2 (ohm), Status"
For i = 0 To nop - 1
data1 = Round(value(2 * i) * 1000, 3)
data2 = Round(value(2 * i + 1) * 1000, 3)
r1 = Round(bias / value(2 * i), 2)
r2 = Round(bias / value(2 * i + 1), 2)
val = val & Chr(13) & Chr(10) & index(i) & "," & data1 & "," & r1
val = val & "," & data2 & "," & r2 & "," & status(i)
Next i
Dim fname As String ’data file name
’20
Dim fnum As Integer ’file number
fname = "C:\Agilent\data\data7.txt"
fnum = 1
Open fname For Output Access Write Lock Read Write As fnum
Print #fnum, val
Close fnum
Dim title As String
’28
Dim rbx
As Integer
title = "Sampling 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
sampling_meas vi, ret, m()
End If
End Sub
’38
Line
Description
1
Beginning of the save_data subprogram.
3 to 18
Declares variables, and creates data to be saved and displayed on a message box.
20 to 26
Saves measurement data into a file (C:\Agilent\data\data7.txt, CSV file).
28 to 36
Displays measurement data on a message box. If Yes is clicked on the message box,
performs the sampling_meas subprogram again. If No is clicked, returns to the
perform_meas subprogram.
38
End of the save_data subprogram.
Содержание 4155C
Страница 3: ......
Страница 13: ...1 Installation...
Страница 18: ...1 6 Agilent 4155C 4156C VXIplug play Driver User s Guide Edition 4 Installation Installing VXIplug play Driver...
Страница 19: ...2 Driver Function Reference...
Страница 89: ...3 Programming Examples for Visual Basic Users...
Страница 147: ...4 Programming Examples for Visual Basic NET Users...
Страница 183: ...5 Programming Examples for C Users...
Страница 225: ...6 Programming Examples for VEE Users...
Страница 271: ...7 Sample Application Programs Using VEE...