beautypg.com

Hints and tips for vbscripting – Teledyne LeCroy WaveRunner XI SERIES Operator’s Manual User Manual

Page 201

background image

O

PERATOR

S

M

ANUAL

WRXi-OM-E Rev C

201

Int

Cint (A) calculates the integer value next below A, which can be any acceptable VBS number.
Int (-7.4) = -8.

Log

Log (A) calculates the natural log
zero. A negative number or zero will crea

arithm (to base e), of any acceptable VBS number greater than

te an error.

10

/ Log(10)

To calculate Log (A), use Log (A) = Log(A)

10

Mod

odulus of A, which is the remainder after A has been divided by B.

d 55 = 0. -34 Mod 13 = -8. 21 Mod -8 = 5.

A Mod (B) calculates the m

34 Mod 8 = 2. 34 Mo

Rand

ize

ed for the pseudo-random number generator.

r this purpose.

om

Calculates a new se

Randomize Timer uses the real-time clock fo

Sin

Sin (A) calculates the sine of any integer or real number, giving an output that is never greater
than +1 or less than -1.

Sqr

Sqr (A) calculates the square root of any integer or a real number that is not negative. If A is
negative, an error will occur.

Timer

Time since the previous midnight in whole seconds.

Hints and Tips

Set the trigger to Single or

Before sta

g a script, re

hat you do not need. This is because errors in an existing

scrip

e yo

ges, even if your current script is perfect. And an existing good script may develop

a fault if you chan

rtical scale or the memory length and get an

overflo

When

g a script, ma

r parameter. You can get some

very fr

ng p

mode. You can cut and paste the VBS statements if you discover

this er

If your calculation

, development might be quicker if you test the principles on a shorter

trace a

Note that the pse

eset at the start of a script. If you want a different set of

pseud

oms

m, to be run once, before any pseudo-randoms

are gene

d. You can u

rator at any time during execution.

Do not put the final statem

gressive result as some parameter

chang

outp

til the script has been completely run and

quitted, so only th

times, you will think that the oscilloscope has

hung u

If you

For

If you make a scr

he default setup before quitting or powering down, or

you will have a lo

Alw

ec

things up.

Keep everything

that does not have to be inside, to speed things up.

Make

cripts

commenting, but by structuring neatly as well.

Somet

it mig

r script in Excel VBA (remembering that VBA is not identical to VBS),

so tha

can d

If you do this, note that you can read from a cell or write to it using

sta

th

A = Worksheets(

w, Column).Value

Work

"She

for VBScripting

Stopped if you need to do a lot of editing: it is faster.

rtin

t will giv

move any existing scripts t

u error messa

ge the setup. For example, you might change the ve

rd against it in the script.

w if you did not gua

startin

ke sure that you have chosen the right kind: function o

ustrati

roblems if you are in the wrong

ror.

requires a long memory

t first.

udo-random number generator is r

o-rand

rate

every time, put Randomize Timer in the progra

se this instruction to re-seed the gene

ent in a loop, hoping that you can see a pro

es. No

ut will be seen on the screen of the instrument un
e final result will appear. If the loop runs many

p.

want a

loop, end it with "Next" and not "Next X".

ipt that takes a long time to run, go back to t
ng wait next time you power up.

ays use a r

ursive calculation when this will speed

outside a loop

your s

clear, not only by indenting and

imes

t you

ht be easier to develop you

isplay intermediate results.

tements like ese:

"Sheet1").Cells(Ro

sheets(

et1").Cells(Row, Column).Value = B