248
SDA-OM-E Rev H
Writing VBScripts
VBScripting is one of the custom features of your instrument. Others include the ability to work
with programs such as Excel, Mathcad and MATLAB.
Types of Scripts in VBS
The instrument's VBS provides two types of script.
1. The Waveform Function script
allows you to take the data from one or two traces and make a
new trace whose values may depend on the values of the input trace.
2. The Parameter Function script also takes in the data from one or two traces, but it only has
one output. This output is the zero
th
element in the output array. It appears as a parameter
value on the instrument's screen. The remainder of the array is currently not used, and is not
accessible.
Excel can be called from either script type.
Loading and Saving VBScripts
From the editing panel you can save your script and you can load a previous one. Should you
forget to save a script, please note that when you save your setup, it has your current scripts
embedded in it. Therefore it is a good idea to save your setup frequently. It is worth saving the
script separately as well, because it is saved in a suitable format for printing or off-line editing with
Notepad. Note that in both these examples the input data are referred to as InResult.DataArray.
You can also write InResult1.DataArray and InResult2.DataArray, which refer to the two input
traces. InResult.DataArray always refers to input trace 1. These remarks hold for any script that
you write.
Example Waveform Function Script: Square of a waveform
' Example script to produce a waveform
This example calculates the square of
the input waveform.
OutResult.Samples = InResult.Samples ' Visible trace 1
' Note that a trace of nominal length 1000 comprises data numbered from
' 0 to 1001. The 1001st point is not visible, so you
' normally use points 0 to 1000,
' giving 1001 points and 1000 intervals between points.
startData = 0
endData = OutResult.Samples
LastPoint = endData - 1 ' because the last point is invisible.
ReDim newArray(OutResult.Samples) ' to store the results
unscaledData = InResult.DataArray(False)
' InResult.DataArray(False) provides
' integer data from -32768 to 32767.
' InResult.DataArray(True) provides real data
' in the same physical unit as the vertical scale of the input trace.
ScaleFactor = 1.0 / 32768 ' to make the trace fill the screen.
For i = 0 To LastPoint
Summary of Contents for SDA
Page 1: ...SERIAL DATA ANALYZER OPERATOR S MANUAL December 2007 ...
Page 223: ...SDA Operator s Manual Example 6 SDA OM E Rev H 223 ...
Page 225: ...SDA Operator s Manual SDA OM E Rev H 225 ...
Page 246: ...246 SDA OM E Rev H ...
Page 247: ...SDA Operator s Manual Excel Example 5 Using a Surface Plot SDA OM E Rev H 247 ...
Page 279: ...SDA Operator s Manual Convolving two signals SDA OM E Rev H 279 ...
Page 310: ...The jitter wizard is accessed from the Analysis drop down menu 310 SDA OM E Rev H ...
Page 327: ...SDA Operator s Manual SDA OM E Rev H 327 ...
Page 328: ...328 SDA OM E Rev H ...
Page 394: ...394 SDA OM E Rev H ...