SDA Operator’s Manual
SDA-OM-E Rev H
263
Hints and Tips for VBScripting
Set the trigger to Single or Stopped if you need to do a lot of editing: it is faster.
Before starting a script, remove any existing scripts that you do not need. This is because errors
in an existing script will give you error messages, even if your current script is perfect. And an
existing good script may develop a fault if you change the setup. For example, you might change
the vertical scale or the memory length and get an overflow if you did not guard against it in the
script.
When starting a script, make sure that you have chosen the right kind: function or parameter. You
can get some very frustrating problems if you are in the wrong mode. You can cut and paste the
VBS statements if you discover this error.
If your calculation requires a long memory, development might be quicker if you test the principles
on a shorter trace at first.
Note that the pseudo-random number generator is reset at the start of a script. If you want a
different set of pseudo-randoms every time, put Randomize Timer in the program, to be run once,
before any pseudo-randoms are generated. You can use this instruction to re-seed the generator
at any time during execution.
Do not put the final statement in a loop, hoping that you can see a progressive result as some
parameter changes. No output will be seen on the screen of the instrument until the script has
been completely run and quitted, so only the final result will appear. If the loop runs many times,
you will think that the scope has hung up.
If you want a For loop, end it with "Next" and not "Next X."
If you make a script that takes a long time to run, go back to the default setup before quitting or
powering down, or you will have a long wait next time you power up.
Always use a recursive calculation when this will speed things up.
Keep everything outside a loop that does not have to be inside, to speed things up.
Make your scripts clear, not only by indenting and commenting, but by structuring neatly as well.
Sometimes it might be easier to develop your script in Excel VBA (remembering that VBA is not
identical to VBS), so that you can display intermediate results. If you do this, note that you can
read from a cell or write to it using statements like these:
A = Worksheets("Sheet1").Cells(Row, Column).Value
Worksheets("Sheet1").Cells(Row, Column).Value = B
Note that in VBS, after you have corrected an error and clicked on "Apply," the error message
may go on flashing for a few seconds, or a few acquisitions, before being erased. Look for the
"Script OK" message. Be patient before assuming that you still have a bug.
If your calculation requires data to be used at some other horizontal positions than their original
ones, make sure that your algorithm does not try to send data to non-existent array positions, that
is, beyond the edges of the screen. You may have to truncate your output trace, as happens with
the instrument's Enhanced Resolution and Boxcar functions.
No output will emerge from a script until you press Apply.
No output will emerge from a script until it has received an input. This includes the case where
the input data are not used in calculating the output data. So you must have had at least one
acquisition before you see anything.
Because you can introduce undeclared variables at any point in a calculation, VBS does not
check your spelling.
You can make a portion of a trace disappear if you set the values to 32767 or -32768.
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 ...