Reading An Interrupt Level; Interrupt Service Routine; Interrupt Service Routine Without Register Saving; Setting Global Interrupt Level - Fujitsu F2MC-FR Series Application Note

32-bit microcontroller
Hide thumbs Also See for F2MC-FR Series:
Table of Contents

Advertisement

3.3 Reading an Interrupt Level

If the currently configured level of the peripheral can be read by reading out the
corresponding ICR.
/* THIS SAMPLE CODE IS PROVIDED AS IS AND IS SUBJECT TO ALTERATIONS. FUJITSU */
/* MICROELECTRONICS ACCEPTS NO RESPONSIBILITY OR LIABILITY FOR ANY ERRORS OR */
/* ELIGIBILITY FOR ANY PURPOSES.
/*
/*---------------------------------------------------------------------------*/
unsigned int
icr_rlt01;
void
readIrqLevel(void)
{
icr_rlt01 = ICR;
}

3.4 Interrupt Service Routine

The type qualifier __interrupt notifies the complier that the function has to be finished
with the RETI instruction. This function is always of the type of void and has no arguments.
Please note that the Interrupt flag should be always cleared in the interrupt service routine;
otherwise the service routine will be entered again after execution. Most of the resources
have a special Interrupt clear bit, but some have an auto-clear by accessing a special
register (e. g. UART read buffer).
The following code shows a typical Interrupt service routine.
/* THIS SAMPLE CODE IS PROVIDED AS IS AND IS SUBJECT TO ALTERATIONS. FUJITSU */
/* MICROELECTRONICS ACCEPTS NO RESPONSIBILITY OR LIABILITY FOR ANY ERRORS OR */
/* ELIGIBILITY FOR ANY PURPOSES.
/*
/*---------------------------------------------------------------------------*/
__interrupt
void
My_Interrupt_Service_Routine_1(void)
{
Resource_Interrupt_Clear_Bit = 0;
/* do something here */
}

3.5 Interrupt Service Routine without Register Saving

If the application requires that after entering certain interrupt service routine if the stack
should not be affected (by pushing CPU internal registers) then such ISR should be written
in assembly.

3.6 Setting global Interrupt Level

To set the global Interrupt Level via the ILM register, the language extension __set_il(n)
exists, where n is the global level. Please also see 2.5.1.1.
Assume the level 20 is desired. The following code shows how to access the ILM register
from C code.
MCU-AN-300055-E-V10
INTERRUPTS
Chapter 3 Interrupt Recommendations and Examples
(C) Fujitsu Microelectronics Europe GmbH
(C) Fujitsu Microelectronics Europe GmbH
/* clear Interrupt cause */
- 16 -
© Fujitsu Microelectronics Europe GmbH
*/
*/
*/
*/

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mb91460

Table of Contents