Panasonic MN101C00 User Manual
Page 86

Chapter 4 Timer Functions
72
■ Timer Pulse Output Function
Settings for the timer pulse output function are listed below.
(1)
Set the TM4EN flag of the timer 4 mode register (TM4MD) to "0" so that the count
operation of timer 4 is stopped.
(2)
Set bit 4 of the port 1 output/input mode register (P1OMD) to the special
function pin setting. Bit 4 of port 1 will be specified as the pulse output pin.
(3)
Use the TM4CK2 to 0 flags of the TM4MD register to select fosc, fs/4, or fs/16 as the
clock source.
(4)
Set the TM4PWM flag of the TM4MD register to "0" so that 16-bit timer operation
is selected.
(5)
Set a value in compare register 4 (TM4OCH, TM4OCL).
(6)
Set the TM4EN flag of the TM4MD register to "1" to start the timer.
(7)
When timer 4 begins operation, binary counter 4 will count upward from X'0000'.
(8)
When the value of binary counter 4 matches that of the TM4OCH and TM4OCL
registers, the timer 4 interrupt request flag is set, and the binary counter 4 is reset to
X'0000' and begins to count upward again.
Figure 4-3-3 Timer Pulse Output Timing
The period of the output signal
from the port is 1/2 of the period
set in the TM4OCH, TM4OCL
register.
Binary
counter 4
Matches TM4OCH, TM4OCL register
TM4OUT
16-bit Timer Operation (timer 4)