The following diagram illustrates the waveforms associated with the 7+1 mode of PWM operation.
It is important to note how the single PWM cycle is subdivided into 2 individual modulation cycles,
numbered 0 and 1 and how the AC value is related to the PWM value.
PWM Output Control
On all devices, the PWM outputs are pin-shared with the Port D I/O pins. To operate as PWM out-
puts and not as I/O pins, the correct PWM configuration options must be selected. A ²0² must also
be written to the corresponding bits in the I/O port control register PDC to ensure that the required
PWM output pins are setup as outputs. After these two initial steps have been carried out, and of
course after the required PWM value has been written into the PWM register, writing a ²1² to the
corresponding bit in the PD output data register will enable the PWM data to appear on the pin.
Writing a ²0² to the corresponding bit in the PD output data register will disable the PWM output
function and force the output low. In this way, the Port D data output register can be used as an
on/off control for the PWM function. Note that if the configuration options have selected the PWM
function, but a ²1² has been written to its corresponding bit in the PDC control register to configure
the pin as an input, then the pin can still function as a normal input line, with pull-high resistor op
-
tions.
clr PDC.0 ; set pin PD0 as output
clr PDC.1 ; set pin PD1 as output
clr PDC.2 ; set pin PD2 as output
clr PDC.3 ; set pin PD3 as output
Chapter 1 Hardware Structure
45
f
S Y S
/ 2
P W M
[ P W M ] = 1 0 0
[ P W M ] = 1 0 1
P W M
[ P W M ] = 1 0 2
P W M
[ P W M ] = 1 0 3
P W M
P W M m o d u l a t i o n p e r i o d : 1 2 8 / f
S Y S
5 0 / 1 2 8
5 1 / 1 2 8
5 1 / 1 2 8
5 2 / 1 2 8
5 0 / 1 2 8
5 0 / 1 2 8
5 1 / 1 2 8
5 1 / 1 2 8
5 0 / 1 2 8
5 1 / 1 2 8
5 1 / 1 2 8
5 2 / 1 2 8
M o d u l a t i o n c y c l e 0
P W M c y c l e : 2 5 6 / f
S Y S
M o d u l a t i o n c y c l e 1 M o d u l a t i o n c y c l e 0
7+1 PWM Mode
P W M R e g i s t e r ( 7 + 1 ) M o d e
b 7 b 0
A C v a l u e
D C v a l u e
PWM Register for 7+1 Mode