Preventing code execution in the first iteration, End of activity 11-4 – National Instruments BridgeVIEW User Manual

Page 249

Advertising
background image

Chapter 11

Loops and Charts

BridgeVIEW User Manual

11-10

© National Instruments Corporation

Wait Until Next ms Multiple function (Functions»Time & Dialog)—
Multiply the knob terminal by 1,000 to convert the knob value in
seconds to milliseconds. Use this value as the input to the Wait Until
Next ms Multiple function.

Multiply function (Functions»Numeric)—The multiply function
multiplies the knob value by 1000 to convert seconds to milliseconds.

Numeric constant (Functions»Numeric)—The numeric constant
holds the constant by which you must multiply the knob value to get a
quantity in milliseconds. Thus, if the knob has a value of 1.0, the loop
executes once every 1000 milliseconds (once per second).

3.

Run the VI. Rotate the knob to get different values for the loop delay.
Notice the effects of the loop delay on the update of the

Random

Signal

display.

4.

Save the VI as

Random Signal with Delay.vi

in the

BridgeVIEW\Activity

directory. Close the VI.

End of Activity 11-4.

Preventing Code Execution in the First Iteration

The While Loop always executes at least once, because G performs the
loop test for continuation after the diagram executes. You can construct
a While Loop that pretests its conditional terminal by including a Case
structure inside the loop. Wire a Boolean input to the Case structure
selector terminal so the subdiagram for the FALSE condition executes if
the code in the While Loop should not execute. See Chapter 12,

Case and

Sequence Structures and the Formula Node

for more information about

using Case structures.

Advertising