accSetShockEvent (Function) |
Top Previous Next |
This function will enable or disable monitoring of shocks. A shock is defined as the measured acceleration exceeding a threshold and returning below the threshold before the duration limit expires. A double shock is defined as two shocks detected after each other where the second shock must start within a time window after the first has ended.
If a shock (or double shock) is detected, a "Shock" event is raised. See also accWaitEvent for event # 8.
Above is illustrated a shock event (a) and a double shock event (b).
Input: Enable : BOOL (default FALSE) Is event generation enabled. If disabled, all other parameters are ignored.
Once : BOOL (default FALSE) Event must be enabled again after event has been detected
Threshold : DINT (0..16000, default 0) The acceleration which each axis is compared against to detect the start and end of a shock (in mg).
Duration : DINT (1..5120) The time in milliseconds before which the end of a shock must occur.
Latency : DINT (0..10240, default 0) Number of milliseconds where shocks are ignored.
Window : DINT (0..10240, default 0) Number of milliseconds before the second shock must occur. 0 : single shock detection >0 : double shock detection
X : BOOL (default TRUE) Detects shocks on x-axis
Y : BOOL (default TRUE) Detects shocks on y-axis
Z : BOOL (default TRUE) Detects shocks on z-axis
Returns: INT
Declaration: FUNCTION accSetShockEvent : INT;
Example: INCLUDE rtcu.inc |