Keysight E5260/E5270 Programming Guide, Edition 4 3- 61
Programming Examples
Using Trigger Function
Measurement
Result Example
Id (mA), Status
22.475, NAI
Data save completed.
Do you want to perform measurement again?
Check_err: ’83
unit1.WriteString("EMG? " & err & vbLf) : msg = unit1.ReadString(256)
MsgBox("Instrument error: " & err & Chr(10) & msg, vbOKOnly, "")
Exit Sub
End Sub ’88
Sub save_data(ByVal fname As String, ByVal title As String, ByVal value As String,
ByVal data(,) As String, ByVal nop1 As Integer, ByVal nop2 As Integer, ByVal unit1
As IMessage, ByVal unit2 As IMessage, ByVal t() As Integer)
’90
Dim i As Integer = 0
Dim j As Integer = 0
FileOpen(1, fname, OpenMode.Output, OpenAccess.Write, OpenShare.LockReadWrite)
Print(1, value)
For j = 0 To nop2 - 1
’Print(1, Chr(13) & Chr(10) & "Unit" & j + 1) ’96
For i = 0 To nop1 - 1
Print(1, data(j, i))
Next i
Next j
FileClose(1)
Dim rbx As Integer
For j = 0 To nop2 - 1
’value = value & Chr(10) & "Unit" & j + 1 ’105
For i = 0 To nop1 - 1
value = value & data(j, i)
Next i
Next j
value = value & Chr(10) & Chr(10) & "Data save completed."
value = value & Chr(10) & Chr(10) & "Do you want to perform measurement again?"
rbx = MsgBox(value, vbYesNo, title)
If rbx = vbYes Then perform_meas(unit1, unit2, t)
End Sub ’114
End Module
Line Description
83 to 86 Displays a message box to show an error message if the error is detected.
90 to 114 Save_data subprogram saves measurement result data into a file specified by the fname
variable and displays the data and a message on a message box. If Yes is clicked on the
message box, calls the perform_meas subprogram again. If No is clicked, returns to the
perform_meas subprogram.