Disturbed Signals; Figure 4-1: Interrupt Timing - Disturbed Input Signal - Fujitsu ALL Series Application Note

16-bit microcontroller
Table of Contents

Advertisement

4.2 Disturbed Signals

If signal on an External Interrupt input pin is disturbed (such as from a bouncing switch), it is
recommended to use edge detection instead of level sensitivity. Also, if the bouncing of the
switch needs to be taken care in the software (i.e. the optional capacitor as shown the Figure
2-2 is not used), then the external interrupt service routine should disable the interrupt for a
time slot greater than the bouncing time. This can be done by a further interrupt using a
timer (e.g. Reload Timer 0).
External
Interrupt
Input
Interrupt
Enable
This mechanism prevents the application from multiple unwanted interrupts during "bouncing
time". The same is accomplished using the software for the External Interrupt Channel 0 of
the MB96340 Series in the example on the next page.
In the below example, at the first rising edge of the signal at External Interrupt input pin
INT0, the interrupt service routine IRQHandler_EI0() will be executed and since the initial
value of FLAG variable is TRUE, the Reload Timer RLT0 will be started (A in the above
figure) and no further processing would happen.
After 0.26 seconds (debouncing time, this can be chosen depending upon the type of
key/switch) the interrupt service routine IRQHandle_RLT0() will be executed and it will
enable External Interrupt request again and make value of FLAG variable FALSE. Now by
this time (B in the above figure) since there are multiple edges already appeared at pin INT0,
again interrupt service routine IRQHandler_EI0() will be executed. Within this interrupt
service routine value of FLAG variable will be made TRUE for the next key press and then the
user can do the desired processing considering a "valid" key press, if the key is still pressed
(i.e. if EPSR07_PS0 =1).
It should be noted that the above mentioned logic would work properly only when the key
bounces a few times before settling at a position after a key press.
MCU-AN -300203-E-V17
EXTERNAL INTERRUPTS
Chapter 4 External Interrupt Examples
ISR disables Interrupt after edge detection (A)
Figure 4-1: Interrupt Timing – Disturbed Input Signal
- 10 -
Interrupts are enabled again by Timer (B)
© Fujitsu Microelectronics Europe GmbH

Advertisement

Table of Contents
loading

This manual is also suitable for:

F2mc-16fx family

Table of Contents