8-50
IM 704420-01E
8.9.6 Querying the Measurement Statistics
Sample3 Get Statistics
—————————————————————————————————————————————————————— Private Function GetStatistics() As Integer
Dim msg As String 'Command buffer
Dim qry As String 'Query buffer
Dim sts As Integer
msg = Space$(100)
qry = Space$(100)
sts = InitGpib 'Initialize GPIB
If (sts <> 0) Then
GetStatistics = 1
Exit Function
End If
msg =
"
COMMUNICATE:WAIT 1
"
+ term 'Wait until data available
sts = ilwrt(Dev, msg, Len(msg))
If (sts < 0) Then
Call DisplayGPIBError(sts, msg)
GetStatistics = 1
Exit Function
End If
msg =
"
:CALCULATION:AVERAGE?
"
+ term 'Get Average value
sts = ilwrt(Dev, msg, Len(msg))
If (sts < 0) Then
Call DisplayGPIBError(sts, msg)
GetStatistics = 1
Exit Function
End If
sts = ilrd(Dev, qry, Len(qry))
If (sts < 0) Then
Call DisplayGPIBError(sts, msg)
GetStatistics = 1
Exit Function
End If
Query(0) =
"
Average:
"
+ Left$(qry, ibcntl - 1)
msg =
"
:CALCULATION:SDEVIATION?
"
+ term 'Get Standard Deviation value
sts = ilwrt(Dev, msg, Len(msg))
If (sts < 0) Then
Call DisplayGPIBError(sts, msg)
GetStatistics = 1
Exit Function
End If
sts = ilrd(Dev, qry, Len(qry))
If (sts < 0) Then
Call DisplayGPIBError(sts, msg)
GetStatistics = 1
Exit Function
End If
Query(1) =
"
Sigma:
"
+ Left$(qry, ibcntl - 1)
8.9 Sample Program