msLoggerStart (Function)

Top  Previous  Next

Architecture:

NX32L

Device support:

NX-200, LX2

Firmware version:

1.50.00


Start collecting motion sensor data to the buffer of the specified logger.

 

Before calling this function, it is necessary to be sure to enable all the specified sensors that have been added to the logger with the functions msAccEnable, msGyrEnable and msMagEnable.

 

Starting or restarting (after it has been stopped) the logger function, resets the timestamp to zero.

 

Input:

Logger : SYSHANDLE

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

 

Reset : BOOL (default TRUE)

Start with a clean 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.

-9

- The specified logger is running. Call msLoggerStop first.

-15

- The needed sensors are not enabled.

 

 

Declaration

FUNCTION msLoggerStart : INT;
VAR_INPUT
  Logger     : MANDATORY SYSHANDLE;
  Reset      : BOOL := TRUE;
END_VAR;
 

Example:

// For a more complete example, see example under msReadEvent
INCLUDE rtcu.inc
 
VAR
  logger       : ARRAY[1..2] OF SYSHANDLE;
END_VAR;
 
PROGRAM test;
VAR
  rc           : INT;
  buf1         : ARRAY[1..10000] OF 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:=rc, v4:=SIZEOF(buf1));
...
rc := msLoggerAddAcc(logger:=logger[1], downsample:=0, lowres:=FALSE);
DebugFmt(message:="msLoggerAddAcc (rc=\1) downsample=0, lowres=FALSE", v1:=rc);
...
rc := msLoggerStart(logger:=logger[1], reset:=TRUE);
DebugFmt(message:="msLoggerStart (rc=\1) reset=TRUE", v1:=rc);
BEGIN
  ...
END;
END_PROGRAM;