
CHAPTER 9 8-BIT TIMERS H0 AND H1
User
’
s Manual U15862EJ3V0UD
380
<3>
After the count operation is enabled, the first compare register to be compared is the CMPn0 register.
When the count value of 8-bit timer counter Hn and the value of the CMPn0 register match, 8-bit timer
counter Hn is cleared, an interrupt request signal (INTTMHn) is generated, and the TOHn output
becomes active. At the same time, the register that is compared with 8-bit timer counter Hn changes
from the CMPn0 register to the CMPn1 register.
When the count value of 8-bit timer counter Hn and the value of the CMPn1 register match, the TOHn
output becomes inactive, and at the same time the register that is compared with 8-bit timer counter Hn
changes from the CMPn1 register to the CMPn0 register. At this time, 8-bit timer counter Hn is not
cleared and the INTTMHn signal is not generated.
A pulse of any duty ratio can be obtained through the repetition of steps <3> and <4> above.
To stop the count operation, set TMHEn = 0.
<4>
<5>
<6>
Designating the setting value of the CMPn0 register as (N), the setting value of the CMPn1 register as (M),
and the count clock frequency as f
CNT
, the PWM pulse output cycle and duty ratio are as follows.
PWM pulse output cycle = (N + 1)/f
CNT
Duty ratio = inactive width: Active width = (M + 1) : (N
M)
Cautions 1. In the PWM mode, three operating clocks (signal selected by CKSHn0 to CKSHn2 bits of
TMHMDn register) are required for actual transfer of the new value to the register after
the CMPn1 register has been rewritten.
2. Be sure to set the CMPn1 register when starting the timer count operation (TMHEn = 1)
after the timer count operation was stopped (TMHEn = 0) (be sure to set again even if
setting the same value to the CMPn1 register).