SYSTEM
Accesses the system parameters to enable performing these tasks:
- Reading various cycle timing information and changing cycle timing
- Resetting timing counters
- Checking for and reading run-time errors
- Backing up, saving, and restoring variables

Arguments | ||
---|---|---|
MODE | DINT | Identifies the system parameter and the access mode |
ARG | DINT | New value for a "write" access |
PARAM | DINT | Value of the accessed parameter |
These are the available commands (pre-defined keywords) and expected arguments for the SYSTEM operator:
Command | Meaning | Argument | Value | Return Value |
---|---|---|---|---|
SYS_TALLOWED | reads allowed cycle timing | 0 | 1 | allowed cycle timing |
SYS_TCURRENT | reads current cycle timing | 0 | 2 | current cycle timing |
SYS_TMAXIMUM | reads maximum cycle timing | 0 | 3 | maximum detected timing |
SYS_TOVERFLOW | reads cycle timings overflows | 0 | 4 | number of timing overflows |
SYS_TWRITE | changes cycle timing | new allowed cycle timing | 5 | written time |
SYS_TRESET | resets timing counters | 0 | 6 | 0 |
SYS_ERR_TEST | checks for run time errors | 0 | 16 | 0 if no error detected |
SYS_ERR_READ | reads oldest run time error | 0 | 17 | oldest error code |
SYS_INITBOO | backs up init Boolean | memory address | 32 | next free address |
SYS_SAVBOO | saves Booleans | 0 | 33 | zero if OK |
SYS_RESTBOO | restores Booleans | 0 | 34 | zero if OK |
SYS_INITANA | backs up init analog | memory address | 36 | next free address |
SYS_SAVANA | saves analogs | 0 | 37 | zero if OK |
SYS_RESTANA | restores analogs | 0 | 38 | zero if OK |
SYS_INITTMR | backs up init timer | memory address | 40 | next free address |
SYS_SAVTMR | saves timers | 0 | 41 | zero if OK |
SYS_RESTTMR | restores timers | 0 | 42 | zero if OK |
SYS_INITALL | backs up init all types | memory address | 44 | next free address |
SYS_SAVALL | saves all types | 0 | 45 | zero if OK |
SYS_RESTALL | restores all types | 0 | 46 | zero if OK |
Define the memory backup location using this syntax to back up variables for a specific type or for all types:
<new_address> := SYSTEM(SYS_INITxxx,<address>);
where:
<address>
is the memory backup address location (16# value for Hexadecimal format). The location must be an even address or the operation fails.SYS_INITxxx
can be one of these:SYS_INITBOO to define memory backup location for all Boolean variables.
SYS_INITANA to define memory backup location for all analog variables.
SYS_INITTMR to define memory backup location for all timer variables.
SYS_INITALL to define memory backup location for all Boolean, analog, and timer variables.
<new_address>
gets the next free address, for example, <address> + size of backed up variables (in bytes) according to SYS_INITxxx. This enables verifying the size of the required memory backup. If the operation fails, <new_address>
gets a zero value.After having defined the backup memory location, perform backups of the variables at any time during the application. The backup is performed once only at the end of the current cycle. If the hardware delivers a Boolean input or a C function to inform of a power failure and allows at least one cycle delay before closing down, the backup may only be performed after detecting the power failure.
<error>
:=SYSTEM(SYS_SAVxxx,0
);where:
SYS_SAVxxx can be one of these:
SYS_SAVBOO to ask for all Boolean variables backup.
SYS_SAVANA to ask for all analog variables backup.
SYS_SAVTMR to ask for all timer variables backup.
SYS_SAVALL to ask for all Boolean, analog and timer variables backup.
<error>
gets an error status other than zero when the operation fails (SYS_INITxxx is not called).Restore variables at any time during the application. Perform the restoration once only at the end of the current cycle. Set an analog variable to a constant value for use as a signature to ensure the validity of the backed up data.
<error>
:= SYSTEM(SYS_RESTxxx,0
);where:
SYS_RESTxxx
can be one of these:SYS_RESTBOO to restore all Boolean variables.
SYS_RESTANA to restore all analog variables.
SYS_RESTTMR to restore all timer variables.
SYS_RESTALL to restore all Boolean, analog and timer variables.
<
error
> gets an error status other than zero when the operation fails (SYS_INITxxx
is not performed).Example
(* FBD example with "SYSTEM" operators *)

(* ST Equivalence: *)
alarm := (SYSTEM (SYS_TOVERFLOW, 0) <> 0); If (alarm) Then nb_err := nb_err + 1; rc := SYSTEM (SYS_TRESET, 0); End_If;
Provide Feedback