ChangeStateUpDown
ChangeStateUpDown (FB)
ChangeStateUpDown (FB)FUNCTION_BLOCK ChangeStateUpDown
Short description
Switching between freely definable states (UP and DOWN button) Prerequisite: Connection of a suitable array at input 'arStates' with elements of type 'stChangeStateUpDwon' Typical application: Switching of 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
<br/>*<br/>
arStates’
stChangeStateUpDown
Array with the individual states
Outputs
<br/>*<br/>
sStateName’
STRING
Name of the current state
<br/>*<br/>
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) using the inputs 'xStateUp' and 'xStateDown'. After the first download, a subsequent download, every online change and on every rising edge at input 'xResInit', the initial state is set. The index of the initial state is defined by the input 'bInitState'. In case of error, the string 'Error' is output at output 'sStateName' and the value -1 is output at output 'iStateNumber'. \
Typical application
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

