IOF_SER_DRIVE_Backup

IOF_SER_DRIVE_Backup 1:

The function block "IOF_SER_DRIVE_Backup" allows to create and restore a binary backup file from within the PLC containing all S- and P-Parameters of the SERCOS drive specified in the parameter list IDN192. The parameter list IDN192 contains a list of all backup parameters. Backup and restore require SERCOS to be in parameter mode (phase 2).

If bStdBackupList = TRUE (default setting) then parameter list IDN192 is used for the backup, otherwise the parameter list IDN17, the list of all parameters. Restore requires a backup file that was created with the standard backup list (IDN192), since some parameters of the parameter list IDN17 are write protected.

Backup and restore are creating a CRC16-CCITT and a 16 bit check sum and store this per default in IDN142, if available.

Internally, instances of the function blocks IOF_SER_IDN_Read, IOF_SER_IDN_Write, FB_FileOpen, FB_FileClose, FB_FileRead, FB_FileWrite are called.

VAR_INPUT

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;
END_VAR

bCheck: The check of the CRC and the checksum is activated by a positive edge at this input. The CRC and the checksum are stored in IDN142 and persistent in the IOF_SER_DRIVE_Backup. If the value of IDN142 and the persistent saved value are the same, then the output bCheckOK is set to TRUE, otherwise bCheckOK is set to FALSE.

bBackup: The backup is activated by a positive edge at this input.

bRestore: The restore is activated by a positive edge at this input.

bCRCEnable: The CRC16-CCITT and the 16 bit checksum are enabled with a steady TRUE at this input. The CRC and the checksum are stored in IDN142, if bCRCEnable = TRUE.

bStdBackupList: determines if the backup list IDN192 (bStdBackupList = TRUE) is used for the backup or if the parameter list of all parameters IDN017(bStdBackupList = FALSE) is used for the backup. Restore requires a backup file created with list IDN192.

sNetId: It is possible here to provide the AmsNetId of the TwinCAT computer on which the ADS command is to be executed. If it is to be run on the local computer, an empty string can be entered.

nPort: The port number nPort is specified by the TwinCAT System Manager during the hardware configuration.

sComment: sComment is a comment that is written to/read from the file header of the backup file.

ePath: determines the path of the backup and restore file. If ePath = PATH_BOOTPATH then the file is located in the TwinCAT boot folder, if ePath = PATH_GENERIC then the file is located in the folder specified in sPathName.

sPathName: Contains the path name or the file name of the backup and restore file, depending on ePath. If the boot path is used, then only the file name has to be set in sPathName. If the generic path is used, then sPathName has to contain the complete pathe and the file name.

tTimeout: States the length of the timeout that may not be exceeded by execution of the ADS command.

VAR_OUTPUT

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

bBusy: When the function block is activated this output is set. It remains set until and acknowledgement is received.

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

nErrId: Supplies the ADS error number or function block specific error code when the bError output is set.

bCheckOk: Is TRUE, if bCheck was successful.

Function block specific error codes

Description

0x1003

Wrong parameter mode

0x1004

Data parameter wrong value size

0x1005

False backup parameter type

0x1006

Backup list was not IDN 192

Requirements

Development environment

Target system type

IO hardware

PLC libraries to include

TwinCAT v2.8.0 Build > 735

PC (i386)

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

TcIoFunctions.Lib

( Standard.Lib; TcBase.Lib; TcSystem.Lib; TcUtilities.Lib are included automatically )