IOF_SER_DRIVE_Backup

IOF_SER_DRIVE_Backup 1:

The IOF_SER_DRIVE_Backup function block allows the backup and restore of the drive data (S and P parameters) of the PLC in a binary file. The list of S and P parameter data to be backed up is taken from the Sercos parameter IDN192 by default. Backup and restore require the SERCOS parameter mode (phase 2).

If bStdBackupList = TRUE (standard), the IDN192 parameter is taken as the list of the data to be backed up; otherwise IDN17, the list of all Sercos parameters, is taken. Restore requires a backup file that was created with the IDN192 parameter, since some parameters in the IDN17 list are read-only.

Backup and restore create a CRC16-CCITT and a 16-bit checksum and save them in the IDN142 parameter, if available.

The file format of the backup file is described in the backup file format.

IOF_SER_DRIVE_Backup 2: Inputs

VAR_INPUT
    bCheck        : BOOL;
    bBackup       : BOOL;
    bRestore      : BOOL;
    bCRCEnable    : BOOL := TRUE;
    bStdBackupList: BOOL := TRUE;
    sNetId        : T_AmsNetId;
    nPort         : UINT;
    sComment      : T_MaxString;
    ePath         : E_OpenPath := PATH_BOOTPATH;
    sPathName     : T_MaxString := 'DRIVEPAR.BIN';
    tTimeout      : TIME := DEFAULT_ADS_TIMEOUT;
END_VAR

Name

Type

Description

bCheck

BOOL

A positive edge at this input activates the CRC and checksum check. CRC and checksum are persistent and saved in the IDN142 parameter after a backup or restore. If the value from parameter IDN142 and the persistent data match, bCheckOK is set to TRUE, otherwise bCheckOK is set to FALSE.

bBackup

BOOL

The backup is activated via a positive edge at this input.

bRestore

BOOL

The restore is activated via a positive edge at this input.

bCRCEnable

BOOL

The CRC16-CCITT and the 16-bit checksum are enabled via bCRCEnable = TRUE. The CRC and the checksum are saved in parameter IDN142 if bCRCEnable = TRUE.

bStdBackupList

BOOL

Determines which parameter list is used for the backup. By default, IDN192 (bStdBackupList = TRUE) is used for the backup, if bStdBackupList = FALSE then the list of all parameters IDN017 is used. Restore requires a backup file that was created with the IDN192 list.

sNetId

T_AmsNetID

The network address of the TwinCAT computer on which the ADS command is to be executed can be specified here. For the local computer an empty string may be specified.

nPort

UINT

The port number nPort is assigned by the TwinCAT system during the hardware configuration.

sComment

T_MaxString

Comment that is written to the file header of the backup file.

ePath

E_OpenPath

Determines the path of the backup file. If ePath = PATH_BOOTPATH, the TwinCAT BOOT path is used; if ePath = PATH_GENERIC, the path specified in sPathName is used.

sPathName

T_MaxString

Contains the file name (when using the boot path) or the complete path and file name when using the generic path.

tTimeout

TIME

Specifies the time-out period that must not be exceeded when the command is executed.

IOF_SER_DRIVE_Backup 3: Outputs

VAR_OUTPUT
    bBusy     : BOOL;
    bError    : BOOL;
    nErrId    : UDINT;
    bCheckOK  : BOOL;
END_VAR

Name

Type

Description

bBusy

BOOL

When the function block is enabled, this output is set and remains set until a feedback is received.

bError

BOOL

If an error should occur during the transfer of the command, then this output is set once the bBusy output was reset.

nErrId

UDINT

Returns the ADS error number or the specific function block error number if the ERR output is set.

specific function block error number

Description

0x1003

Incorrect parameter mode

0x1004

Incorrect parameter data size

0x1005

Incorrect backup parameter type

0x1006

Backup parameter list was not IDN 192

Name

Type

Description

bCheckOk

BOOL

Is TRUE if the checksum test was successful.

Requirements

Development environment

Target platform

IO hardware

PLC libraries to be integrated (category group)

TwinCAT v3.1.0

PC (x86)

Sercans SCS-P ISA; Sercans SCS-P PCI;
Beckhoff FC750x PCI

Tc2_IoFunctions (IO)