Panasonic F77G, MN101C77C REDG0, Interrupt active edge to the rising edge, NF0EN, IRQ0IE

Models: F77G MN101C77C

1 544
Download 544 pages 59.61 Kb
Page 147
Image 147

Chapter 3 Interrupts

Noise Filter Setup Example (External interrupt 0 and 1)

Noise remove function is added to the input signal from P20 pin to generate the external interrupt 0 (IRQ0) at the rising edge. The sampling clock is set to fosc, and the operation state is fosc = 20 MHz. An example setup procedure, with a description of each step is shown below.

 

Setup Procedure

 

 

Description

 

 

 

 

(1)

Specify the interrupt active edge.

(1)

Set the REDG0 flag of the external interrupt 0

 

IRQ0ICR (x'3FE2')

 

 

control register (IRQ0ICR) to "1" to specify the

 

bp5

: REDG0

= 1

 

interrupt active edge to the rising edge.

(2)

Select the sampling clock.

 

(2)

Select the sampling clock to fosc by the

 

NFCTR0 (x'3F8E')

 

 

NF0SCK 1-0 flag of the noise filter control

 

bp2-1

: NF0SCK1-0 = 00

 

register (NFCTR0).

(3)

Set the noise filter operation.

(3)

Set the NF0EN flag of the NFCTR0 register to

 

NFCTR0 (x'3F8E')

 

 

"1" to add the noise filter operation.

 

bp0

: NF0EN

= 1

 

 

(4)

Set the interrupt level.

 

(4)

Set the interrupt level by the IRQ0LV 1- 0 flag of

 

IRQ0ICR (x'3FE2')

 

 

the IRQ0ICR register.

 

bp7-6

: IRQ0LV1-0= 10

 

 

 

 

 

 

 

If the interrupt request flag has been already

 

 

 

 

 

set, clear the request flag.

 

 

 

 

[

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

(5)

Enable the interrupt.

 

(5)

Set the IRQ0IE flag of the IRQ0ICR register to

 

IRQ0ICR (x'3FE2')

 

 

"1" to enable the interrupt.

 

bp1

: IRQ0IE

= 1

 

 

 

 

 

 

 

 

Note : The above (2) and (3) are set at the same time.

The input signal from the P20 pin generates the external interrupt 0 at the rising edge of the signal, after passing through the noise filter.

The setup of the noise filter should be done before the interrupt is enabled.

The external interrupt pins are recommended to be pull-up in advance.

External Interrupts

III - 53

Page 147
Image 147
Panasonic F77G, MN101C77C user manual REDG0, Interrupt active edge to the rising edge, NF0EN, IRQ0IE