© Koninklijke Philips Electronics N.V. 2005. All rights reserved.
User manual
Rev. 03 — 7 June 2005
59 of 139
Philips Semiconductors
UM10119
P89LPC938 User manual
10.6 PWM operation
PWM Operation has two main modes, asymmetrical and symmetrical. These modes of
timer operation are selected by writing 10H or 11H to TMOD21:TMOD20 as shown in
Section 10.3 “Basic timer operation”
In asymmetrical PWM operation, the CCU Timer operates in downcounting mode
regardless of the setting of TDIR2. In this case, TDIR2 will always read 1.
In symmetrical mode, the timer counts up/down alternately and the value of TDIR2 has no
effect. The main difference from basic timer operation is the operation of the compare
module, which in PWM mode is used for PWM waveform generation.
shows the
behavior of the compare pins in PWM mode.
The user will have to configure the output compare pins as outputs in order to enable the
PWM output. As with basic timer operation, when the PWM (compare) pins are connected
to the compare logic, their logic state remains unchanged. However, since the bit FCO is
used to hold the halt value, only a compare event can change the state of the pin.
The CCU Timer Overflow interrupt flag is set when the counter changes direction at the
top. For example, if TOR contains 01FFH, CCU Timer will count: …01FEH, 01FFH,
01FEH,… The flag is set in the counter cycle after the change from TOR to TOR-1.
Fig 22. Asymmetrical PWM, downcounting.
Fig 23. Symmetrical PWM.
TOR2
compare value
timer value
non-inverted
inverted
0x0000
002aaa893
TOR2
compare value
timer value
non-inverted
inverted
002aaa894
0