Figure 4-12 sw2 interrupt, Figure 4-13 free-run timer interrupt – FUJITSU CAN-Motor Board MB91F267N User Manual
Page 77

AN07-00180-3E
- 77 -
When SW2 is pressed, an interrupt takes place. Around Line 763 in MAIN.C, the interrupt function
IRQ_ext_0 is invoked as shown in “Figure 4-12 SW2 interrupt”. In it, the register value of
TCCSL0_STOP, which is used to start/top the free-run timer, is changed.
Figure 4-12 SW2 interrupt
Once the free-run timer starts running, the timer interrupt function IRQ_FreeRunComp of motor_drv.c is
invoked on every carrier peak as shown in “Figure 4-13 Free-run timer interrupt”. In it, the status of the
hall elements is checked and configured into the macro.
Figure 4-13 Free-run timer interrupt
__interrupt void IRQ_ext_0(void)
{
(omitted)
if(gMtStatus == MTST_STOP){
(omitted)
TCCSL0_STOP = 0;
}else{
(omitted)
TCCSL0_STOP = 1;
}
(omitted)
}
←Start of the free-run timer
←Stop of the free-run timer
__interrupt void IRQ_FreeRunComp(void)
{
if(TCCSH0_ICLR == 1)
/* if OCU interrupt */
{
mtPWMController();
(omitted)
}
}
←Macro configuration