7-6
IM 701730-17E
7.4
Sets/Queries the T/Div
Sample1(GPIB) Set/Get TDIV
----------------------------------------------------------------------------------------
Private Function GpibTdiv() As Long
Dim sts As Long
sts = InitGpib 'Initialize GPIB
If (sts <> 0) Then
GpibTdiv = 1
Exit Function
End If
sts = GetTdiv 'T/DIV Function
If (sts <> 0) Then
GpibTdiv = 1
GoTo GpibTdivEnd
End If
GpibTdiv = 0
GpibTdivEnd:
Call CloseDevice 'Device Close
End Function
----------------------------------------------------------------------------------------
Sample4(USB) Set/Get TDIV
----------------------------------------------------------------------------------------
Private Function UsbTdiv() As Long
Dim sts As Integer
sts = InitUsb 'Initialize USB
If (sts <> 0) Then
UsbTdiv = 1
Exit Function
End If
sts = GetTdiv 'T/DIV Function
If (sts <> 0) Then
UsbTdiv = 1
GoTo UsbTdivEnd
End If
UsbTdiv = 0
UsbTdivEnd:
Call CloseDevice 'Device Close
End Function
----------------------------------------------------------------------------------------
Private Function GetTdiv() As Long
Dim msg As String 'Command buffer
Dim qry As String 'Query biffer
Dim sts As Long
Dim rlen As Long
msg = Space$(100)
qry = Space$(100)
msg = "TIMEBASE:TDIV 2ms" 'Set T/div = 2ms
sts = TmSend(Dev, msg) 'Send Command
If (sts <> CTL_OK) Then
Call DisplayError(Dev)
GetTdiv = 1
Exit Function
End If
msg = "TIMEBASE:TDIV?" 'Get T/div value
sts = TmSend(Dev, msg) 'Send Command
If (sts <> CTL_OK) Then
Call DisplayError(Dev)
GetTdiv = 1
Exit Function
End If
sts = TmReceive(Dev, qry, Len(qry), rlen) 'Receive Query
If (sts <> CTL_OK) Then
Call DisplayError(Dev)
GetTdiv = 1
Exit Function
End If
Query(0) = Left(qry, rlen - 1)
GetTdiv = 0
End Function
----------------------------------------------------------------------------------------
7.4 Sets/Queries the T/Div