Unde
Timer X
deeopmen
Mitsubishi microcomputers
M30201 Group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
73
Item
Specification
f
1
, f
8
, f
32
, f
C32
Down counts (operating as an 8-bit or a 16-bit pulse width modulator)
The timer reloads a new count at a rising edge of PWM pulse and continues counting
The timer is not affected by a trigger that occurs when counting
"H" level width n / fi
Cycle time
(2
16
-1) / fi fixed
"H" level width n (m+1)/ fi n:values set to timer Xi register’s high-order address
Cycle time (2
8
-1) (m+1) / fi m : values set to timer Xi register’s low-order address
The timer overflows
The count start flag is set (= 1)
The count start flag is reset (= 0)
Set value of "H" level width is except FF
16
, 00
16
: PWM pulse goes “L”
Set value of "H" level width is FF
16
, 00
16
: Timing that count value goes to 01
16
Set value of "H" level width is except FFFF
16
, 0000
16
: PWM pulse goes “L”
Set value of "H" level width is FFFF
16
, 0000
16
: Timing that count value goes to 0001
16
Pulse output
When timer Xi register is read, it indicates an indeterminate value
When counting stopped
When a value is written to timer Xi register, it is written to both reload register and counter
When counting in progress
When a value is written to timer Xi register, it is written to only reload register
(Transferred to counter at next reload time)
n : Set value
(5) Pulse width modulation (PWM) mode
In this mode, the timer outputs pulses of a given width in succession. (See Table 1.25.) In this mode, the counter
functions as either a 16-bit pulse width modulator or an 8-bit pulse width modulator. Figure 1.66 shows the timer
Xi mode register in pulse width modulation mode. Figure 1.67 shows the example of how a 16-bit pulse width
modulator operates. Figure 1.68 shows the example of how an 8-bit pulse width modulator operates.
Figure 1.66. Timer Xi mode register in pulse width modulation mode
Table 1.25. Timer specifications in pulse width modulation mode
Bit name
Function
Bit symbol
TMOD0
Operation mode
select bit
b1 b0
TMOD1
MR0
MR2
MR1
MR3
0 0 : f
1
0 1 : f
8
1 0 : f
32
1 1 : f
C32
b7 b6
TCK1
TCK0
Count source select bit
W
R
1
1
1
1 (Must always be “1” in PWM mode)
16/8-bit PWM mode
select bit
0: Functions as a 16-bit pulse width modulator
1: Functions as an 8-bit pulse width modulator
Trigger select bit
0: Count start flag is valid
1: Selected by event/trigger select register
Note 1: TXi
INOUT
pin inout cannot be selected by the event/trigger select bit(addresses 0383
16
).
Note 2: Set the corresponding port direction register to “1” (output mode).
AA
AA
AA
AA
AA
A
A
AA
A
A
Timer Xi mode register
b7 b6
b5
b4
b3
Symbol
TXiMR(i = 0 to 2) 0397
16
to 0399
16
Address
When reset
00
16
b2
b1 b0
Invalid in PWM mode. Can be “0” or “1”.
(Note 1)
Count source
Count operation
16-bit PWM
8-bit PWM
Count start condition
Count stop condition
Interrupt
request
generation
timing
8 bits PWM
16 bits PWM
TXi
INOUT
pin function
Read from timer
Write to timer
Note: When set value of "H" level width is 00
16
or 0000
16
, pulse outputs "L" level and inversion value, FF
16
or FFFF
16
is set to timer.