Chapter 6 8-bit Timers
VI - 38
Simple Pulse Width Measurement
TM0BC starts to count up with negative edge of the external interrupt 2 (IRQ2) input as a trigger.
Timer 0 continues to count up during "L" period of IRQ2 input, then stop the counting with positive
edge of IRQ2 input as a trigger. At the same time, reading the value of TM0BC by interrupt handling
can detects "L" period.
(7) Set the IRQ2IE flag of the IRQ2ICR register to
"1" to enable the interrupt.
(8) Set the TM0EN flag of the TM0MD register to
"1" to enable timer 0 operation.
Setup Procedure
Description
(7) Enable the interrupt.
IRQ2ICR (x'3FE4')
bp1 :IRQ2IE = 1
(8) Enable the timer operation.
TM0MD (x'3F54')
bp3 :TM0EN = 1