CHAPTER 4 PROGRAM LIST
Application Note U17209EJ1V0AN
135
4.3.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 ;
}
}
4.3.10 A/D converter interrupt processing function
/****************************************************************************** /
/* A/D converter interrupt processing for current */
/****************************************************************************** /
_ _multi_interrupt
void int_AD0(void)
{
iua = (( ( ADA0CR0 >> 6 ) & 0x3ff ) - 0x200) ;
if ( abs(iua) > MAX_I ) {
HZA0CTL0 |= 0x08 ; /* PWM output off */
error_flag = ERR_NO1 ; /* Set error No. */
}
volume = 1023 - ( ( ADA0CR1 >> 6 ) & 0x3ff ) ; /* Set volume value */
Motor_CONT() ;
cont_time = TP1CNT; /* Convert to uSEC */
}
/****************************************************************************** /
/* A/D converter interrupt processing for volume */
/****************************************************************************** /
_ _interrupt
void int_AD1(void)
{
iva = (( ADA1CR0 & 0x3ff ) - 0x200) ;
if ( abs(iva) > MAX_I ) {