Panasonic MN101C77C, F77G user manual T7ICEDG, T7ICEN

Models: F77G MN101C77C

1 544
Download 544 pages 59.61 Kb
Page 298
Image 298

Chapter 7 16-bit Timer

Setup Procedure

 

 

 

Description

 

 

 

(6) Select the capture trigger generation

(6)

Set the T7ICEDG flag of the TM7MD2 register

edge.

 

 

 

to "1" to select the external interrupt valid edge

TM7MD2 (x'3F79')

 

 

as a generation source of capture trigger.

bp7

: T7ICEDG

= 1

 

 

 

(7) Set the compare register.

 

(7)

Set the timer 7 preset register 1 (TM7PR1) to

TM7PR1(x'3F75',x'3F74') = x'FFFF'

 

x'FFFF'. At that time, the same value is loaded

 

 

 

 

to the timer 7 compare register 1 (TM7OC1),

 

 

 

 

and the timer 7 binary counter (TM7BC) is

 

 

 

 

initialized to x'0000'.

(8) Set the interrupt level.

 

(8) Set the interrupt level by the IRQ0LV1-0 flag of

IRQ0ICR (x'3FE2')

 

 

the IRQ0ICR register. If any interrupt request

bp7-6

: IRQ0LV1-0= 10

 

flag may be set already, clear them.

 

 

 

 

[

Chapter 3 3-1-4. Interrupt Flag Setup ]

(9) Enable the interrupt.

 

(9)

Enable the interrupt by setting the IRQ0IE flag

IRQ0ICR (x'3FE2')

 

 

of the IRQ0ICR register to "1".

bp1

: IRQ0IE

= 1

 

 

 

(10) Enable the capture trigger

 

(10)

Enable the capture trigger generation by

generation.

 

 

 

setting the T7ICEN flag of the TM7MD2

TM7MD2 (x'3F79')

 

 

register to "1".

bp2

: T7ICEN

= 1

 

 

 

(11) Start the timer operation.

 

(11)

Set the TM7EN flag of the TM7MD1 register to

TM7MD1 (x'3F78')

 

 

"1" to start timer 7.

bp4

: TM7EN

= 1

 

 

 

 

 

 

 

 

 

TM7BC counts up from x'0000'. At the timing of the rising edge of the external interrupt 0 input signal, the value of TM7BC is stored to the TM7IC register. And at that time, the pulse width between rising edges of the external interrupt input signal can be measured by reading the value of TM7IC register by the interrupt service routine, and by calculating the margin of the capture values (the values of the TM7IC register).

VII - 38 16-bit Timer Capture

Page 298
Image 298
Panasonic MN101C77C, F77G user manual T7ICEDG, T7ICEN