Example Ii - Fujitsu ALL Series Application Note

16-bit microcontroller
Table of Contents

Advertisement

4.3.2 Example II

The following example shows to request a stop mode and to wake the MCU up from this
mode using External Interrupt 0. After the MCU is in stop mode, if the falling edge appears at
External Interrupt 0 pin, then the MCU wakes up and continues executing the program.
There is no need to have an interrupt service routine in this case.
/* 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.
/*
/*---------------------------------------------------------------------------*/
// Initialise external int 0
void
Init_extint0 (void)
{
ADER2_ADE16 = 0;
PIER07_IE0 = 1;
ENIR0_EN0 = 0;
ELVR0_LA0 = 1;
ELVR0_LB0 = 1;
EIRR0_ER0 = 0;
}
// Request stop mode
void
Request_stop (void)
{
__DI();
EIRR0_ER0 = 0;
ENIR0_EN0 = 1;
SMCR = 0x03;
EIRR0_ER0 = 0;
__EI();
}
void
main (void)
{
InitIrqLevels();
__set_il(7);
__EI();
Init_extint0();
Request_stop()
. . .
. . .
}
© Fujitsu Microelectronics Europe GmbH
EXTERNAL INTERRUPTS
Chapter 4 External Interrupt Examples
(C) Fujitsu Microelectronics Europe GmbH
// select IO mode
// disable ext int 0
// LB0,LA0 = 11 -> falling edge
// clear ext. int 0 request flag
// globally disable interrupts
// clear ext. int 0 request flag
// enable ext int 0
// goto stop mode
// clear ext. int 0 request flag after wakeup
// globally disable interrupts
// allow all levels
// globally enable interrupt
- 17 -
*/
*/
MCU-AN -300203-E-V17

Advertisement

Table of Contents
loading

This manual is also suitable for:

F2mc-16fx family

Table of Contents