msOpen (Function)

Top  Previous  Next

Architecture:

NX32L

Device support:

NX-200, LX2

Firmware version:

1.36.00


This function must be called to open the Motion Sensor interface, and is mutually exclusive to the accOpen function.

 

 

Returns: INT

1

- Success.

0

- This function is not supported.

-2

- Generic error.

-12

- Failed, as the 3D Accelerometer interface is open. Use accClose to close the interface.

-13

- Motion Sensor interface already open.

 

Declaration:

FUNCTION msOpen : INT;

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
VAR
  wk    : DINT;
END_VAR;
// Open Motion Sensor interface
msOpen();
// Enable wake on vibration with high sensitivity
msVibrationSetWakeup(sensitivity := 80, enable := ON);
// Sleep 600 seconds or wake on vibration detection
wk := pmSuspend(time:=600, mode := 0);
...
// Close Motion Sensor interface
msClose();
BEGIN
  ...
END;
END_PROGRAM;