Hints And Tips For Vbscripting - LeCroy WaveMaster 8600A Operator's Manual

X-stream oscilloscopes
Table of Contents

Advertisement

Calculates a new seed for the pseudo-random number generator.
Randomize
Randomize Timer uses the real-time clock for this purpose.
Sin (A) calculates the sine of any integer or real number, giving an output that is
Sin
never greater than +1 or less than -1.
Sqr (A) calculates the square root of any integer or a real number that is not
Sqr
negative. If A is negative, an error will occur.
Time since the previous midnight in whole seconds.
Timer

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
302
WM-OM-E Rev I

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents