msLoggerAddMag (Function)

Top  Previous  Next

Architecture:

NX32L

Device support:

NX-200, LX2

Firmware version:

1.52.00


Add logging of magnetometer data to logger. Each set of magnetometer 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 magnetometer 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 magnetometer is not present.

-9

- The specified logger is running. Call msLoggerStop first.

 

 

Declaration

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

Example:

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 := msLoggerAddMag(logger:=logger[1], downsample:=0, lowres:=FALSE);
DebugFmt(message:="msLoggerAddMag (rc=\1) downsample=0, lowres=FALSE", v1:=rc);
...
BEGIN
  ...
END;
END_PROGRAM;