Panasonic F77G, MN101C77C user manual External interrupt IRQ 0 input Pulse width to be measured

Models: F77G MN101C77C

1 544
Download 544 pages 59.61 Kb
Page 297
Image 297

Chapter 7 16-bit Timer

7-9-2 Setup Example

„Capture Function Setup Example (Timer 7)

Pulse width measurement is enabled by storing the value of the binary counter to the capture register at the interrupt generation edge of the external interrupt 0 input signal with timer 7. The interrupt generation edge is specified to be the rising edge.

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

interruptinterrupt

External interrupt 0

IRQ 0 input

Pulse width to be measured

Figure 7-9-3 Pulse Width Measurement of External Interrupt 0

 

Setup Procedure

 

 

Description

 

 

 

 

 

(1)

Stop the counter.

 

(1)

Set the TM7EN flag of the timer 7 mode

 

TM7MD1 (x'3F78')

 

 

register 1 (TM7MD1) to "0" to stop timer 7

 

bp4

: TM7EN

= 0

 

counting.

(2)

Select the condition for timer clear.

(2)

Set the TM7BCR flag of the timer 7 mode

 

TM7MD2 (x'3F79')

 

 

register 2 (TM7MD2) to "1" to select the

 

bp5

: TM7BCR

= 1

 

compare match as a clear source of binary

 

 

 

 

 

counter.

(3)

Select the count clock source.

(3)

Select fosc as clock source by the TM7CK1-0

 

TM7MD1 (x'3F78')

 

 

flag of the TM7MD1 register. And select 1/1

 

bp1-0

: TM7CK1-0 = 00

 

(no dividing) of fosc as count clock source by

 

bp3-2

: TM7PS1-0 = 00

 

the TM7PS1-0 flag.

(4)

Select the capture trigger generation

(4)

Select the external interrupt 0 (IRQ0) input as

 

interrupt source.

 

 

a generation source of capture trigger by the

 

TM7MD2 (x'3F79')

 

 

T7ICT1-0 flag of the TM7MD2 register.

 

bp1-0

: T7ICT1-0

= 00

 

 

(5)

Select the interrupt generation valid

(5)

Set the REDG0 flag of the external interrupt 0

 

edge.

 

 

 

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

 

IRQ0ICR (x'3FE2')

 

 

rising edge as the interrupt generation valid

 

bp5

: REDG0

= 1

 

edge.

 

 

 

 

 

 

16-bit Timer Capture VII - 37

Page 297
Image 297
Panasonic F77G External interrupt IRQ 0 input Pulse width to be measured, Pulse Width Measurement of External Interrupt