
Pulse width modulation module
UM0404
DocID13284 Rev 2
bit. The output signal of each PWM channel is individually enabled by bit PENx. If the output
is not enabled the respective pin can be used for general purpose I/O and the PWM channel
can only be used to generate an interrupt request.
PWMCON1 (FF32h / 99h)
SFR
Reset Value: 0000h
17.3 Interrupt
request
generation
Each of the four channels of the PWM module can generate an individual interrupt request.
Each of these “channel interrupts” can activate the common “module interrupt”, which
actually interrupts the CPU. This common module interrupt is controlled by the PWM
Module Interrupt Control register PWMIC. The interrupt service routine can determine the
active channel interrupt(s) from the channel specific interrupt request flags PIRx in register
PWMCON0.
The interrupt request flag PIRx of a channel is set at the beginning of a new PWM cycle,
when loading the shadow registers. This indicates that registers PPx and PWx are now
ready to receive a new value. If a channel interrupt is enabled via its respective PIEx bit,
also the common interrupt request flag PWMIR in register PWMIC is set, provided that it is
enabled via the common interrupt enable bit PWMIE.
Note:
The channel interrupt request flags (PIRx in register PWMCON0) are not automatically
cleared by hardware upon entry into the interrupt service routine, so they must be cleared
via software. The module interrupt request flag PWMIR is cleared by hardware upon entry
into the service routine, regardless of how many channel interrupts were active. However, it
will be set again if during execution of the service routine a new channel interrupt request is
generated.
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
PS3 PS2
-
PB01
-
-
-
-
PM3 PM2 PM1 PM0 PEN3 PEN2 PEN1 PEN0
RW
RW
RW
RW
RW
RW
RW
RW
RW
RW
RW
Bit
Function
PENx
PWM Channel x Output Enable bit
‘0’: Channel x output signal disabled, generate interrupt only
‘1’: Channel x output signal enabled
PMx
PWM Channel x Mode Control bit
‘0’: Channel x operates in mode 0, that is, edge aligned PWM
‘1’: Channel x operates in mode 1, that is, center aligned PWM
PB01
PWM Channel 0/1 Burst Mode Control bit
‘0’: Channels 0 and 1 work independently in respective standard mode
‘1’: Outputs of channels 0 and 1 are ANDed to POUT0 in burst mode
PSx
PWM Channel x Single Shot Mode Control bit
‘0’: Channel x works in respective standard mode
‘1’: Channel x operates in single shot mode