MC68336/376
CONFIGURABLE TIMER MODULE 4
MOTOROLA
USER’S MANUAL
Rev. 15 Oct 2000
10-15
10.9.3 PWMSM Counter
The 16-bit up counter in the PWMSM provides the time base for the PWM output sig-
nal. The counter is held in the $0001 state after reset or when the PWMSM is disabled.
When the PWMSM is enabled, the counter begins counting at the rate selected by
CLK[2:0] in PWMSIC. Each time the counter matches the contents of the period reg-
ister, the counter is preset to $0001 and starts to count from that value. The counter
can be read at any time from the PWMC register without affecting its value. Writing to
the counter has no effect.
10.9.4 PWMSM Period Registers and Comparator
The period section of the PWMSM consists of two 16-bit period registers (PWMA1 and
PWMA2) and one 16-bit comparator. PWMA2 holds the current PWM period value,
and PWMA1 holds the next PWM period value. The next period of the output PWM
signal is established by writing a value into PWMA1. PWMA2 acts as a double buffer
for PWMA1, allowing the contents of PWMA1 to be changed at any time without affect-
ing the period of the current output signal. PWMA2 is not user accessible. PWMA1 can
be read or written at any time. The new value in PWMA1 is transferred to PWMA2 on
the next full cycle of the PWM output or when a one is written to the LOAD bit in
PWMSIC.
The comparator continuously compares the contents of PWMA2 with the value in the
PWMSM counter. When a match occurs, the state sequencer sets the output flip-flop
and resets the counter to $0001.
Period values $0000 and $0001 are special cases. When PWMA2 contains $0000, an
output period of 65536 PWM clock periods is generated.
When PWMA2 contains $0001, a period match occurs on every PWM clock period.
The counter never increments beyond $0001, and the output level never changes.
Table 10-4 PWMSM Divide By Options
CLK2
CLK1
CLK0
PCLK1 = fsys
÷ 2
(CPCR DIV23 = 0)
PCLK1 = fsys
÷ 3
(CPCR DIV23 = 0)
00
0
fsys
÷ 2f
sys
÷ 3
00
1
fsys
÷ 4f
sys
÷ 6
01
0
fsys
÷ 8f
sys
÷ 12
01
1
fsys
÷ 16
fsys
÷ 24
10
0
fsys
÷ 32
fsys
÷ 48
10
1
fsys
÷ 64
fsys
÷ 96
11
0
fsys
÷ 128
fsys
÷ 192
11
1
fsys
÷ 512
fsys
÷ 768