Loop


Synopsis

Periodically increment an output value.

Input Ports

Name

Type

Description

ui_parent

UIconnection

user interface parent object

 

Parameter Ports

Name

Type

 

reset: Reset Loop

int: UItoggle

reset to start value

reset_back

int: UItoggle

reset to end value

run: Run Loop

int: UItoggle

start looping

run_back

int: UItoggle

start looping backwards

step

int: UItoggle

increment by incr

step_back

int: UItoggle

decrement by incr

cycle: Cycle Loop

int: UItoggle

cycle repeatedly

start: Start Value

float: UIfieldTypein

initial value

end: End Value

float: UIfieldTypein

max value

incr: Increment

float: UIfieldTypein

amount added each loop

 

Output Ports

Name

Type

Description

count: Loop count

float: UIfieldTypein

current value

done

int

set to 1 when loop reaches end value

 

Description

Loop initializes its count output to its start value, and periodically increments it by incr. When the value reaches or exceeds the end value, the done flag is set unless cycle is nonzero, in which case the loop count is reset to the start value and another loop starts. If the increment is negative, the end test becomes whether the current count is less than or equal to the end value, so loops can go in either direction.

The value is updated whenever all other modules are done executing and the network reaches a quiescent state.

If cycle is 0, the final value is always exactly the end value, even if the increment plus the next-to-last value would have gone past the end value.

The loop can be interrupted at any time by setting run to 0.

Input Ports

ui_parent

A port to connect to a user interface object that contains the macro's widgets. By default, it is connected to the default user interface object in the application in which the macro is instanced. (This default connection is not drawn.)

Parameters

Run Loop

UItoggle. When nonzero, the loop runs, incrementing as usual. When the loop reaches the end, the run parameter is automatically set to zero unless the cycle parameter is nonzero. If run is set to zero while the loop is running, it stops at the current value until run is set to one.

Run Back

UItoggle. When nonzero, the loop runs in reverse, decrementing the count by the Increment value. When the loop reaches the beginning, the run parameter is automatically set to zero unless the cycle parameter is nonzero. If run is set to zero while the loop is running, it stops at the current value until run is set to one.

 

Step

UItoggle. When nonzero, the loop increments the count by one Increment value and then resets Step to 0.

Step Back

UItoggle. When nonzero, the loop decrements the count by one Increment value and then resets Step Back to 0.

Reset Loop

UItoggle. When set to nonzero, the start value is loaded into the current count, but the loop does not stop running. It is automatically reset to 0 after the reset is done.

Cycle Loop

UIoptionmenu. When nonzero, this parameter controls how the the count is reset when it reaches the end. The values for the parmeter are:

0 = Once. The count is stopped when it reaches the end.

1 = Cycle. The count is reset to the start , and the loop continues endlessly as long as run is nonzero.

2 = Bounce. When count reaches the end, the direction of the loop reverses and loop begins to decrement the count. When count reaches the beginning, the loop again reverses and loop begins to increment the count. The loop continues in this way as long as run is nonzero.

Start Value

UIfieldTypein. The starting value for the loop. Reset causes this value to be stored into the loop count, and if cycle is nonzero it is reloaded each time the current value passes the end value.

End Value

UIfieldTypein. The ending value for the loop.

Increment

UIfieldTypein. The increment added to the value each time through the loop.

Output Ports

Loop count

UIfieldTypein. The current value for the loop.

Note that this value does not count the number of loops executed, unless start is 0.0 and incr is 1.0; it accumulates the current value of the loop.

done

Automatically set to 1 when the loop finishes. Never set to 1 if cycle is true.

Example

Not available.

File

v/modules.v