SN8P2711A
8-Bit Micro-Controller
SONiX TECHNOLOGY CO., LTD
Page 101
Version 0.1
8.4.3 PWM Duty with TCnR Changing
In PWM mode, the system will compare TCnC and TCnR all the time. When TCnC<TCnR, the PWM will output logic
“High”, when TCnC
≧
TCnR, the PWM will output logic “Low”. If TCnC is changed in certain period, the PWM duty will
change in next PWM period. If TCnR is fixed all the time, the PWM waveform is also the same.
TCnC overflow
and TCnIRQ set
TCnC = TCnR
0xFF
TCnC Value
0x00
PWMn Output
1
2
3
4
5
6
7
Period
Above diagram is shown the waveform with fixed TCnR. In every TCnC overflow PWM output “High, when TCnC
≧
TCnR PWM output ”Low”. If TCnR is changing in the program processing, the PWM waveform will became as following
diagram.
1
1st PWM
2
Update PWM Duty
3
2nd PWM
4
Update PWM Duty
0xFF
TCnC Value
0x00
PWMn Output
Period
5
3th PWM
TCnC overflow
and TCnIRQ set
Old TCnR
Old TCnR
New TCnR
New TCnR
Update New TCnR!
Old TCnR < TCnC < New TCnR
Update New TCnR!
New TCnR < TCnC < Old TCnR
TCnC > = TCnR
PWM High > Low
TCnC < TCnR
PWM Low > High
In period 2 and period 4, new Duty (TCnR) is set. TCn is double buffer design. The PWM still keeps the same duty in
period 2 and period 4, and the new duty is changed in next period. By the way, system can avoid the PWM not
changing or H/L changing twice in the same cycle and will prevent the unexpected or error operation.