LoadData (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

ALL

Firmware version:

1.00 / 1.00.00


LoadData will load a block of memory from a specific location in the persistent FLASH memory.

 

 

Input:

index : INT (1..192)

Location number the data should be loaded from.

 

data : ADR

Address of the memory block that receives the loaded data.

 

datasize : INT (1..255)

Maximum size to load into "ptr".

 

Returns: INT

The actual length loaded from the specified index (this will be 0 if there is no valid data at the index - i.e. a string is stored at this position).

 

Declaration:

FUNCTION LoadData : INT;
VAR_INPUT
  index   : INT;
  data     : PTR;
  datasize : INT;
END_VAR;

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
 
VAR
  xx     : ARRAY[1..100] OF SINT;
  length : INT;
END_VAR;
 
BEGIN
  ...
 length:=LoadData(index:=10, data:=ADDR(xx), datasize:=SIZEOF(xx));
  // Persistent memory location number 10 will be loaded into 'xx'
  ...
END;
 
END_PROGRAM;