English
Language : 

4559 Datasheet, PDF (35/148 Pages) Renesas Technology Corp – SINGLE-CHIP 4-BIT CMOS MICROCOMPUTER
4559 Group
(1) Timer control registers
• Timer control register PA
Register PA controls the count operation of prescaler. Set the
contents of this register through register A with the TPAA
instruction.
• Timer control register W1
Register W1 controls the count operation and count source of
timer 1, and timer 1 count auto-stop circuit. Set the contents of
this register through register A with the TW1A instruction.
The TAW1 instruction can be used to transfer the contents of
register W1 to register A.
• Timer control register W2
Register W2 controls the count operation and count source of
timer 2, CNTR pin output, and extension function of PWM
signal “H” interval. Set the contents of this register through
register A with the TW2A instruction. The TAW2 instruction
can be used to transfer the contents of register W2 to register
A.
• Timer control register W3
Register W3 controls the count operation and count source of
timer 3. Set the contents of this register through register A with
the TW3A instruction. The TAW3 instruction can be used to
transfer the contents of register W3 to register A.
• Timer control register W4
Register W4 controls the input count edge of CNTR pin,
CNTR1 pin output auto-control circuit. Set the contents of this
register through register A with the TW4A instruction. The
TAW4 instruction can be used to transfer the contents of
register W4 to register A.
(2) Prescaler
Prescaler is an 8-bit binary down counter with the prescaler
reload register PRS. Data can be set simultaneously in prescaler
and the reload register RPS with the TPSAB instruction. Data
can be read from reload register RPS with the TABPS
instruction.
Stop counting and then execute the TPSAB or TABPS
instruction to read or set prescaler data.
Prescaler starts counting after the following process;
(1) set data in prescaler, and
(2) set the bit 0 of register PA to “1.”
When a value set in reload register RPS is n, prescaler divides the
count source signal by n + 1 (n = 0 to 255).
Count source for prescaler can be selected the instruction clock
(INSTCK).
Once count is started, when prescaler underflows (the next count
pulse is input after the contents of prescaler becomes “0”), new
data is loaded from reload register RPS, and count continues
(auto-reload function).
The output signal (ORCLK) of prescaler can be used for timer 1,
2 and 3 count sources.
(3) Timer 1 (interrupt function)
Timer 1 is an 8-bit binary down counter with a timer 1 reload
register (R1). Data can be set simultaneously in timer 1 and the
reload register R1 with the T1AB instruction. Data can be read
from timer 1 with the TAB1 instruction.
Stop counting and then execute the T1AB or TAB1 instruction to
read or set timer 1 data.
When executing the TR1AB instruction to set data to reload
register R1 while timer 1 is operating, avoid a timing when timer
1 underflows.
Timer 1 starts counting after the following process;
(1) set data in timer 1
(2) set count source by bit 0 and 1 of register W1, and
(3) set the bit 2 of register W1 to “1.”
When a value set in reload register R1 is n, timer 1 divides the
count source signal by n + 1 (n = 0 to 255).
Once count is started, when timer 1 underflows (the next count
pulse is input after the contents of timer 1 becomes “0”), the
timer 1 interrupt request flag (T1F) is set to “1,” new data is
loaded from reload register R1, and count continues (auto-reload
function).
INT pin input can be used as the start trigger for timer 1 count
operation by setting the bit 0 of register I1 to “1”.
Also, in this time, the auto-stop function by timer 1 underflow
can be performed by setting the bit 3 of register W1 to “1.”
(4) Timer 2 (interrupt function)
Timer 2 is an 8-bit binary down counter with two timer 2 reload
register (R2L, R2H). Data can be set simultaneously in timer 2
and the reload register R2L with the T2AB instruction. Data can
be set in the reload register R2H with the T2HAB instruction.
The contents of reload register R2L set with the T2AB
instruction can be set to timer 2 again with the T2R2L
instruction. Data can be read from timer 2 with the TAB2
instruction.
Stop counting and then execute the T2AB or TAB2 instruction to
read or set timer 2 data.
When executing the T2HAB instruction to set data to reload
register R2H while timer 2 is operating, avoid a timing when
timer 2 underflows.
Timer 2 starts counting after the following process;
(1) set data in timer 2
(2) set count source by bit 0 of register W2, and
(3) set the bit 1 of register W2 to “1.”
When a value set in reload register R2L is n and R2H is m, timer
2 divides the count source signal by n + 1 or m + 1 (n = 0 to 255,
m = 0 to 255).
Once count is started, when timer 2 underflows (the next count
pulse is input after the contents of timer 2 becomes “0”), the
timer 2 interrupt request flag (T2F) is set to “1,” new data is
loaded from reload register R2L, and count continues (auto-
reload function).
When bit 3 of register W2 is set to “1”, timer 2 reloads data from
reload register R2L and R2H alternately each underflow.
Timer 2 generates the PWM signal (PWMOUT) of the “L”
interval set as reload register R2L, and the “H” interval set as
reload registerR2H. The PWM signal (PWMOUT) is output
from CNTR pin. When bit 2 of register W2 is set to “1” at this
time, the interval (PWM signal “H” interval) set to reload
register R2H for the counter of timer 2 is extended for a half
period of count source.
In this case, when a value set in reload register R2H is m, timer 2
divides the count source signal by n + 1.5 (m = 1 to 255).
When this function is used, set “1” or more to reload register
R2H.
Rev.1.04 Aug 23, 2007 Page 35 of 146
REJ03B0188-0104