accVector (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

CX1, SX1, MX2 turbo/encore/warp, NX-200, NX-900, LX2, LX5

Firmware version:

2.40 / 1.40.00


This function will retrieve the current acceleration vector measured by the accelerometer.

Returned values are in mg.

 

Input:

None

 

Output:

x : DINT

The acceleration force measured on the X-axis (in mg).

 

y : DINT

The acceleration force measured on the Y-axis (in mg).

 

z : DINT

The acceleration force measured on the Z-axis (in mg).

 

Returns: INT

0

- Success.

- 1

- General error.

- 2

- Interface not open (see accOpen)

 

Declaration:

FUNCTION accVector : INT;
VAR_INPUT
  X : ACCESS DINT;
  Y : ACCESS DINT;
  Z : ACCESS DINT;
END_VAR;

 

Example:

INCLUDE rtcu.inc
 
PROGRAM example;
VAR
  x,y,z : DINT;
END_VAR;
  accOpen();
BEGIN
  accVector(x := x, y := y, z := z);
  ...
END;
END_PROGRAM;