Timer A1
Mitsubishi microcomputers
M16C / 62A Group (80-pin)
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
78
(4) Pulse width modulation (PWM) mode
In this mode, the timer outputs pulses of a given width in succession. (See Table 1.13.5.) In this mode, the
counter functions as either a 16-bit pulse width modulator or an 8-bit pulse width modulator. Timer A1
and A2 have no output pin, so it doesn't work in this mode. Figure 1.13.11 shows the timer Ai mode
register in pulse width modulation mode. Figure 1.13.12 shows the example of how a 16-bit pulse width
modulator operates. Figure 1.13.13 shows the example of how an 8-bit pulse width modulator operates.
Figure 1.13.11. Timer Ai mode register in pulse width modulation mode
Table 1.13.5. Timer specifications in pulse width modulation mode
Item
Count source
f
1
, f
8
, f
32
, f
C32
Count operation
T
he timer counts down (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
16-bit PWM
High level width
n / fi
Cycle time
(2
16
-1) / fi fixed
8-bit PWM
High level width
n (m+1) / fi
Cycle time
(2
8
-
1) (m+1) / fi
Count start condition
External trigger is input
The timer overflows
The count start flag is set (= 1)
Count stop condition
The count start flag is reset (= 0)
Interrupt request generation timing
PWM pulse goes “L”
TAi
IN
pin function
Programmable I/O port or trigger input
TAi
OUT
pin function
Pulse output
Read from timer
When timer Ai register is read, it indicates an indeterminate value
Write to timer
When counting stopped
When a value is written to timer Ai register, it is written to both reload
register and counter
When counting in progress
When a value is written to timer Ai register, it is written to only reload register
(Transferred to counter at next reload time)
Note: Timer A1 and A2 do not have I/O port (TAi
IN
and TAi
OUT
).
Bit name
Timer Ai mode register
Symbol
TAiMR(i=0 to 4)
Address
When reset
00
16
0396
16
to 039A
16
Function
Bit symbol
TMOD0
b7
b6
b5
b4
b3
b2
1
b1
1
b0
1
Operation mode
select bit
1 1 : PWM mode
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 (Must always be “1” in PWM mode)
External trigger select
bit (Note 1,3)
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: Falling edge of TAi
IN
pin's input signal (Note 2)
1: Rising edge of TAi
IN
pin's input signal (Note 2)
0: Count start flag is valid
1: Selected by event/trigger select register
Note 1: Valid only when the TA
iIN
pin is selected by the event/trigger select bit
(addresses 0382
16
and 0383
16
). If timer overflow is selected, this bit can be “1” or “0”.
Note 2: Set the corresponding port direction register to “0”.
Note 3: Set these bits "0" in timer A1 and A2 mode registers.
AA
AA
AA
AA
AA
AA
AA
AA
AA
(Note 3)
Specification
n : Set value
n : values set to timer Ai register’s high-order address
m : values set to timer Ai register’s low-order address