714 Agilent InfiniiVision 5000 Series Oscilloscopes Programmer's Guide
12 Programming Examples
' Read VPP.
err = viVScanf(vi, "%lf" + vbLf, VarPtr(dblQueryResult))
MsgBox "Peak to peak voltage:" + vbCrLf + _
FormatNumber(dblQueryResult, 4)+"V"
' Query for Vmax.
err = viVPrintf(vi, ":MEASURE:VMAX?" + vbLf, 0)
' Read Vmax.
err = viVScanf(vi, "%lf" + vbLf, VarPtr(dblQueryResult))
MsgBox "Maximum voltage:" + vbCrLf + _
FormatNumber(dblQueryResult, 4)+"V"
' WAVEFORM_DATA - To obtain waveform data, you must specify the
' WAVEFORM parameters for the waveform data prior to sending the
' ":WAVEFORM:DATA?" query. Once these parameters have been sent,
' the waveform data and the preamble can be read.
'
' WAVE_SOURCE - Selects the channel to be used as the source for
' the waveform commands.
err = viVPrintf(vi, ":WAVEFORM:SOURCE CHAN1" + vbLf, 0)
' WAVE_POINTS - Specifies the number of points to be transferred
' using the ":WAVEFORM:DATA?" query.
err = viVPrintf(vi, ":WAVEFORM:POINTS 1000" + vbLf, 0)
' WAVE_FORMAT - Sets the data transmission mode for the waveform
' data output. This command controls whether data is formatted in
' a word or byte format when sent from the oscilloscope.
Dim lngVSteps As Long
Dim intBytesPerData As Integer
' Data in range 0 to 65535.
err = viVPrintf(vi, ":WAVEFORM:FORMAT WORD" + vbLf, 0)
lngVSteps = 65536
intBytesPerData = 2
' Data in range 0 to 255.
'err = viVPrintf(vi, ":WAVEFORM:FORMAT BYTE" + vbLf, 0)
'lngVSteps = 256
'intBytesPerData = 1
' GET_PREAMBLE - The preamble block contains all of the current
' WAVEFORM settings. It is returned in the form <preamble_block><NL>
' where <preamble_block> is:
' FORMAT : int16 -0=BYTE, 1 = WORD, 2 = ASCII.
' TYPE : int16 -0=NORMAL, 1 = PEAK DETECT, 2 = AVERAGE.
' POINTS : int32 - number of data points transferred.
' COUNT : int32 - 1 and is always 1.
' XINCREMENT : float64 - time difference between data points.
' XORIGIN : float64 - always the first data point in memory.
' XREFERENCE : int32 - specifies the data point associated with
' x-origin.
' YINCREMENT : float32 - voltage difference between data points.
' YORIGIN : float32 - value is the voltage at center screen.
' YREFERENCE : int32 - specifies the data point where y-origin
' occurs.
Dim intFormat As Integer