SN8P2714X_2715
8-bit micro-controller build-in 12-bit ADC
SONiX TECHNOLOGY CO., LTD
Page 78
V1.4
8.4.3 PWM Duty with TCxR changing
In PWM mode, the system will compare TCxC and TCxR all the time. When TCxC<TCxR, the PWM will output logic
“High”, when TCxC
≧
TCxR, the PWM will output logic “Low”. If TCXC is changed in certain period, the PWM duty will
change in next PWM period.
When TCxR is fixed all the time, the PWM waveform is also the same
Above diagram is shown the waveform with fixed TCxR. In every TCxC overflow PWM output “High, when
TCxC
≧
TCxR PWM output ”Low”.
When TCxR changing in the program processing, the PWM waveform will became:
In period 2 and period 4, new Duty (TCxR) is set. However, the PWM still keep the same duty in period 2 and period 4.
and the duty changed in next period. By this 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.
TC0C overflow and
Set TC0IRQ = 1
TC0C = TC0R
0xFF
TC0C Value
0x00
PWM0 Output
1
2
3
4
5
6
7
1
1st PWM
2
Update PWM Duty
3
2nd PWM
4
Update PWM Duty
0xFF
TC0C Value
0x00
PWM0 Output
Period
5
3th PWM
TC0C overflow and
Set TC0IRQ = 1
Old TC0R
Old TC0R
New TC0R
New TC0R
Update New TC0R!
Old TC0R < TC0C < New TC0R
Update New TC0R!
New TC0R < TC0C < Old TC0R
TC0C > = TC0R
PWM High to Low
TC0C < TC0R
PWM Low to High
New TC0R
New TC0R