1-second UPS (persistent data)
CX9020
53
Version: 2.0
9.3
Checking the validity of the variables
For TwinCAT 2 the implicit structure Systeminfotype.bootDataFlags can be read in order to determine the
validity of the persistent data (see:
).
For TwinCAT 3 the implicit variables PlcAppSystemInfo.BootDataLoaded and
PlcAppSystemInfo.OldBootData are available for determining the validity of the persistent data (see:
).
9.3.1
SYSTEMINFOTYPE
TYPE SYSTEMINFOTYPE
STRUCT
runTimeNo :BYTE;
projectName :STRING(32);
numberOfTasks :BYTE;
onlineChangeCount :UINT;
bootDataFlags :BYTE;
systemStateFlags :WORD;
END_STRUCT
END_TYPE
runTimeNo:
specifies the number of the runtime system (1..4).
projectName:
project name as STRING.
numberOfTasks:
number of tasks contained in the runtime system (max. 4).
onlineChangeCount:
number of online changes since the last complete download.
bootDataFlags:
State of the boot data (RETAIN and PERSISTENT) after loading. The upper four bits
indicate the state of the persistent data, while the lower four bits indicate the state of the retain data.
Bit number
Description
0
RETAIN variables: LOADED (without error)
1
RETAIN variables: INVALID (the back-up copy was loaded, since no valid data was present)
2
RETAIN variables: REQUESTED (RETAIN variables should be loaded, a setting in TwinCAT
System Control)
3
reserved
4
PERSISTENT variables: LOADED (without error)
5
PERSISTENT variables: INVALID (the back-up copy was loaded, since no valid data was
present)
6
reserved
7
reserved
systemStateFlags
: Reserved.
When shutting TwinCAT down the PERSISTENT and RETAIN data is written into two files on the hard disk.
The path can be specified in TwinCAT System Control by means of the TwinCAT system properties (PLC
tab). The standard setting is "<Drive>:\TwinCAT\Boot". The files all have a fixed name with fixed extensions:
File name
Description
TCPLC_P_x.wbp Boot project (x = number of the run-time system)
TCPLC_S_x.wbp Packed source code (x = number of the runtime system)
TCPLC_R_x.wbp RETAIN variables (x = number of the runtime system)
TCPLC_T_x.wbp
PERSISTENT variables (x = number of the runtime system)
TCPLC_R_x.wb~ Backup copy of the RETAIN variables (x = number of the runtime system)
TCPLC_T_x.wb~
Backup copy of the PERSISTENT variables (x = number of the runtime system)
If the persistent or retain variables are not loaded, e.g. because they are invalid, the backup file is loaded by
default. In that case bit 1 of the bootDataFlags (for the RETAIN variables) in the PLC and/or bit 5 (for the
PERSISTENT variables) is set.
Summary of Contents for CX9020
Page 1: ...Manual CX9020 Embedded PC 2 0 2019 04 09 Version Date ...
Page 2: ......