External Interrupt Examples; Basic Functionality - Fujitsu ALL Series Application Note

16-bit microcontroller
Table of Contents

Advertisement

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.
/* 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.
/*
/*---------------------------------------------------------------------------*/
void
InitExtInt0(void)
{
ADER2 = 0x00;
PIER07_IE0 = 1;
ELVRL0_LB0 = 0;
ELVRL0_LA0 = 0;
EIRR0_ER0 = 0;
ENIR0_EN0 = 1;
}
. . .
__interrupt
void
IRQHandler_EI0 (void)
{
EIRR0_ER0 = 0;
. . .
}
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.
/*
/*---------------------------------------------------------------------------*/
void
InitIrqLevels(void)
{
. . .
ICR = ((17 & 0xFF) << 8) | 6;
}
. . .
__interrupt
void
IRQHandler_EI0 (void);
. . .
#pragma
intvect IRQHandler_EI0
© Fujitsu Microelectronics Europe GmbH
EXTERNAL INTERRUPTS
Chapter 4 External Interrupt Examples
(C) Fujitsu Microelectronics Europe GmbH
// Port function
// Enable Port 07_0 input
// LB0, LA0 = 00 -> low level
// reset interrupt request
// enable interrupt request
// clear interrupt request
(C) Fujitsu Microelectronics Europe GmbH
17
// Priority Level 6 for External
// Interrupt 0 of MB96340 Series
// Prototype
// EXT0 of MB96340 Series
- 9 -
*/
*/
*/
*/
MCU-AN -300203-E-V17

Advertisement

Table of Contents
loading

This manual is also suitable for:

F2mc-16fx family

Table of Contents