Chapter 4 Timer Functions
68
The clock source for the serial
interface has a frequency that is
1/2 of the overflow output of timer
3.
For serial interface settings, refer
to the chapter on serial functions.
Disable the timer 2 interrupt.
■ Serial Transfer Clock Function(timer 3)
Settings for the serial transfer clock function are listed below.
(1) Set the TM3EN flag of the timer 3 mode register (TM3MD) to "0" to stop the count
operation of timer 3.
(2) Set the SC0CK1 and SC0CK0 flags of the serial interface 0 mode register 1
(SC0MD1) to select 1/2 of the timer 3 overflow frequency as the clock source.
(3) Set the TM3CK2 to 0 flags of the TM3MD register to select fosc, fs, fs/4, or fs/16 as
the clock source.
(4) Set the TM3PWM flag of the TM3MD register to "0" to select timer 3 output.
(5) Set a value in compare register 3 (TM3OC).
(6) Set the TM3EN flag of the TM3MD register to "1" to start the timer.
(7) When timer 3 begins operation, binary counter 3 counts upward from X'00'.
(8) When the value of binary counter 3 matches that of the TM3OC register, the timer 3
interrupt request flag is set, the value of binary counter 3 is reset to X'00', and
counting begins again.
■ Cascade Connection Function (timer 2 + timer 3)
Settings for the cascade connection function are listed below. Timer 2 and timer 3
are connected to operate as a 16-bit timer.
(1) Set the TM2EN flag of the timer 2 mode register (TM2MD) to "0" to stop the count
operation of timer 2.
(2) Set the TM3EN flag of the timer 3 mode register (TM3MD) to "0" to stop the count
operation of timer 3.
(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) Use the TM3CK2 to 0 flags of the TM3MD register to set the clock source as a
cascade connection with timer 2.
(5) Set the TM2PWM flag of the TM2MD register to "0" to select normal timer
operation.
(6) Set values in compare register 2 (TM2OC) and compare register 3 (TM3OC).
(7) Set the TM2EN flag of the TM2MD register to "1" to start the timer.
(8) Set the TM3EN flag of the TM3MD register to "1" to start the timer.
(9) When timers 2 and 3 begin operation, the binary counters begin counting upward
from X'0000' as a 16-bit counter.
(10) When the value of the 16-bit binary counter matches that of the 16-bit register
(TM3OC+TM2OC), the timer 3 interrupt request flag is set, the value of the 16-bit
binary counter is reset to X'0000', and counting begins again.
Use a 16-bit access instruction to set the (TM3OC+TM2OC) register.
8-bit Timer Operation (timers 2, 3)