Fujitsu ALL Series Application Note page 12

16-bit microcontroller
Table of Contents

Advertisement

/* 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.
/*
/*---------------------------------------------------------------------------*/
#define
TRUE
#define
FALSE
volatile
unsigned char
void
InitExtInt0(void)
{
ADER2 = 0x00;
PIER07_IE0 = 1;
ELVRL0_LB0 = 1;
ELVRL0_LA0 = 0;
EIRR0_ER0 = 0;
ENIR0_EN0 = 1;
}
void
InitRLT0(void)
{
TMRLR0 = 0xFFFF;
TMCSR0 = 0x0800;
}
void
main(void)
{
. . .
InitRLT0();
InitExtInt0();
. . .
while
(1);
}
__interrupt
void
{
EIRR0_ER0 = 0;
if
(FLAG == TRUE)
{
ENIR0_EN0 = 0;
TMCSR0_UF = 0;
TMCSR0_TRG = 1;
TMCSR0_INTE = 1;
}
else
{
FLAG = TRUE;
if
(1 ==
{
}
}
}
__interrupt
void
{
TMCSR0_UF = 0;
TMCSR0_INTE = 0;
ENIR0_EN0 = 1;
FLAG = FALSE;
}
MCU-AN -300203-E-V17
EXTERNAL INTERRUPTS
Chapter 4 External Interrupt Examples
(C) Fujitsu Microelectronics Europe GmbH
1
0
FLAG = TRUE;
// Port function
// enable Port 07_0 input
// LB0, LA0 = 10 -> Rising edge
// reset interrupt request
// enable interrupt request
// Reload value (about 0.26 s @ 16 MHz)
// Prescaler 1:64
// initialize RLT0
// initialize EXT0
IRQHandler_EI0(void)
// clear interrupt request
// disable interrupt request, Figure 3-1:(A)
// clear Reload Timer 0
// trigger Reload Timer 0
// enable Reload Timer 0 interrupt
// for next key press
EPSR07_PS0)// key still pressed?
// valid key press, take required action
IRQHandler_RLT0(void)
// clear Reload Timer 0
// disable Reload Timer 0 interrupt
// enable External Interrupt request again,
// Figure 3-1:(B)
- 12 -
© Fujitsu Microelectronics Europe GmbH
*/
*/

Advertisement

Table of Contents
loading

This manual is also suitable for:

F2mc-16fx family

Table of Contents