Panasonic MN101C00 Cell Phone User Manual


 
Chapter 4 Timer Functions
65
The period of a signal output to the
port is 1/2 of the period set in the
TM2OC register.
If port 1 is to be used as a pulse
output pin, it is necessary to set
the port 1 output direction control
register (P1DIR) and the port 1
pull-up/pull-down resistor control
register (P1PLU).
Timer Pulse Output Function (timers 2, 3)
Settings for the timer pulse output function are listed below. Timer 2 is used as an
example.
(1) Set the TM2EN flag of the timer 2 mode register (TM2MD) to "0" to stop the count
operation of timer 2.
(2) Set bit 2 of the port 1 output/input mode register (P1OMD) to "1" to set the special
function pin. Bit 2 of port 1 will be specified as the pulse output pin.
(3) Set the TM2CK2 to 0 flags of the TM2MD register to select fs, fs/4, fx, or
synchronized fx as the clock source.
(4) Set the TM2PWM flag of the TM2MD register to "0" so that normal timer operation
is selected.
(5) Set a value in compare register 2 (TM2OC).
(6) Set the TM2EN flag of the TM2MD register to "1" to start the timer.
(7) When timer 2 begins operation, binary counter 2 will count upward from X'00'.
(8) When the value of binary counter 2 matches that of the TM2OC register, the timer 2
interrupt request flag is set, and the binary counter 2 is reset to X'00' and begins to
count upward again.
Figure 4-2-3 Timer Pulse Output Timing
Binary counter
Matches compare register
TM2OUT
8-bit Timer Operation (timers 2, 3)