Keysight E5260/E5270 Programming Guide, Edition 4
3- 71
Programming Examples
Reading Binary Output Data
Dim range As Double ’43
If mode = 1 Then ’ current range
range = 10 ^ (rng - 20)
If rng = 20 Then
session.WriteString("UNT? 1" & vbLf)
Dim unt As String = session.ReadString(256)
Dim mdl(8) As String : Dim c As String
Dim a As Integer : Dim b As Integer = 0 : Dim d As Integer = 0
For a = 1 To Len(unt)
c = Mid(unt, a, 1)
If c = "," Then mdl(d) = Mid(unt, b + 1, a - b - 1) : d = d + 1
If c = ";" Then b = a
Next
If mdl(chan) = "E5291A" Then range = 0.2 ’for E5260/E5270
End If
Else ’ voltage range
If rng = 8 Then range = 0.5
If rng = 9 Then range = 5
If rng = 11 Then range = 2
If rng = 12 Then range = 20
If rng = 13 Then range = 40
If rng = 14 Then range = 100
If rng = 15 Then range = 200
End If ’66
’value = value & Chr(13) & Chr(10) & "status = " & status ’68
’value = value & Chr(13) & Chr(10) & "type = " & type
’value = value & Chr(13) & Chr(10) & "mode = " & mode
’value = value & Chr(13) & Chr(10) & "channel = " & chan
’value = value & Chr(13) & Chr(10) & "sign = " & sign
’value = value & Chr(13) & Chr(10) & "range = " & range
’value = value & Chr(13) & Chr(10) & "count = " & count & Chr(13) & Chr(10)
Dim meas As Double ’76
If type = 0 Then meas = count * range / 20000 ’source data
If type = 1 Then meas = count * range / 50000 ’measurement data
data(j, i) = Chr(13) & Chr(10) & meas * 1000 & ", " & status ’80
session.WriteString("DZ" & vbLf) ’82
save_data(fname, title, value, data, nop1, nop2, session, t)
Exit Sub
Check_err: ’86
session.WriteString("EMG? " & err & vbLf) : msg = session.ReadString(256)
MsgBox("Instrument error: " & err & Chr(10) & msg, vbOKOnly, "")
Exit Sub
End Sub
Line
Description
43 to 66
Checks the measurement range or output range setting.
68 to 74
If you want to display and save the binary data elements, delete ’ at the top of the lines.
76 to 80
Calculates the measurement data or source output data. And, stores the data into the
data
array.
82 to 84
Applies 0 V from all channels. And transfers the data stored in the
data
variable to the
save_data subprogram (see
). And the subprogram will save the data into a
CSV file specified by the
fname
variable and displays the data on a message box.
86 to 89
Displays a message box to show an error message if the error is detected.
Summary of Contents for E5260 Series
Page 1: ...Keysight Technologies E5260 E5270 Series of Parametric Measurement Solutions Programming Guide...
Page 3: ...User s Guide B2900 9001x xxxx 201x Edition x...
Page 13: ...1 Programming Basics...
Page 63: ...2 Remote Mode Functions...
Page 108: ...2 46 Keysight E5260 E5270 Programming Guide Edition 4 Remote Mode Functions Initial Settings...
Page 109: ...3 Programming Examples...
Page 185: ...4 Command Reference...
Page 335: ...5 Error Messages...
Page 349: ......