accLoggerToMem (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

CX1, SX1, MX2 turbo/encore/warp, NX-200, NX-900, LX2, LX5

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..3000] OF DINT;
  readings : ARRAY [1..100] OF 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 i > 0 THEN
         ...
     END_IF;
  END_IF;
END;
END_PROGRAM;