Sample Program
7-11
IM 701730-17E
7
7.6
Sets/Queries Measure Value
Sample3(GPIB) Get Measure value
----------------------------------------------------------------------------------------
Private Function GpibGetMeasure() As Long
Dim sts As Long
sts = InitGpib 'Initialize GPIB
If (sts <> 0) Then
GpibGetMeasure = 1
Exit Function
End If
sts = GetMeasure 'Get Measure Function
If (sts <> 0) Then
GpibGetMeasure = 1
GoTo GpibGetMeasureEnd
End If
GpibGetMeasure = 0
GpibGetMeasureEnd:
Call CloseDevice 'Device Close
End Function
----------------------------------------------------------------------------------------
Private Function GetMeasure() As Long
Dim msg As String 'Command buffer
Dim qry As String 'Query biffer
Dim sts As Long
Dim stp As Integer
Dim rlen As Long
msg = Space$(100)
qry = Space$(100)
msg = "STOP" 'Acquisition = Stop
sts = TmSend(Dev, msg)
If (sts <> CTL_OK) Then
Call DisplayError(Dev)
GetMeasure = 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)
GetMeasure = 1
Exit Function
End If
msg = "MEASURE:MODE OFF" 'Measure Off
sts = TmSend(Dev, msg)
If (sts <> CTL_OK) Then
Call DisplayError(Dev)
GetMeasure = 1
Exit Function
End If
msg = "CHANNEL:DISPLAY ON" 'CH1 On
sts = TmSend(Dev, msg)
If (sts <> CTL_OK) Then
Call DisplayError(Dev)
GetMeasure = 1
Exit Function
End If
msg = "CHANNEL:PROBE 10" 'CH1 Probe = 10:1
sts = TmSend(Dev, msg)
If (sts <> CTL_OK) Then
Call DisplayError(Dev)
GetMeasure = 1
Exit Function
End If
msg = "CHANNEL:VDIV 500mV" 'CH1 V/div = 500mV
sts = TmSend(Dev, msg)
If (sts <> CTL_OK) Then
Call DisplayError(Dev)
GetMeasure = 1
Exit Function
End If
msg = "ACQUIRE:MODE NORMAL;RLENGTH 1000" 'Acquisition mode = NORMAL, length =
1000
sts = TmSend(Dev, msg)
If (sts <> CTL_OK) Then
Call DisplayError(Dev)
GetMeasure = 1
Exit Function
End If
7.6 Sets/Queries Measure Value