22-2
MC9328MX1 Reference Manual
MOTOROLA
Pulse-Width Modulator (PWM)
Adjust the 7-bit prescaler to achieve lower sampling rates by programming the PRESCALER field in the
PWMC register with any number between 0 and 127 to scale down the incoming clock source by a
corresponding factor of 1 to 128.
22.2.2 Pin Configuration for PWM
Figure 22-1 shows the signals used for the PWM module. The PWMO pin is multiplexed with other
functions on the device, and must be configured for PWM operation. Table 22-1 describes the procedure
for the PWM pin configuration.
NOTE:
The user must ensure that the data direction bit in the GPIO is set to the
correct direction for proper operation. See Section 32.5.1, “Data Direction
Registers,” on page 32-9 for details.
22.3 PWM Operation
The pulse-width modulator has three modes of operation—playback, tone, and digital-to-analog (D/A)
converter.
22.3.1 Playback Mode
In playback mode, the pulse-width modulator uses the data from a sound file to output the resulting audio
through an external speaker. To reproduce the best quality of sound from a sound file, it is necessary to use
a sampling frequency that is equal to or an even multiple of the sampling frequency used to record the
sound.
The PWM produces variable-width pulses at a constant frequency. The width of the pulse is proportional
to the analog voltage of a particular audio sample. At the beginning of a sample period cycle, the PWMO
pin is set to 1 and the counter begins counting up from 0x0000. The sample value is compared on each
count of the prescaler clock. When the sample and count values match, the PWMO signal is cleared to 0.
The counter continues counting, and when it overflows from 0xFFFF to 0x0000, another sample period
cycle begins. The prescaler clock (PCLK) runs 256 times faster than the sampling rate when the PERIOD
field of the PWM period (PWMP) register is at its maximum value.
Figure 22-2 illustrates how variable width pulses affect an audio waveform.
Figure 22-2. Audio Waveform Generation
Table 22-1. Pin Configuration
Pin
Setting
Configuration Procedure
PWMO
Primary function of
GPIO Port A [2]
1. Clear bit 2 of Port A GPIO In Use register (GIUS_A)
2. Clear bit 2 of Port A General Purpose register (GPR_A)
Pulse-Width Modulation Stream
Filtered Audio
Summary of Contents for DragonBall MC9328MX1
Page 68: ...1 12 MC9328MX1 Reference Manual MOTOROLA Introduction ...
Page 86: ...2 18 MC9328MX1 Reference Manual MOTOROLA Signal Descriptions and Pin Assignments ...
Page 116: ...3 30 MC9328MX1 Reference Manual MOTOROLA Memory Map ...
Page 126: ...4 10 MC9328MX1 Reference Manual MOTOROLA ARM920T Processor ...
Page 160: ...8 8 MC9328MX1 Reference Manual MOTOROLA System Control ...
Page 272: ...13 32 MC9328MX1 Reference Manual MOTOROLA DMA Controller ...
Page 281: ...Programming Model MOTOROLA Watchdog Timer Module 14 9 ...
Page 282: ...14 10 MC9328MX1 Reference Manual MOTOROLA Watchdog Timer Module ...
Page 300: ...15 18 MC9328MX1 Reference Manual MOTOROLA Analog Signal Processor ASP ...
Page 438: ...18 16 MC9328MX1 Reference Manual MOTOROLA Serial Peripheral Interface Modules SPI 1 and SPI 2 ...
Page 478: ...19 40 MC9328MX1 Reference Manual MOTOROLA LCD Controller ...
Page 574: ...21 32 MC9328MX1 Reference Manual MOTOROLA Memory Stick Host Controller MSHC Module ...
Page 598: ...23 16 MC9328MX1 Reference Manual MOTOROLA Real Time Clock RTC ...
Page 670: ...24 72 MC9328MX1 Reference Manual MOTOROLA SDRAM Memory Controller ...
Page 726: ...25 56 MC9328MX1 Reference Manual MOTOROLA SmartCard Interface Module SIM ...
Page 736: ...26 10 MC9328MX1 Reference Manual MOTOROLA General Purpose Timers ...
Page 854: ...29 18 MC9328MX1 Reference Manual MOTOROLA I2C Module ...
Page 900: ...30 46 MC9328MX1 Reference Manual MOTOROLA Synchronous Serial Interface SSI ...
Page 942: ...32 26 MC9328MX1 Reference Manual MOTOROLA GPIO Module and I O Multiplexer IOMUX ...