English
Language : 

AN3288 Datasheet, PDF (16/27 Pages) STMicroelectronics – The purpose of this application note is to provide an accurate description
Special features
Figure 12. Direction-defining state machine block diagram
,1,7
:$,7
$&48,5(
352&(66
$&78$7(
5HYHUVH
$&78$7(
)RUZDUG
AN3288
!7KUHVKROG "
12
<(6
!'LUHFWLRQ "
5HYHUVH
)RUZDUG
!-V
The following is the code enabling this feature:
/* the direction identification algorithm starts above and below the
activation thresholds */
if((acc< activ_neg)||(acc> activ_pos))
{
area += (acc);
/* defining of 2 saturation values (positive and negative) */
if(area>satur_pos) area= satur_pos;
else if(area<satur_neg) area= satur_neg;
}
if(area>0)
/* if area >0 --> "FORWARD" direction */
state = ACTUATE_FORWARD;
else if(area<0)
/* if area <0 --> "REVERSE" direction */
state = ACTUATE_REVERSE;
else
state = WAIT;
16/27
Doc ID 18011 Rev 2