
210
CHAPTER 7 8-BIT PWM TIMER
7.9
Notes on Using 8-bit PWM Timer
This section lists points to note when using the 8-bit PWM timer.
s Notes on Using 8-bit PWM Timer
r Error
Activating the counter by program is not synchronized with the start of counting-up using the
selected count clock. Therefore, the time from activating the counter until a match with the PWM
compare register (COMR) is detected may be shorter than the theoretical time by a maximum of
one cycle of the count clock. Figure 7.9-1 "Error on Starting Counter Operation" shows the error
that occurs on starting counter operation.
Figure 7.9-1 Error on Starting Counter Operation
r Notes on setting by program
Do not change the count clock cycle (CNTR: P1, P0) when the interval timer function or
PWM timer function is operating (CNTR: TPE = "1").
Stop the counter (CNTR: TPE = "0"), disable interrupts (TIE = "0"), and clear the interrupt
request flag (TIR = "0") before switching between the interval timer function and PWM timer
function (CNTR: P/TX).
Interrupt processing cannot return if the interrupt request flag bit (CNTR: TIR) is "1" and the
interrupt request enable bit is enabled (CNTR: TIE = "1"). Always clear the TIR bit.
The TIR bit is not set if the counter is disabled (TPE = "0") at the same time as the counter
and COMR register values match.
r Notes when using 8/16-bit timer/counter output
When selecting timer 1 output for 8-bit PWM timer 1 and operating the 8/16-bit timer/counter
in 16-bit ode, always select internal count clock for 8-bit PWM timer 2.
Timer 2 output
cannot be selected.
Counter value
Count clock
One cycle
Error
Cycle for 00H
Counter activate
00H
01H
02H
03H
04H