CHAPTER 4 PROGRAM LIST
Application Note U17209EJ1V0AN
184
/* */
if ( ( ( init_flag == 0 ) && ( stop_flag == OFF) ) ) {
sa_time = TMENC10 ;
TMENC10 = 0 ; /* Restart timer */
if ( ~P3 & 0x02 ) { /* Check V phase */
base_position = RAD*2/3/P ;
} else {
base_position = RAD/6/P ;
}
if ( object_speed < 0 ) {
wk = run_ccw_data[ P3 & 0x07 ][0] ;
wk2 = run_ccw_data[ P3 & 0x07 ][1] ;
} else {
wk = run_cw_data[ P3 & 0x07 ][0] ;
wk2 = run_cw_data[ P3 & 0x07 ][1] ;
}
TQ0CCR1 = pwm_value ;
TQ0CCR2 = pwm_value ;
TQ0CCR3 = pwm_value ;
TQ0IOC0 = wk ;
TQ0IOC3 = wk2 ;
}
int_co++ ;
}
4.5.9 10 mSEC interval interrupt processing function
/****************************************************************************** /
/* Other timer interrupt processing (10 mSEC interval) */
/****************************************************************************** /
_ _multi_interrupt
void int_ETC(void)
{
/* Wait timer processing */
if ( timer_count != 0 ) {
timer_count -= 1 ;
}
/* Acceleration/deceleration timer processing */
if ( accel_count != 0 ) {
accel_count -= 1 ;
}
/* */
if ( disp_co != 0 ) {
d_speed += abs( now_speed ) ;
disp_co -= 1 ;
}