7-8
IM 701730-17E
7.5
Data Output in Word Format (2 bytes)
Sample2(GPIB) Get Word Data
----------------------------------------------------------------------------------------
Private Function GpibGetWord() As Long
Dim sts As Long
sts = InitGpib 'Initialize GPIB
If (sts <> 0) Then
GpibGetWord = 1
Exit Function
End If
sts = GetWord 'Get Word Data Function
If (sts <> 0) Then
GpibGetWord = 1
GoTo GpibGetWordEnd
End If
GpibGetWord = 0
GpibGetWordEnd:
Call CloseDevice 'Device Close
End Function
----------------------------------------------------------------------------------------
Sample5(USB) Get Word Data
----------------------------------------------------------------------------------------
Private Function UsbGetWord() As Integer
Dim sts As Long
sts = InitUsb 'Initialize USB
If (sts <> 0) Then
UsbGetWord = 1
Exit Function
End If
sts = GetWord 'Get Word Data Function
If (sts <> 0) Then
UsbGetWord = 1
GoTo UsbGetWordEnd
End If
UsbGetWord = 0
UsbGetWordEnd:
Call CloseDevice 'Device Close
End Function
----------------------------------------------------------------------------------------
Private Function GetWord() As Long
Dim msg As String 'Command buffer
Dim qry As String 'Query biffer
Dim sts As Long
Dim vdv As Variant 'Vdiv value
Dim ofs As Variant 'Offset value
Dim dlg As Long 'Block Data Length
Dim dat As Variant 'Data
Dim i As Integer
Dim rlen As Long
Dim endflag As Long
msg = Space$(100)
qry = Space$(100)
msg = "STOP" 'Stop Acquisition
sts = TmSend(Dev, msg)
If (sts < CTL_OK) Then
Call DisplayError(Dev)
GetWord = 1
Exit Function
End If
msg = "COMMUNICATE:HEADER OFF" 'Query Header Off(for Get V/div)
sts = TmSend(Dev, msg)
If (sts <> CTL_OK) Then
Call DisplayError(Dev)
GetWord = 1
Exit Function
End If
msg = "WAVEFORM:TRACE 1" 'Trace = 1
sts = TmSend(Dev, msg)
If (sts <> CTL_OK) Then
Call DisplayError(Dev)
GetWord = 1
Exit Function
End If
7.5 Data Output in Word Format (2 bytes)