accSetAccelerationEvent (Function) |
Top Previous Next |
This function will enable or disable monitoring of the acceleration.
When monitoring is enabled, the accelerometer will compare the acceleration of an axis with a threshold value. If the acceleration is above (or below) the threshold for the selected duration, an "Acceleration" event is raised. See also accWaitEvent for event # 7. The accelerometer will continue to raise the event after each duration interval until the acceleration moves below (or above) the threshold again.
If combined is true, then all axis conditions must be true for the event to be raised as illustrated above where all axes are required to be below threshold (also know as free fall).
Input: Enable : BOOL (default FALSE) Is event generation enabled.
Once : BOOL (default FALSE) Event must be enabled again after detection.
Threshold: DINT (0..16000, default 0) The acceleration which each axis is compared against (in mg).
Duration : DINT (0..5120, default 0) Number of milliseconds the axis must be high/low before the axis condition is true.
Combined : BOOL (default FALSE) Whether all axis conditions should be true or just a single one before the event is raised.
XAbove : BOOL (default FALSE) Fire event when x-axis is above threshold for the duration.
XBelow : BOOL (default FALSE) Fire event when x-axis is below threshold for the duration.
YAbove : BOOL (default FALSE) Fire event when y-axis is above threshold for the duration.
YBelow : BOOL (default FALSE) Fire event when y-axis is below threshold for the duration.
ZAbove : BOOL (default FALSE) Fire event when z-axis is above threshold for the duration.
ZBelow : BOOL (default FALSE) Fire event when z-axis is below threshold for the duration.
Output: None.
Returns: INT
Declaration: FUNCTION accSetAccelerationEvent : INT;
Example: INCLUDE rtcu.inc |