Pulse-Width Modulator; Overview - Motorola DragonBall MC68328 User Manual

Integrated processor
Table of Contents

Advertisement

SECTION 11

PULSE-WIDTH MODULATOR

The pulse-width modulator (PWM) provides high-quality sound generation and accurate
motor control. This section describes the PWM block.

11.1 OVERVIEW

The PWM is a simple free-running counter with two "compare" registers that each perform
a particular task when they match the count value. The period comparator sets the output
pin and the free-running counter resets when its value matches the period value. The width
comparator resets the output pin when the counter value matches. With a suitable low-pass
filter, the PWM can be used as a digital-to-analog converter.
SYSCLK
PRESCALER
The output pin feeds a stream of sample values to the PWM into the width register and pro-
vides a low-pass filter on the output. It also provides a high-quality, digitally generated sound
source. The selected period determines the reconstruction rate. Typically for voice quality,
the rate will be between 6 kHz and 8 kHz. The following figure relates the pulse stream to
the filtered audio output.
Pulse Stream
Filtered Audio
The width and period registers are double-buffered so that a new value can be loaded for
the next cycle without disturbing the current cycle. At the beginning of each period, the con-
tents of the buffer registers are loaded into the comparator for the next cycle. Sampled audio
can be recreated by feeding a new sample value into the width register on each interrupt.
MOTOROLA
WIDTH COMPARE
COUNTER
PERIOD COMPARE
Figure 11-1. PWM Block Diagram
Figure 11-2. PWM Generating Audio
MC68328 DRAGONBALL PROCESSOR USER'S MANUAL
OUTPUT
PWMOUT
CONTROL
11-1

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents