ChangeStateUpDown
ChangeStateUpDown (FB)
FUNCTION_BLOCK ChangeStateUpDown
Short description
Switching between freely definable states (UP and DOWN button) Prerequisite: Connection of a suitable array to the input 'arStates' with elements of type 'stChangeStateUpDown' Typical application: Switching operating modes
Representation

Interfaces
Inputs
xStateUp
BOOL
FALSE
Switch to the next higher state (rising edge)
xStateDown
BOOL
FALSE
Switch to the next lower state (rising edge)
xResInit
BOOL
FALSE
Switch to the initialization state (rising edge)
bInitState
BYTE
0
Index of the initialization state
arStates
stChangeStateUpDown
Array with the individual states
Outputs
sStateName
STRING
Name of the current state
iStateNumber’
INT
Number of the current state
Function description
This FB is used to switch between freely definable states (each state is defined by a state text and a state number) via the inputs 'xStateUp' and 'xStateDown'. After the first download, a subsequent download, every online change and at every rising edge on the 'xResInit' input, the initial state is set. The index of the initial state is defined by the input 'bInitState'.
This function block can be applied as follows:
This function block can be applied as follows:

CODESYS
InOut:
Input
xStateUp
BOOL
FALSE
Input
xStateDown
BOOL
FALSE
Input
xStateInit
BOOL
FALSE
Input
bInitState
BYTE
0
Output
sStateName
STRING
Output
iStateNumber
INT
Input
arStates
POINTER TO stChangeStateUpDown
Last updated

