Rev.3.20 2003.05.28 page 26 of 83
7540 Group
PRELIMINARY
Notice: This is not a final specification.
Some parametric limits are subject to change.
●Timer Y
Timer Y is an 8-bit timer and counts the prescaler Y output.
When Timer Y underflows, the timer Y interrupt request bit is set to
“1”.
Prescaler Y is an 8-bit prescaler and counts the signal selected by
the timer Y count source selection bit.
Prescaler Y has the prescaler Y latch to retain the reload value.
Timer Y has the timer Y primary latch and timer Y secondary latch
to retain the reload value.
The value of prescaler Y latch is set to Prescaler Y when
Prescaler Y underflows.The value of timer Y primary latch or timer
Y secondary latch are set to Timer Y when Timer Y underflows.
As for the value to transfer to Timer Y, either of timer Y primary or
timer Y secondary is selected depending on the timer Y operating
mode.
When writing to Prescaler Y (PREY), timer Y primary (TYP) or
timer Y secondary (TYS) is executed, writing to “latch only” or
“latch and prescaler (timer)” can be selected by the setting value
of the timer Y write control bit. Be sure to set the timer Y write con-
trol bit because there are some notes according to the operating
mode.
When reading from Prescaler Y (PREY) is executed, the count
value of Prescaler Y is read out. When reading from timer Y pri-
mary (TYP) is executed, the count value of Timer Y is read out.
The count value of Timer Y can be read out by reading from the
timer Y primary (TYP) even when the value of timer Y primary
latch or timer Y secondary latch is counted. When reading the
timer Y secondary (TYS) is executed, the undefined value is read
out.
Timer Y can be selected in one of 2 operating modes by setting
the timer Y operating mode bits of the timer Y, Z mode register.
(1) Timer mode
Prescaler Y counts the count source selected by the timer Y count
source selection bits. Each time the count clock is input, the con-
tents of Prescaler Y is decremented by 1. When the contents of
Prescaler Y reach “0016”, an underflow occurs at the next count
clock, and the prescaler Y latch is reloaded into Prescaler Y. The
division ratio of Prescaler Y is 1/(n+1) provided that the value of
Prescaler Y is n.
The contents of Timer Y is decremented by 1 each time the under-
flow signal of Prescaler Y is input. When the contents of Timer Y
reach “0016”, an underflow occurs at the next count clock, and the
timer Y primary latch is reloaded into Timer Y and count continues.
(In the timer mode, the contents of timer Y primary latch is
counted. Timer Y secondary latch is not used in this mode.)
The division ratio of Timer Y is 1/(m+1) provided that the value of
Timer Y is m. Accordingly, the division ratio of Prescaler Y and
Timer Y is 1/((n+1)✕(m+1)) provided that the value of Prescaler Y
is n and the value of Timer Y is m.
In the timer mode, writing to “latch only” or “latches and Prescaler
Y and timer Y primary” can be selected by the setting value of the
timer Y write control bit.
(2) Programmable waveform generation mode
In the programmable waveform generation mode, timer counts the
setting value of timer Y primary and the setting value of timer Y
secondary alternately, the waveform inverted each time Timer Y
underflows is output from TYOUT pin.
When using this mode, be sure to set “1” to the timer Y write con-
trol bit to select “write to latch only”. Also, set the port P01 direction
registers to output mode.
The active edge of output waveform is set by the timer Y output
level latch (b5) of the timer Y, Z waveform output control register
(PUM). When “0” is set to b5 of PUM, “H” interval by the setting
value of TYP or “L” interval by the setting value of TYS is output
alternately. When “1” is set to b5 of PUM, “L” interval by the setting
value of TYP or “H” interval by the setting value of TYS is output
alternately.
Also, in this mode, the primary interval and the secondary interval
of the output waveform can be extended respectively for 0.5 cycle
of timer count source clock by setting the timer Y primary wave-
form extension control bit (b2) and the timer Y secondary
waveform extension control bit (b3) of PUM to “1”. As a result, the
waveforms of more accurate resolution can be output.
When b2 and b3 of PUM are used, the frequency and duty of the
output waveform are as follows;
Waveform frequency:
FYOUT=
Duty:
DYOUT=
TMYCL: Timer Y count source (frequency)
TYP: Timer Y primary (8bit)
TYS: Timer Y secondary (8bit)
EXPYP: Timer Y primary waveform extension control bit (1bit)
EXPYS: Timer Y secondary waveform extension control bit (1bit)
In the programmable waveform generation mode, when values of
the TYP, TYS, EXPYP and EXPYS are changed, the output wave-
form is changed at the beginning (timer Y primary waveform
interval) of waveform period.
When the count values are changed, set values to the TYS,
EXPYP and EXPYS first. After then, set the value to TYP. The val-
ues are set all at once at the beginning of the next waveform
period when the value is set to TYP. (When writing at timer stop is
executed, writing to TYP at last is required.)
Notes on programmable waveform generation mode is described
below;
2✕TMYCL
2✕(TYP+1)+2✕(TYS+1)+(EXPYP+EXPYS)
2✕(TYP+1)+EXPYP
(2✕(TYP+1)+EXPYP)+(2✕(TYS+1)+EXPYS)