msMagEnable (Function)

Top  Previous  Next

Architecture:

NX32L

Device support:

NX-200, LX2

Firmware version:

1.52.00


Enable/disable the magnetometer for data acquisition using msDataSet with msRead or through the data logger (see msLoggerCreate).

The magnetometer measures the magnetic field impacting the device, and should be able to detect magnetic north/south in an environment without too much magnetic disturbances.

 

Input:

Enable : BOOL (default TRUE)

Enable or disable the magnetometer.

 

Returns: INT

1

- Success.

0

- This function is not supported.

-1

- Interface is not open. Call msOpen first.

-2

- Generic error.

-3

- Invalid configuration, including if the sensor is already enabled/disabled.

-6

- The magnetometer is not present.

 

Declaration

FUNCTION msMagEnable : INT;
VAR_INPUT
  Enable     : BOOL := TRUE;
END_VAR;
 

Example:

INCLUDE rtcu.inc
 
PROGRAM example;
VAR
  rc : INT;
END_VAR;
// Open interface
rc := msOpen();
DebugFmt(Message:="msOpen (rc=\1)", v1:=rc);
// enable magnetometer
rc := msMagEnable(enable:=TRUE);
DebugFmt(Message:="magEnable ON (rc=\1)", v1:=rc);

BEGIN
  ...
END;
END_PROGRAM;