accLoggerToMem (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Firmware version:

2.40 / 1.40.00


This function will move the contents of the logger to the memory.

The acceleration vectors will be stored in memory as 3 DINTs, where the first dint contains the x-axis, the second contains the y-axis, and the third contains the z-axis.

 

 

Input:

mem : PTR;

Address of destination data area.

 

size : DINT;

The size of the memory in bytes.

 

Output:

None.

 

Returns: INT

>0

- Number of bytes written.

-1

- General error.

-3

- Destination size too small to hold a single reading.

 

Declaration:

FUNCTION accLoggerToMem : INT;
VAR_INPUT
   mem   : PTR;
   size  : DINT;
END_VAR;

 

Example:

INCLUDE rtcu.inc
 
VAR
   buf      : ARRAY [1..3000OF DINT;
   readings : ARRAY [1..100OF DINT;
   i        INT;
END_VAR;
 
PROGRAM example;
accOpen();
accLoggerSetConfig(buffer := ADDR(buf), size := SIZEOF(buf));
accLoggerStart();
BEGIN
   IF accLoggerLevel() > 800 THEN
      i := accLoggerToMem(mem := ADDR(readings), size := SIZEOF(readings));
      IF > 0 THEN
          ...
      END_IF;
   END_IF;
END;
END_PROGRAM;