3- 60 Keysight E5260/E5270 Programming Guide, Edition 4
Programming Examples
Using Trigger Function
unit1.WriteString("WS 2" & vbLf) ā55
unit1.WriteString("XE" & vbLf)
unit2.WriteString("OS" & vbLf)
āunit1.WriteString("TM 3" & vbLf) ā59
āunit1.WriteString("*OPC?" & vbLf) : ret = unit1.ReadString(1 + 2)
āunit2.WriteString("OS" & vbLf)
āunit1.WriteString("PA" & vbLf) ā62
āunit2.WriteString("OS" & vbLf)
āunit1.WriteString("XE" & vbLf)
unit1.WriteString("*OPC?" & vbLf) : ret = unit1.ReadString(1 + 2) ā66
unit1.WriteString("ERR? 1" & vbLf) : err = unit1.ReadString(4 + 2)
If err <> 0 Then
unit1.WriteString("DZ" & vbLf) : unit2.WriteString("DZ" & vbLf)
GoTo Check_err
End If
Dim mret As String = unit1.ReadString(17) ā73
Dim status As String = Left(mret, 3)
Dim meas As Double = Val(Mid(mret, 4, 12))
data(j, i) = Chr(13) & Chr(10) & meas * 1000 & ", " & status
unit1.WriteString("DZ" & vbLf) : unit2.WriteString("DZ" & vbLf) ā79
save_data(fname, title, value, data, nop1, nop2, unit1, unit2, t)
Exit Sub
Line Description
55 to 57 Unit1 waits for a trigger sent to the Ext Trig In terminal, and starts measurement by receiving
a trigger sent by Unit2.
59 to 61 The lines can be replaced with 55 to 57.
Delete ā at the top of the lines 59 to 61, and delete lines 55 to 57, then run the program.
Unit1 will start measurement when a trigger is received via the Ext Trig In terminal.
62 to 64 The lines can be replaced with 55 to 57.
Delete ā at the top of the lines 59 to 64, and delete lines 55 to 57, and 61, then run the program.
Unit1 will start measurement when a trigger is received via the Ext Trig In terminal.
66 to 71 Waits for the operation complete and checks if an error occurred. If an error is detected, forces
0 V and goes to Check_err.
73 to 77 Reads measurement data and stores it into the data array.
79 to 81 Applies 0 V from all channels and transfers the data stored in the data variable to the
save_data subprogram. And the subprogram will save the data into a CSV file specified by the
fname variable and displays the data on a message box.