FB_BA_Iterator

FB_BA_Iterator 1:

The function block implements an iteration mechanism for external data sources. It allows for index-based iteration over a defined range of values with an adjustable step size, either forward or backward.

Syntax

FUNCTION_BLOCK FB_BA_Iterator
VAR_OUTPUT
  bIsActive : BOOL;
  nIndex    : DINT;
END_VAR

FB_BA_Iterator 2: Outputs

Name

Type

Description

bIsActive

BOOL

Iteration status: TRUE if iteration is active, FALSE if stopped.

nIndex

DINT

Current index value during the iteration.

FB_BA_Iterator 3: Methods

Name

Definition location

Description

Iterate

Local

Starts an inactive iteration or resumes an active iteration.

Stop

Local

Ends the current iteration and resets the index to the min. value.

FB_BA_Iterator 4: Properties

Name

Type

Access

Definition location

Description

IsMaxLimit

BOOL

Get

Local

Indicates whether the current index has reached the upper limit.

IsMinLimit

BOOL

Get

Local

Indicates whether the current index has reached the lower limit.

Size

DINT

Get

Local

Size of the iteration range (nMaxBound - nMinBound + 1).

Valid

BOOL

Get

Local

Indicates whether the iterator has been initialized correctly (nMin < nMax).