msLoggerAddAcc (Function)

Top  Previous  Next

Architecture:

NX32L

Firmware version:

1.50.00


Add logging of accelerometer data to logger. Each set of accelerometer data in full, consists of 2 bytes per axis (X, Y and Z) stored in the buffer.

 

 

Input:

Logger : SYSHANDLE

A user provided handle to uniquely identify the logger. See SYSHANDLE page. This field is mandatory.

 

Downsample : UINT (default 1)

Only collect a accelerometer data set after this amount of measurements, thus saving buffer space.

Values 0 and 1 represent no downsampling.

 

LowRes : BOOL (default FALSE)

If true, only store the most significant byte of each axis in the buffer.

 

Returns: INT

1


- Success.

0


- This function is not supported.

-1


- Interface is not open. Call msOpen first.

-2


- Generic error.

-5


- The logger is not present.

-6


- The accelerometer is not present.

-9


- The specified logger is running. Call msLoggerStop first.

 

 

Declaration

FUNCTION msLoggerAddAcc : INT;
VAR_INPUT
   Logger     : MANDATORY SYSHANDLE;
   Downsample : UINT := 1;
   LowRes     : BOOL := FALSE;
END_VAR;
 

Example:

// For a more complete example, see example under msReadEvent
INCLUDE rtcu.inc
 
VAR
   logger       : ARRAY[1..2OF SYSHANDLE;
END_VAR;
 
PROGRAM test;
VAR
   rc           : INT;
   buf1         : ARRAY[1..10000OF DINT;
END_VAR;
rc := msOpen();
DebugFmt(message:="msOpen (rc=\1)", v1:=rc);
...
rc := msLoggerCreate(logger:=logger[1], buffer:=ADDR(buf1), size:=SIZEOF(buf1), stoponfull:=TRUE);
DebugFmt(message:="msLoggerCreate (rc=\1) buffer_size=\4, stoponfull=TRUE", v1:=rcv4:=SIZEOF(buf1));
...
rc := msLoggerAddAcc(logger:=logger[1], downsample:=0lowres:=FALSE);
DebugFmt(message:="msLoggerAddAcc (rc=\1) downsample=0, lowres=FALSE", v1:=rc);
...
BEGIN
   ...
END;
END_PROGRAM;