![](http://datasheet.mmic.net.cn/280000/M37540E8FP_datasheet_16083919/M37540E8FP_21.png)
SINGLE-CHIP 8-BIT CMOS MICROCOMPUTER
7540 Group
MITSUBISHI MICROCOMPUTERS
21
PRELIMINARY
Notice: This is not a final specification.
Some parametric limits are subject to change.
G
Timer Z
Timer Z is an 8-bit timer and can be selected in one of 4 operating
modes by setting the timer YZ mode register (TYZM).
Timer mode
Programmable waveform generation mode
Programmable one-shot generation mode
Programmable wait one-shot generation mode
The division ratio of timer Z and prescaler Z is 1/(n+1) provided that
the value of the timer Z latch or prescaler Z latch is n.
(1)Timer mode
Mode select
Timer mode is selected by setting timer Z operation mode bits
(b5,b4) of TYZM to “00”.
Count source select
The count source is f(X
IN
)/2, f(X
IN
)/16 or timer Y underflow.
Interrupt
When an underflow occurs, timer Z interrupt request bit (b1) of
IREQ2 is set to “1”.
Operation description
After reset release, timer Z is operating because the timer Z count
stop bit (b7) is “0”. Timer operation is stopped by setting b7 of
TYZM to “1”. In the timer mode, the timer count value is set by
timer Z primary latch (TZP). When a value is set to TZP while timer
is stopped, the setting value is written to latch and timer simulta-
neously.
When timer Z reaches “00”, an underflow occurs at the next count
pulse, and the timer Z latch is reloaded into the timer and count
continues. When timer value is changed during the count opera-
tion, either “writing to latch and timer simultaneously” or “writing to
only latch” can be selected by setting the timer Z write control bit
(b6) of TYZM. When selecting “writing to only latch”, the timer count
value is changed after the next underflow.
(2)Programmable waveform generation mode
Mode select
Timer mode is selected by setting timer Z operation mode bits
(b5,b4) of TYZM to “01”.
When this mode is selected, set timer Z write control bit (b6) of
TYZM to “1” (“writing to only latch” selected).
Count source select
The count source is f(X
IN
)/2, f(X
IN
)/16 or timer Y underflow.
Interrupt
When an underflow occurs, timer Z interrupt request bit (b1) of
IREQ is set to “1”.
Operation description
After reset release, timer Z is operating because the timer Z count
stop bit (b7) of TYZM is “0”. MCU operates in the programmable
waveform generation mode when timer Z operation mode bits (b5,
b4) of TYZM is set to “01” and b7 to “0” after timer Z operation is
stopped by setting b7 of TYZM to “1”.
In the programmable waveform generation mode, timer counts the
setting value of timer Z primary latch (TZP) and the setting value
of timer Z secondary latch (TZS) alternately, the waveform inverted
each time TZP and TZS underflow is output from TZ
OUT
pin. The
active edge of output waveform is set by the timer Z output level
latch (b5) of the timer Y, Z waveform output control register (PUM).
When “0” is set to b5 of PUM, the initial state of timer at stop is “L”,
and “H” interval by the setting value of TZP or “L” interval by the
setting value of TZS is output alternately. When “1” is set to b5 of
PUM, the initial state of timer at stop is “H”, and “L” interval by the
setting value of TZP or “H” interval by the setting value of TZS 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 Z primary wave-
form extension control bit (b2) and the timer Z secondary wave-
form extension control bit (b3) of PUM to “1”. As a result, the wave-
forms 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:
FTZOUT = (2
TMCL)/(2
(TZP + 1)+2
(TZS) + (EXPZP + EXPZS))
Duty:
DTZOUT = (2
(TZP + 1)) + EXPZP)/(2
(TZS+1) + EXPZS))
TMCL: Timer Z count clock f(X
IN
)/2 or f(X
IN
)/16
TZP: Timer Z primary latch (8 bits)
TZS: Timer Z secondary latch (8 bits)
EXPZP: Timer Z primary waveform extension control bit (1 bit)
EXPZS: Timer Z secondary waveform extension control bit (1 bit)
When using the programmable waveform generation mode, note
the following;
Notes on using the programmable waveform generation mode
When setting and changing TZP, TZS, EXPZP and EXPZS, write
to TZP at last because the setting to them is executed all at once
by writing to TZP. Even when TZP is not changed, write the same
value. The value is reloaded to timer at the beginning of the next
primary interval.
Set by software in order not to execute the writing to timer Z pri-
mary and the timing of timer underflow simultaneously. When read-
ing the timer Z secondary, the undefined value is read out. How-
ever, while timer counts the setting value of the timer Z secondary,
the count values at the secondary interval can be identified by
reading the timer Z primary.
In this mode, set port P0
2
which is also used as TZ
OUT
pin to out-
put.
B2 and b3 of PUM can be used only when “00
16
” is set to prescaler
Z and f(X
IN
)/2 or f(X
IN
)/16 is selected as the timer Z count source.