A.6.7 Interrupt

Due to many registers being saved and restored before and after an interrupt processing, the expected interrupt response time may not be obtained. In such a case, the fast interrupt setting (fint) and fint_register option should be used to keep down the number of saving and restoring of registers so that the interrupt response time can be reduced.

Note however that usage of the fint_register option limits the usable registers in other functions so the efficiency of the entire program is degraded in some cases.

[Example]

Source code before improvement

#pragma interrupt int_func
volatile int count;
 
void  int_func()
{
     count++;
}

 

Assembly-language expansion code before improvement

_int_func:
     PUSHM R4-R5
     MOV.L #_count,R4
     MOV.L [R4],R5
     ADD #01H,R5
     MOV.L R5,[R4]
     POPM R4-R5
     RTE

 

Source code after improvement

#pragma interrupt int_func(fint)
volatile int count;
 
void  int_func()
{
     count++;
}

 

Assembly-language expansion code after improvement

<When the fint_register=2 option is specified>
_int_func:
     MOV.L #_count,R12
     MOV.L [R12],[R13]
     ADD #01H,R13
     MOV.L R13,[R12]
     RTFI