msGyrEnable (Function)

Top  Previous  Next

Architecture:

NX32L

Device support:

NX-200, LX2

Firmware version:

1.50.00


Configure and enable/disable the gyroscope for data acquisition using msDataSet with msRead or through the data logger (see msLoggerCreate).

The gyroscope measures the angular rate of rotation of the device acting on each axis.

Thus for a constant rotation of the device around an axis, a constant non-zero value should be measured for the given axis.

 

Input:

Enable : BOOL (default TRUE)

Enable or disable the gyroscope.

 

Resolution : INT (125, 250, 500, 1000) (default 125)

The range of the measurements the device can measure in units of degrees per second. F.ex. the value 125 represents the range: [-125dps ; +125dps].

 

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 gyroscope is not present.

 

Declaration

FUNCTION msGyrEnable : INT;
VAR_INPUT
  Enable     : BOOL := TRUE;
  Resolution : INT  := 125;
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 gyroscope
rc := msGyrEnable(enable:=TRUE, resolution:=125);
DebugFmt(Message:="gyrEnable ON (rc=\1)", v1:=rc);
...
BEGIN
  ...
END;
END_PROGRAM;