File format of the backup file
1. File header of type ST_SercosFileHeader
2. n * Data
a) Parameter header of Type ST_SercosParamHeader
b) Parameter data as bytes
Sample for n parameters
1 * ST_SercosFileHeader (268
Bytes)
-----------------------------------------------------
nVersion ( 4 Bytes)
nListType ( 4 Bytes)
cbCommentLen ( 4 Bytes)
sComment ( 256 Bytes)
n * (ST_SercosParamHeader + Data)
-----------------------------------------------------
nIDN ( 2 Bytes)
cbSize
( 2 Bytes)
nAttrib
( 4 Bytes)
arrData (cbSize Bytes), can
be different for each parameter depending on the type or
listlength
Sample for n = 3 parameters
ST_SercosFileHeader
(268 Bytes)
----------------------------------------------------------------------------
nVersion ( 4 Bytes), i.e. = 01 00 00 00
(= 1)
nListType ( 4 Bytes), i.e. = 00 00 00 00
(= 0)
cbCommentLen ( 4 Bytes), i.e. = 00 00 00 00
(= 0)
sComment ( 256 Bytes), i.e. = 00 00 00 00 00 00 00 ... 00
(256 * 00)
1st parameter ST_SercosParamHeader + Data
(10 Bytes)
----------------------------------------------------------------------------
nIDN ( 2 Bytes), i.e. = nnnn
cbSize
( 2 Bytes), i.e. = 02
00 (= 2)
nAttrib
( 4 Bytes), i.e. = xx xx xx xx
arrData (2 Bytes), i.e. = 12 34
2nd parameter
ST_SercosParamHeader + Data (16
Bytes)
----------------------------------------------------------------------------
nIDN ( 2 Bytes), i.e. = nnnn
cbSize
( 2 Bytes), i.e. = 08
00 (= 8)
nAttrib
( 4 Bytes), i.e. = xx xx xx xx
arrData ( 8 Bytes),
i.e. = 12 34 56 78 9a bc de
f0
3rd parameter
ST_SercosParamHeader + Data (12
Bytes)
----------------------------------------------------------------------------
nIDN ( 2 Bytes), i.e. = nnnn
cbSize
( 2 Bytes), i.e. = 04
00 (= 4)
nAttrib
( 4 Bytes), i.e. = xx xx xx xx
arrData ( 4 Bytes),
i.e. = 12 34 56 78
TYPE ST_SercosFileHeader (268 Bytes)
TYPE ST_SercosFileHeader :
STRUCT
nVersion : UDINT; (* 4 Bytes *)
nListType : UDINT; (* 4 Bytes *)
cbCommentLen : UDINT; (* 4 Bytes *)
sComment : T_MaxString; (* 256 Bytes *)
END_STRUCT
END_TYPE
The variable of this type is a structure containing the file header for the backup and restore file.
nVersion: contains the file version, currently 1
nListType: contains the IDN list that was used to create the backup file and is either 192 (list of backup parameters) or 17 (list of all parameters) or 0 (user defined list, only for the FB_IOF_SER_DRIVE_BackupEx). The restore requires nListType to be 192 or 0 (only for the FB_IOF_SER_DRIVE_BackupEx).
cbCommentLen: contains the length of the user comment for the backup file
sComment: contains the user comment for the backup file. The string with all 256 bytes is written.
TYPE ST_SercosParamHeader (8 Bytes)
Following to the file header for each parameter a parameter header (ST_SercosParamHeader) is saved in the file.
TYPE ST_SercosParamHeader :
STRUCT
nIDN : UINT; (* 2 Bytes *)
cbSize : UINT; (* 2 Bytes *)
nAttrib : DWORD; (* 4 Bytes *)
END_STRUCT
END_TYPE
nIDN: contains the parameter ID number
cbSize: contains the length of data bytes for this parameter in the backup file, following this parameter header
nAttrib: contains the attribute of the parameter (see ST_SercosParamData) for the determination of the data type and data size.
Parameter Data (cbSize Bytes)
The parameter header is immediately followed by the actual parameter value. The amount of bytes of the parameter value is stored in cbSize of ST_SercosParamHeader of the parameter.
Requirements
Development environment | Target system type | PLC libraries to include |
---|---|---|
TwinCAT v2.8.0 | PC (i386) | TcIoFunctions.Lib ( Standard.Lib; TcBase.Lib; TcSystem.Lib; TcUtilities.Lib are included automatically ) |