English
Language : 

AN110 Datasheet, PDF (1/12 Pages) Silicon Laboratories – 16-BIT PWM USING AN ON-CHIP TIMER
AN110
16-BIT PWM USING AN ON-CHIP TIMER
Relevant Devices
This application note applies to the following
devices:
The example also configures the target board to
sample the PWM output using the on-chip ADC.
This DAC implementation may be used to evaluate
the C8051F220/1/6’s ADC.
C8051F000, C8051F001, C8051F002,
C8051F005, C8051F006, C8051F007,
Key Points
C8051F010, C8051F011, C8051F012, C8051F015, • The C8051F2xx family SoC’s feature three on-
C8051F016, C8051F017, C8051F220,
board 16-bit timers that can be used for PWM
C8051F221, C8051F226, C8051F230,
generation. This example uses Timer 0 to pro-
C8051F231, and C8051F236.
duce the PWM wave which is output to a gen-
Note: the C8051F0xx devices have an on-chip
eral-purpose port pin.
PCA which may be more suitable for PWM gener- • The C8051F2xx family of SoC’s have an 8-bit
ation. See AN007 for more information.
ADC that is used in the provided example to
Introduction
sample the output of the PWM DAC.
• The C8051F226-TB target board features a
low-pass filter that can readily be used for the
This document describes how to implement a 16-
bit pulse width modulator (PWM) digital-to-analog
converter (DAC). The PWM consists of two parts:
PWM DAC and configured to be sampled by
the on-chip ADC without soldering or adding
extra wiring. Target board use is assumed in the
1. A timer to produce a PWM waveform of a
provided example.
given period and specified duty cycle.
Generating the PWM Input
2. A low-pass filter to convert the PWM wave to Waveform
an analog voltage level output.
Pulse-Width Modulation (PWM) is a method of
encoding data by varying the width of a pulse or
A PWM coupled with a low-pass filter can be used changing the duty cycle of a periodic waveform.
as a simple, low cost digital to analog converter Adjusting the duty cycle of this waveform, we con-
(DAC). This output can be used to drive to a volt- trol the voltage output from the low-pass filter. This
age controlled device, or used in a feedback control can be thought of as a type of digital-to-analog con-
system where an analog-to-digital convertor vertor (DAC). In this example, we use Timer 0 to
(ADC) is used to sample a controlled parameter. time the toggling of a general purpose port pin to
PWM’s are often used in motor control applica- create the PWM waveform.
tions.
Configuring Timer 0
Implementation software and hardware is dis- In order to create a PWM wave with a user speci-
cussed in this application note. An example of a fied duty cycle, we use Timer 0 in 16-bit counter/
PWM using an on-chip timer and a low-pass filter timer mode. To do so, we configure the Timer
on the C8051F226-TB target board is provided.
Rev. 1.2 12/03
Copyright © 2003 by Silicon Laboratories
AN110-DS12