
Sample Program
7-19
IM 760151-17E
7
Sample4(GPIB) Get Wave Data (FLOAT)
————————————————————————————————————————————
Private Function GpibWaveFloat() As Integer
Dim msg As String
Dim qry As String
Dim wait As Integer
Dim eos As Integer
Dim w As String
Dim a(8) As String
Dim b(8) As String
Dim buf As String
Dim all As String
Dim allb As String
Dim stre As String
Dim sts As Integer
Dim pntl As Integer
Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim l As Integer
Dim m As Integer
Dim valu As Integer
Dim vale As Integer
Dim bufv(2007) As Integer
Dim valf As Single
Dim flo As Single
term = Chr$(10) ‘terminator
msg = Space$(100)
qry = Space$(200)
sts = InitGpib ‘Initialize GPIB
If (sts <> 0) Then
GpibWaveFloat = 1
Exit Function
End If
‘Initialize the settings
msg = “*RST” + term ‘Initialize the settings
sts = ilwrt(Dev, msg, Len(msg)) ‘Send Command
If (sts < 0) Then
Call DisplayGPIBError(sts, msg)
GpibWaveFloat = 1
Exit Function
End If
‘Set the measurment condition
msg = “VOLTAGE:RANGE:ELEMENT1 100V” + term ‘Voltage range = 100V
sts = ilwrt(Dev, msg, Len(msg)) ‘Send Command
If (sts < 0) Then
Call DisplayGPIBError(sts, msg)
GpibWaveFloat = 1
Exit Function
End If
msg = “WSETUP:TDIV 10MS” + term ‘Time/div = 10ms
sts = ilwrt(Dev, msg, Len(msg)) ‘Send Command
If (sts < 0) Then
Call DisplayGPIBError(sts, msg)
GpibWaveFloat = 1
Exit Function
End If
msg = “WSETUP:SAMPLING ON” + term ‘Wave sampling start
sts = ilwrt(Dev, msg, Len(msg)) ‘Send Command
If (sts < 0) Then
Call DisplayGPIBError(sts, msg)
GpibWaveFloat = 1
Exit Function
End If
‘Set the transition filter used to detect the completion of the data updating
msg = “STATUS:FILTER1 FALL” + term ‘Falling edge of bit0(UPD)
sts = ilwrt(Dev, msg, Len(msg)) ‘Send Command
If (sts < 0) Then
Call DisplayGPIBError(sts, msg)
GpibWaveFloat = 1
Exit Function
End If
‘Wait until waveform measure is stable (2 samples in this program)
For wait = 1 To 2
‘Clear the extended event register (Read and trash the response)
msg = “STATUS:EESR?” + term
sts = ilwrt(Dev, msg, Len(msg)) ‘Send Command
If (sts < 0) Then
Call DisplayGPIBError(sts, msg)
7.7 Output of Waveform Data (FLOAT Format)