This is the web edition of the original ⮫ AC500-S safety user manual, version 1.3.2. This web edition is provided for quick reference only. The original safety user manual must be used to meet functional safety application requirements. |
Of the variable types and attributes defined in IEC 61131-3 the following are suitable for creating safety applications:
Keyword |
Description |
Suitable (yes / to a limited extent / no) (comment) |
---|---|---|
VAR |
Local block variable |
Yes |
VAR_INPUT |
Block input parameter |
Yes |
VAR_OUTPUT |
Block output parameter |
Yes |
VAR_IN_OUT |
Block reference parameter |
To a limited extent. (To illustrate the side effect the parameter should be identified with a prefix. Even better would be to use an input and output parameter instead.) |
VAR_GLOBAL |
Global variable |
Yes. (We strongly recommend identifying global variables with a prefix such as "G_" or "GS_" (for safety variables).) |
VAR_EXTERNAL |
Declaration of global variables used in the block |
Yes |
AT |
Variable address allocation |
To a limited extent⮫ “Direct addresses” |
CONSTANT |
Declaration as constant (no write access possible) |
Yes. (We recommend to declare each constant explicitly.) |
RETAIN |
Variable value is preserved after switch-off |
No, not supported |
PERSISTENT |
Variable value is preserved after reloading |
No, not supported |
In the interest of better readability the following rules should be followed for the declaration of variables:
-
Only one block of declaration type (e.g., VAR, VAR_INPUT, VAR_OUTPUT, VAR_IN_OUT, VAR_GLOBAL and combinations with CONSTANT) per component
-
Only one variable declaration per line with informative comment
Bad:
VAR
A, B, C: BOOL; (* several variables *)
END_VAR
Good:
VAR
A: BOOL; (* first variable *)
B: BOOL; (* second variable *)
C: BOOL; (* third variable *)
END_VAR
-
Local variables (VAR) should always have a different name. Obscuring of global variables through local variables must be avoided.