3-5 both edges interrupt – Panasonic MN101C77C User Manual

Page 142

Advertising
background image

Chapter 3 Interrupts

III - 48

External Interrupts

3-3-5

Both Edges Interrupt

Both Edges Interrupt (External interrupts 0 to 4)

Both edges interrupt can generate interrupt at both the falling edge and the rising edge by the input signal

from external input pins. CPU also can be returned from standby mode by both edges interrupt.

Both Edges Interrupt Setup Example (External interrupts 0 to 4)

External interrupt 2 (IRQ2) is generated at the both edges of the input signal from P22 pin.

An example setup procedure, with a description of each step is shown below.

At the both edge of the input signal from P22 pin, an external interrupt 2 is generated .

(1)

Set the EDGSEL2 flag of the both edges

interrupt control register (EDGDT) to "1" to

select the both edges interrupt.

(2)

Set the interrupt level by the IRQ2LV1-0 flag of

the IRQ2ICR register.

(3)

Set the IRQ2IE flag of the IRQ2ICR register

to "1" to enable the interrupt.

Setup Procedure

(1)

Select the both edges interrupt.

EDGDT (x'3F8F')

bp2

: EDGSEL2 = 1

(2)

Set the interrupt level.

IRQ2ICR (x'3FE4')

bp7-6

: IRQ2LV1- 0 = 10

(3)

Enable the interrupt.

IRQ2ICR (x'3FE4')

bp1

: IRQ2IE

= 1

Description

[ Chapter 3 3-1-4 Interrupt flag setup ]

When the both edge interrupt is selected, the interrupt request generates at the both edge,

regardless of the REDGn flag of the external interrupt control register (IRQnICR).

The interrupt request flag may be set to "1" at switching the interrupt edge. So, clear the

interrupt request flag before the interrupt enable. Also, select the both edge interrupt before

the interrupt enable.

The external interrupt pin is recommended to be pull-up, in advance.

The interrupt request flag of the IRQ2ICR

register may be set, so make sure to clear the

interrupt request flag (IRQ2IR).

Advertising
This manual is related to the following products: