S3F84B8_UM_REV 1.00
12 TIMER 0
12-11
12.2.3.2 Pulse Width Modulation Mode (Timer D)
Pulse width modulation (PWM) mode allows you to program the width (duration) of pulse that is outputted at the
TDOUT (P2.0) pin. As in interval timer mode, a match signal is generated when the counter value is identical to
the value written to Timer D data register. In PWM mode, however, the match signal does not clear the counter.
Instead, it runs continuously, overflowing at “FFH” in case of 8-bit PWM mode, and then continues to increment
from “00H”.
Even though you can use the match signal to generate a Timer D overflow interrupt, interrupts are not typically
used in PWM-type applications. Instead, the pulse at TDOUT pin is held to Low level as long as the reference
data value is less than or equal to (
) the counter value. The pulse is then held to High level as long as the data
value is greater than (>) the counter value. One pulse width is equal to t
CLK
256 in case 8-bit PWM mode is
selected (see
TDPS.3-.0
TDCON.5
8-Bit Comparator
Up-Counter
(Read-Only)
MUX
Match
R
Clear
Selected TDOVF
TDCON.6-.7
TDOVF
Timer D Buffer
Register
Timer D Data Register
(Read/Write)
Data Bus
6-Bit Match
7-Bit Match
8-Bit Match
6-Bit OVF
7-Bit OVF
8-Bit OVF
MUX
MUX
TDCON.6-.7
TDCON.0
TDCON.2
TDCON.5
TDCON.6-.7
P2.0
TDCON.1
TDCON.3
TDINT
(Match INT)
Pending Bit
TDOUT(PWM, Interval)
fx
NOTE:
In PWM mode, match signalwill not clear counter.
Prescaler
Figure 12-9 Timer D PWM Function Block Diagram