CHAPTER 4 PROGRAM LIST
Application Note U17209EJ1V0AN
110
}
/* */
if ( disp_co != 0 ) {
d_speed += abs( now_speed ) ;
disp_co -= 1 ;
}
}
4.2.10 A/D converter interrupt processing function
/****************************************************************************** /
/* A/D converter interrupt processing for U-phase current and speed volume */
/****************************************************************************** /
_ _multi_interrupt
void int_AD0(void)
{
iua = (( ADCR00 & 0x3ff ) - 0x200) ;
if ( abs(iua) > MAX_I ) {
POER0 = 0 ; /* PWM output off */
error_flag = ERR_NO1 ; /* Set error No. */
}
volume = 1023 - ( ADCR01 & 0x3ff ) ; /* Set volume value */
Motor_CONT() ;
cont_time = TM3 * 10 / 16; /* Convert to uSEC */
}
/****************************************************************************** /
/* A/D converter interrupt processing for V-phase current */
/****************************************************************************** /
_ _interrupt
void int_AD1(void)
{
iva = (( ADCR10 & 0x3ff ) - 0x200) ;
if ( abs(iva) > MAX_I ) {
POER0 = 0 ; /* PWM output off */
error_flag = ERR_NO1 ; /* Set error No. */
}
}
4.2.11 Hardware initialization processing function
/****************************************************************************** /
/* Hardware (peripheral I/O) initialization */
/****************************************************************************** /
void hinit( void )
{
short dummy ;
/* Port mode register initialization */
PM3 = 0xfe ;