16-62
IM 765501-01E
16.4.7 Sample 5 (Example of Carrying Out the Storage Function and Reading the
Statistical Values)
Attribute VB_Name = “Sample5”
‘================================================================
‘
‘  Sample 5 (Example of Carrying Out the Storage Function and Reading the
‘  Statistical Values)
‘
‘  CALL SampleSequence5().
‘
‘===============================================================
‘————————————————————————————————
‘
‘  Wait for the storage operation to complete
‘
‘  Wait for the result of :TRACe:STATus? to become 0
‘
‘————————————————————————————————
Function WaitStoreComplete(dev As Integer)
    While (Val(CommQuery(dev, “:TRAC:STAT?”)))
        Sleep (10)
    Wend
End Function
‘—————————————————————————————————
‘
‘ Sample Sequence 5
‘
‘  Store 100 points and read the statistical result
‘
‘  This sample does not set the source and measurement.  Set them appropriately in
‘  advance.
‘
‘—————————————————————————————————
Function SampleSequence5()
    Dim dev As Integer
    Dim r_min As Double
    Dim r_max As Double
    Dim r_ave As Double
    Dim r_sdv As Double
    dev = CommOpen() ‘ Open the device
    Call CommSend(dev, “:TRAC:POIN 100”) ‘ Store count  100
    Call CommSend(dev, “:TRAC:STAT ON”) ‘ Start the storage operation
    Call WaitStoreComplete(dev) ‘ Wait for the storage operation
  to complete
    r_min = Val(CommQuery(dev, “:TRAC:CALC:MIN?”))‘ Read the minimum value
    r_max = Val(CommQuery(dev, “:TRAC:CALC:MAX?”))‘ Read the maximum value
    r_ave = Val(CommQuery(dev, “:TRAC:CALC:AVER?”))‘ Read the average value
    r_sdv = Val(CommQuery(dev, “:TRAC:CALC:SDEV?”))‘ Read the standard deviation
    Call CommClose(dev) ‘ Close the device
End Function
16.4 Sample Programs