Implicit Variables¶
Every SFC object supplies implicit variables for you to monitor the status of steps and IEC actions at runtime. These implicit variables are declared automatically by CODESYS for each step and each IEC action.
The implicit variables are structure instances of the type SFCStepType
for steps and type SFCActionType
for actions. The variables have the same names as their elements, for example “step1” variable name for “step1” step name. The structure components describe the status of a step or action or the current elapsed time in an active step.
Note
In the element properties, you can define whether CODESYS should export a symbol definition for this flag to the symbol configuration.
See also
Step and action status
Syntax for the implicit variable declaration:
<step name>:SFCStepType;
_<action name>:SFCActionType;
Step | |
<step name>.x |
Shows the activation status in the current cycle. If |
<step name>._x |
Shows the activation status for the next cycle. If |
<step name>.t |
The See also: |
IEC action | |
_<action name>.x |
TRUE when the action is being executed. |
_<action name>._x |
TRUE when the action is active. |
Attention
You can use the above variables to force a specific status value to a step (activate a step). Please note, however, that this can cause an unstable status in the SFC.
See also
Access to implicit variables
Syntax for access:
Assign implicit variable directly in the POU: <variable name>:=<step name>.<implicit variable>
and <variable name>:=_<action name>.<implicit variable>
Example
status:=step1._x;
From another block with POU name:<variable name>:=<POU name>.<step name>.<implicit variable>
and <variable name>:=<POU name>._<action name>.<implicit variable>
Example
status:=SFC_prog.step1._x;
Symbol generation
In the element properties of a step or action, you define whether CODESYS should add a symbol definition for the step or action flag. In the Properties view, you must select the necessary access rights in the Symbol column.
See also