EasyManua.ls Logo

Fujitsu ALL Series - External Interrupt Examples; Basic Functionality Example

Fujitsu ALL Series
20 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
EXTERNAL INTERRUPTS
Chapter 4 External Interrupt Examples
© Fujitsu Microelectronics Europe GmbH - 9 - MCU-AN -300203-E-V17
4 External Interrupt Examples
EXAMPLES FOR EXTERNAL INTERRUPTS
4.1 Basic Functionality
The following example shows how to set up the External Interrupt Channel 0 of the
MB96340 Series.
Please note, that the corresponding interrupt vector and level has to be defined in the
vectors.c module of our standard template project.
/* 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. */
/* (C) Fujitsu Microelectronics Europe GmbH */
/*---------------------------------------------------------------------------*/
void InitIrqLevels(void)
{
. . .
ICR = ((17 & 0xFF) << 8) | 6; // Priority Level 6 for External
// Interrupt 0 of MB96340 Series
}
. . .
__interrupt void IRQHandler_EI0 (void); // Prototype
. . .
#pragma intvect IRQHandler_EI0 17 // EXT0 of MB96340 Series
/* 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. */
/* (C) Fujitsu Microelectronics Europe GmbH */
/*---------------------------------------------------------------------------*/
void InitExtInt0(void)
{
ADER2 = 0x00; // Port function
PIER07_IE0 = 1; // Enable Port 07_0 input
ELVRL0_LB0 = 0; // LB0, LA0 = 00 -> low level
ELVRL0_LA0 = 0;
EIRR0_ER0 = 0; // reset interrupt request
ENIR0_EN0 = 1; // enable interrupt request
}
. . .
__interrupt void IRQHandler_EI0 (void)
{
EIRR0_ER0 = 0; // clear interrupt request
. . .
}