While…wend – Campbell Scientific CR5000 Measurement and Control Module User Manual

Page 227

Advertising
background image

Section 9. Program Control Instructions

9-21

Parameter
& Data Type

Enter

TimNo
Constant,
Variable, or
Expression

An integer number for the timer (e.g., 0, 1, 2, . . .) Use low numbers to
conserve memory; using TimNo 100 will allocate space for 100 timers even
if it is the only timer in the program.

Units

The units in which to return the timer value.

Constant

Alpha
Code

Numeric
Code

Units

USEC

0

microseconds

MSEC

1

milliseconds

SEC

2

seconds

MIN

3

minutes

TimOpt
Constant

The action on the timer. The timer function returns the value of the timer
after the action is performed
Code

Result

0

start

1

stop

2

reset and start

3

stop and reset

4

read only

Timer Example
The example uses Timer.

While…Wend

The While…Wend instructions are used to executes a series of statements in a
loop as long as a given condition is true.

Syntax
While Condition
[StatementBlock]
Wend

Remarks
While…Wend loops can be nested.

The While...Wend statement has the following parameters:

While

The While statement begins the While...Wend loop control
structure.

Condition

The Condition is any expression that can be evaluated True
(nonzero) or False (0 and Null). If Condition is true, all
statements in StatementBlock are executed until the Wend
statement is encountered. Control then returns to the While
statement and Condition is again checked. If Condition is
still true, the process is repeated. If Condition it is not True,
execution resumes with the statement following the Wend
statement.

Advertising