M16C Family has the interrupt priority level to control the interrupt process. When an interrupt request is generated, the priority level of the interrupt is compared with the processor interrupt priority level (IPL) in the flag register. If the priority level number of the generated interrupt is larger than the IPL number, the current process should be stopped and the newer interrupt process executed. If the IPL is larger, the new interrupt process is put in the wait state.
For example, assume Timer A0 is set to priority level "1", A/D Conversion to "3", and Timer A1 to "2". In this situation, when a Timer A1 interrupt is accepted, the IPL will be "2". If a Timer A0 interrupt request is generated during the Timer A1 interrupt process, because the Timer A0 interrupt priority level is only "1", the Timer A0 interrupt will go into the wait state.
Continuing on with the same example, if an A/D Conversion interrupt request is generated with interrupt priority level "3", its interrupt process will be executed immediately. After the A/D Conversion interrupt process is completed, the flow returns the Timer A1 interrupt (level "2"). After the Timer A1 interrupt process is completed, the Timer A0 interrupt (level "1"), which has been in the wait state, is finally executed.
Finally, when an interrupt request is accepted, the interrupt enable flag (I) goes to the interrupt disable state ("0"). To accept another interrupt during the current interrupt process, you need to set the I flag to interrupt enable state ("1") by software.
|M16C/6NK, M16C/6NL, M16C/6NM, M16C/6NN|