217
Chapter 7 Timer/Counter Units
7
(10)Notes on compare register rewrite operation when PPG output is used
(a) If a value less than the value of TMn is written into compare register CRn0 (n = 0, 2) before the value of
the CRn0 register coincides with the value of TMn (n = 0, 2), a PPG signal with a 100% duty factor is output
in that period. CRn0 rewrite operation must be performed using an interrupt generated by a coincidence
between TMn and CRn0.
Fig. 7-136 Example of PPG Output Signal with a 100% Duty Factor
TOp
(p = 0,2)
CRn0
0H
n1 n2
n2
n2
n2
n3
n1
TMn
count value
When a value, n2 less than TMn value, n3 is written to CRn0
here, the duty factor is 100% during this period.
n1
CRn1
CRn1 CRn1 CRn1
Remark ALVp = 0
(b) If the current value of the CRn1 compare register is decreased below the value of TMn, the PPG period
becomes as long as the full-count time of TM2. At this time, if CRn1 is rewritten after the value of the
CRn0 compare register coincides with the value of TMn, the inactive level is output until TMn overflows
to 0, then normal PPG output is resumed. If CRn1 is rewritten before the value of CRn0 coincides with the
value of TMn, the active level is output until the value of CRn0 coincides with the value of TMn. When the
value of CRn0 coincides with the value of TMn before TMn overflows to 0, the inactive level is output at
that time. When TMn overflows to 0, the active level is output, and normal PPG output is resumed.
CRn1 rewrite operation must be performed using an interrupt generated by a coincidence between TMn
and CRn1.