UM10310_1 © NXP B.V. 2008. All rights reserved.
User manual Rev. 01 — 1 December 2008 53 of 139
NXP Semiconductors UM10310
P89LPC9321 User manual
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.
When the timer changes direction at the bottom, in this example, it counts …,0001H,
0000H, 0001H,… The CCU Timer overflow interrupt flag is set in the counter CCUCLK
cycle after the transition from 0001H to 0000H.
The status of the TDIR2 bit in TCR20 reflects the current counting direction. Writing to this
bit while operating in symmetrical mode has no effect.
9.7 Alternating output modeIn asymmetrical mode, the user can program PWM channels A/B and C/D as alternating
pairs for bridge drive control. By setting ALTAB or ALTCD bits in TCR20, the output of
these PWM channels are alternately gated on every counter cycle. This is shown in the
following figure:
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