CHAPTER 4 PROGRAM LIST
Application Note U17209EJ1V0AN
112
ADIC1 = 0x03 ;
/* Set zero-cross signal interrupt pin */
FEM0 = 0x0c ; /* INTP20 both-edge interrupt */
CC2IC0 = 0x01 ;
FEM1 = 0x0c ; /* INTP21 both-edge interrupt */
CC2IC1 = 0x01 ;
FEM2 = 0x0c ; /* INTP22 both-edge interrupt */
CC2IC2 = 0x01 ;
}
4.2.12 Common area initialization processing function
/****************************************************************************** /
/* Common area initialization */
/****************************************************************************** /
void ainit( void )
{
/* Initialization of flags */
error_flag = 0 ; /* Clear error flag */
init_flag = OFF ; /* Initial flag off */
disp_co = 100 ;
d_speed = 0 ;
/* Motor control area initialization */
stop_flag = ON ; /* Stop flag on */
object_speed = 0 ; /* Target speed 0 */
o_iqai = 0 ; /* Speed integral value 0 */
}
4.2.13 Revolution start initialization processing function
/****************************************************************************** /
/* Revolution start initialization */
/****************************************************************************** /
void start_init( void )
{
int i;
/* */
for ( i = 0 ; i < 21 ; i++ ) before_posi[i][1] = 0;
total_sa = 0 ;
sum_speed = 0 ;
speed_co = 100000 / TS ;
init_co = 0 ;
init_pat = 0 ;
init_upco = 0 ;
}