MSC8144E Reference Manual, Rev. 3
21-8
Freescale
Semiconductor
Timers
The timer output yields a PWM signal with:
a frequency equal to the count clock frequency divided by 65,536.
a pulse width duty cycle equal to the compare value divided by 65,536.
21.1.4.4
Variable Frequency PWM Mode
The timer output yields a PWM signal with a frequency and pulse width determined by the values
programmed into the TMRxCMP1 and TMRxCMP2 registers and the input clock frequency if
the timer is set up as follows:
TMRxCTL[CM] = 001 TMRxCTL[CM] = 001 to count the rising edges of the primary
source (see Table 21-5).
The Count Length bit, TMRxCTL[LEN], = 1 so that the timer counts to the compare value
and then reinitializes.
The Count Once bit, TMRxCTL[ONCE], = 0 to count repeatedly.
The Output Flag Mode, TMRxCTL[OFLM], = 100 to toggle the timer output flag using
alternating compare registers.
This method of PWM generation has the advantage of allowing almost any desired PWM
frequency and/or constant on or off periods. The TMRxCMPLD1 and TMRxCMPLD2 registers
are especially useful for this mode because they give you time to calculate values for the next
PWM cycle during the PWM current cycle.
To set up the timer to run in Variable Frequency PWM mode with compare preload, use the set
up described here for the desired timer. During set-up, update the TMRxCTL register last
because the timer starts counting if the count mode changes to any value other than 000. Set up
the Timer Control (TMRxCTL) register bits as follows:
Count Mode (CM) = 001 to count the rising edges of the primary source.
Primary Count Source (PCS) = 1000 to specify the best granularity for waveform timing;
prescaler CLASS64 clock/1.
Secondary Count Source (SCS) = Any value because the bits are ignored in this mode.
Count Once (ONCE) = 0 to count repeatedly.
Count Length (LEN) = 1 so that the timer counts till it reaches a compare and then
reinitializes the timer register.
Direction (DIR) = Count up (0) or count down (1). The compare register values must be
chosen carefully to account for roll-under and so on.
External Initialization (EIN) = 0 so that another timer cannot force a reinitialization of this
timer. However, you can set this bit if you need the functionality.
Output Mode (OFLM) = 100 to toggle the timer output flag using alternating compare
registers.
Summary of Contents for MSC8144E
Page 1: ...MSC8144E Reference Manual Quad Core Media Signal Processor MSC8144ERM Rev 3 July 2009 ...
Page 48: ...MSC8144E Reference Manual Rev 3 xlviii Freescale Semiconductor ...
Page 86: ...MSC8144E Reference Manual Rev 3 1 38 Freescale Semiconductor Overview ...
Page 168: ...MSC8144E Reference Manual Rev 3 3 60 Freescale Semiconductor External Signals ...
Page 242: ...MSC8144E Reference Manual Rev 3 5 26 Freescale Semiconductor Reset ...
Page 314: ...MSC8144E Reference Manual Rev 3 8 24 Freescale Semiconductor General Configuration Registers ...
Page 414: ...MSC8144E Reference Manual Rev 3 10 14 Freescale Semiconductor MSC8144E SC3400 DSP Subsystem ...
Page 452: ...MSC8144E Reference Manual Rev 3 11 38 Freescale Semiconductor Internal Memory Subsystem ...
Page 520: ...MSC8144E Reference Manual Rev 3 12 68 Freescale Semiconductor DDR SDRAM Memory Controller ...
Page 1070: ...MSC8144E Reference Manual Rev 3 21 28 Freescale Semiconductor Timers ...