Programming Examples 12
Agilent InfiniiVision 5000 Series Oscilloscopes Programmer's Guide 709
' DIGITIZE command.
Capture
' Analyze - Once the waveform has been captured, it can be analyzed.
' There are many parts of a waveform to analyze. This example shows
' some of the possible ways to analyze various parts of a waveform.
Analyze
' Close the vi session and the resource manager session.
err = viClose(vi)
err = viClose(drm)
End Sub
'
' Initialize
' -------------------------------------------------------------------
' Initialize will start the program with the oscilloscope in a known
' state. This is required because some uninitialized conditions could
' cause the program to fail or not perform as expected.
'
' In this example, we initialize the following:
' - Oscilloscope
' - Channel 1 range
' - Display Grid
' - Timebase reference, range, and delay
' - Trigger mode and type
'
' There are also some additional initialization commands, which are
' not used, but shown for reference.
' -------------------------------------------------------------------
Private Sub Initialize()
' Clear the interface.
err = viClear(vi)
' RESET - This command puts the oscilloscope into a known state.
' This statement is very important for programs to work as expected.
' Most of the following initialization commands are initialized by
' *RST. It is not necessary to reinitialize them unless the default
' setting is not suitable for your application.
' Reset the oscilloscope to the defaults.
err = viVPrintf(vi, "*RST" + vbLf, 0)
' IDN - Ask for the device's *IDN string.
err = viVPrintf(vi, "*IDN?" + vbLf, 0)
err = viVScanf(vi, "%t", strQueryResult) ' Read the results as a
' string.
' Display results.
MsgBox "Result is: " + strQueryResult, vbOKOnly, "*IDN? Result"
' AUTOSCALE - This command evaluates all the input signals and sets
' the correct conditions to display all of the active signals.
err = viVPrintf(vi, ":AUTOSCALE" + vbLf, 0) ' Same as pressing
' the Autoscale key.