FC_RetainImageLoad - General Information

Overview

Type:

Function

Available as of:

SystemInterface_1.32.6.0

Versions:

Current version

Task

Load the memory image of the retain memory that is located in a file in the retain memory of the controller.

Description

The function reads the memory image from the specified file and stores the same in the retain memory. It is possible to select whether a check of the ProgramIdent has to be carried out or not. The ProgramIdent is a unique identifier for an application. It is required that the retain memory and the configuration of the retain variables of the application match each other. This is ensured by a check of the ProgramIdent. For this purpose, the ProgramIdent of the memory image and of the application currently located in the memory are compared and if there is a match, then the memory image is loaded. The ProgramIdent of an application is newly created by every modification. Therefore it may be necessary to reject a check of the ProgramIdent because only minor modifications have been effected in the code and the declaration of the retain variables has not changed. In order to avoid a detected error of the controller, the retain memory and the application must match each other. The size of the memory image and the size of the retain memory required by the application are always checked. The memory image is only loaded if both size values match.

 WARNING
INCOHERENCY OR LOSS OF DATA
Do not access the retain data during the execution of the function FC_RetainImageLoad().
Failure to follow these instructions can result in death, serious injury, or equipment damage.
NOTE: The typical runtime of the function in a controller is 100 ms if the retain data file is located on the drive 'ide0:'.

Interface

Input

Data type

Description

i_sRetainImageFileName

STRING[80]

Name of the file from which the memory image of the retain memory has to be loaded. The file name automatically receives the extension .ret. The file can be stored to any existing directory of the controller. The file name must not include any special characters or wildcards.

i_xProgramIdentCheck

BOOL

It is possible to select whether a check of the ProgramIdent has to be carried out or not.

  • TRUE: The memory image is only loaded if the ProgramIdent of the memory image and the running application match.

  • FALSE: The ProgramIdent is not checked.

If it is not checked whether the ProgramIdent matches the application, it must be ensured that the application and the memory image of the retain memory that has to be loaded match each other. Otherwise a controller error is detected.

Return Value

Data type

Description

DINT

0: The memory image has been loaded successfully into the retain memory.

-1: The memory image could not be loaded. An invalid file name was specified. The file name contains special characters ":", "\" or "/" and wildcards "*" or "?".

-2: The memory image could not be loaded because the specified directory does not exist.

-3: The memory image could not be loaded because the specified file name does not exist.

-4: The memory image could not be loaded into the retain memory because the ProgramIdent of the memory image does not match the ProgramIdent of the application currently located in memory.

-5: The memory image could not be loaded into retain memory because the data in the memory image are not valid. The data was probably changed manually. This was noticed during a check of the size of the memory image with the size of the retain data stored in the file.

-6: The memory image could not be loaded into retain memory because the files in the memory image are not valid.

-7: The memory image could not be loaded into retain memory because the specified file is not a memory image file of a retain memory.

-8: The memory image could not be loaded into the retain memory because a general error is detected in the function FC_RetainImageLoad().

Examples

diResult := FC_RetainImageLoad(‚karton', TRUE); 

The retain memory is loaded from the file 'karton.ret' on the default device 'ide0:'. The ProgramIdent is checked.

diResult := FC_RetainImageLoad(‚ide0:\retain\plister', FALSE); 

The retain memory is loaded from the file 'plister.ret' located in the directory ‚retain’ on the default device 'ide0:'. The ProgramIdent is not checked.

diResult := FC_RetainImageLoad('remote:ide0:\etikett', TRUE); 

The retain memory is loaded from the file 'etikett.ret', which is located on the drive 'ide0:', which is again located on the remote device 'remote:'. The ProgramIdent is checked.