You are on page 1of 4

2014 International Symposium on Computer, Consumer and Control

Design of a Counter-Based DPWM Using RC Charge

Hsin-Chuan Chen
Department of Electronic Engineering
St. John’s University
Tamsui District, New Taipei City, Taiwan
robin@mail.sju.edu.tw

Abstract—Conventional counter-based digital PWM does not need high clock frequency while satisfying high
(DPWM) has simple hardware architecture to generate the resolution; and it only adds a reasonable hardware
PWM pulse; however, the resolution of the counter-based complexity when extending the resolution of the original
DPWM is directly proportional to its input reference clock, counter-based DPWM. Besides, this proposed DPWM
and thus the higher clock frequency is required, which device also effectively reduces the impact of capacitance
means higher dynamic power consumption and noise error on duty cycle error.
interference may be incurred. In this paper, by the design
approach of RC charge, the proposed DPWM device can II. COUNTER-BASED DPWM
extend its resolution without increasing the reference clock
frequency. Moreover, this DPWM scheme with resolution In the conventional analog type of PWM, it uses a
extension also can reduce the hardware complexity and the comparator to compare a reference voltage with the ramp
impact caused by capacitance error compared with the or triangle wave, by adjusting the level of reference
conventional DPWM. voltage, and then the pulse width can be obtained from the
output of the comparator. Similarly, the counter-based
Keywords- Counter-Based DPWM, Resolution, RC Charge, DPWM (CNT DPWM), the simplest digital PWM
Duty Cycle, Capacitance Error. architecture, can be easily implemented only by an n-bit
counter and an n-bit digital comparator shown in Fig. 1
I. INTRODUCTION [2][7], where the digital setting code K is used to set the
Pulse width modulation (PWM), an effective comparing value of the digital comparator. The counter
technology, is used to regulate the average power by counts at each positive transit of the reference clock, when
changing its duty cycle of the output pulse in discrete time the value of counter is less than K, the output (A<B) of
domain [1]. Due to that the PWM using digital control can the comparator remains high-level state until the content
improve the cost and performance of the system, therefore, of the counter is equal to or large than K. Therefore, this
the digital PWM (DPWM) is often applied to many output will generate a pulse width corresponding to the
control systems, such as DC motors, DC-DC converters digital setting code. For an n-bit counter-based DPWM
[4], LED controllers [9], D/A converters [5], and even structure with output frequency fPWM, it requires a
vehicle brakes [1]. Nowadays, the digital PWM (DPWM) reference clock fCLK = 2n ×ʳ fPWM, and thus the modulation
has become an important device in the modern systems, rate (i.e. duty cycle) D of the counter-based DPWM is
even some microcontrollers also directly integrate the given by:
DPWM into their chips [6]. High resolution is necessary TK K  TCLK K
for the DPWM to achieve precise output control and avoid D   n (1)
TPWM 2 n  TCLK 2
undesirable quantization effects [2]; however, the
resolution of the counter-based DPWM is directly where TK is ON time of the PWM pulse controlled by K
proportional to its input reference clock. When seeking value from 0 to 2n-1. However, the resolution of the
high resolution for the counter-based DPWM, the higher counter-based DPWM is directly proportional to its input
dynamic power consumption and noise interference may reference clock [4]. Therefore, this DPWM scheme does
be incurred [4] because a higher clock frequency is not suit for high-resolution implementation due to
required. For example, an 8-bit counter-based DPWM requiring a higher reference clock frequency.
with 1 MHz output frequency needs a reference clock up
(n bits)
to 256 MHz. Digital Setting Code: K B
In the past, for solving the high-frequency problem PWM
A<B
existing in the counter-based DPWM, one of the most Output
n-bit
used approaches is using a tapped delay line controlled by fCLK A
Counter
digital code to select the desired pulse width [3]. This n-bit
delay-line DPWM does not need high clock frequency Comparator
while satisfying high resolution, but a high hardware Figure 1. Basic structure of counter-based DPWM.
complexity is required for obtaining better linearity and
performance compared with the counter-based DPWM. To avoid using high-frequency clock, the often used
In this paper, a new DPWM device using RC charge is DPWM scheme, delay-line DPWM shown in Fig. 2 [7],
proposed to extend its resolution. This proposed DPWM employs a cascade of delay cells, a multiplexer, and a SR

978-1-4799-5277-9/14 $31.00 © 2014 IEEE 1267


DOI 10.1109/IS3C.2014.327
flip-flop to construct the PWM pulse generator [2]. When TK 2 K
the clock enters into the tapped delay line, the SR flip-flop  m 2n , (5)
TPWM 2
is set to “Hi”. By the selection of n-bit setting code, the
Substituting Eq. (3) and Eq. (5) into Eq. (2), the duty
desired delay signal appears at the output of 2n to 1
cycle D will become:
multiplexer, and then resets the SR flip-flop until the next
K K 2 n  K1  K 2
clock enters again. Such an operation, a modulated pulse D  m1  m 2n  (6)
width can be generated from the output of SR flip-flop. 2 2 2 mn
Due to mismatch delay cells caused by which means the resolution of DPWM is extended as m+n
process/temperature variation, the linearity of the delay- bits from original m bits [8], and K1 and K2 can be treated
line DPWM will be affected [5], and thus more hardware as high bits and low bits of the digital setting code,
components are required for better performance and respectively. Here, we try to use a RC charge approach to
linearity [3]. For achieving high resolution, this DPWM generate the extended pulse time TK2 less than one clock
has a large hardware complexity including quantities of time. Consequently, Eq. (4) can also be modified as:
delay cells and a large-scale multiplexer [3]. 1 T 1
 K 2  n  VC (7)
2n Delay Cells K 2 TCLK 2
Consider that VC is the charging voltage performed by
VS
current I charging through R and C after TK2 time, and VC
fCLK is given by:
dly0 dly1 dly2n-1 TK 2

VC  I  R  (1  e RC ) (8)
Setting where I from the current source selector with a unit
2n to 1 Multiplexer
(n bits) Code
current i for each current source is controlled by 1/K2. Let
RC > TK2, then we expand the exponential of Eq. (8) in a
R series and ignore the items with high power, so we obtain:
PWM
Q  TK 2
Output
S
e RC
 1  TK 2 / RC  . (9)
Figure 2. Delay-line DPWM scheme. Substituting Eq. (9) into Eq. (8), finally, VC will become
as:
III. PROPOSED DPWM DEVICE USING RC CHARGE
I 1 i 1
Unlike the delay-line DPWM (DLY DPWM) using a VC   TK 2    TK 2  n (10)
tapped delay line, we try to provide a new approach for C K2 C 2
DPWM design, which uses RC charge to perform digital to which behaves like capacitor integration. By selecting i/C
time conversion and further extend the resolution of the = 1/TCLK, when VC charges to the reference voltage VREF
conventional counter-based DPWM. The detail of this corresponding to 1/2n at t = TK2, the extended pulse output
proposed DPWM device (called RC-CNT DPWM) TK2 with n-bit resolution will be generated.
including principle, architecture, and operation will be
described in the following sub-sections. m-bit Counter-Based DPWM
SET PWM
CLK Q OUT
A. Principle (m bits) TK1 DFF1
A A<B
According to the duty cycle of the counter-based m-bit m-bit “1” D CLR Q
fCLK
Counter Comparat
DPWM shown as Eq. (1), consequently, it can also be K1 B A=B
extended as: TP
CLK Q TK2
T T  TK 2 T T DFF2
D  K  K1  K1  K 2 (2) “1” D CLR Q
TPWM TPWM TPWM TPWM (n bits)
Current
K2 Source I VREF
VCMP
where TK contains two parts: TK1 and TK2 [8]. When using Selector CMP
VC
an m-bit counter-based DPWM with the reference clock
fCLK for TK1, therefore, TK1/TPWM is given by: R C
TK 1 K T K S
 m1 CLK  m1 (3)
TPWM 2  TCLK 2 Figure 3. Architecture of proposed DPWM device.
m B. Architecture
where K1 is the digital setting code from 0~2 -1.
In our proposed DPWM scheme shown in Fig.3, an m-
Considering TK2 with n-bit resolution is extended from the bit counter and an m-bit digital comparator construct as an
m-bit counter-based DPWM under the same fCLK, the TK2 m-bit counter-based DPWM to generate TK1, and the RC
is expressed by: charging circuit including current source selector and
K comparator is used to associate with a D flip-flop to
TK 2  n2  TCLK (4)
2 generate TK2. The current source selector controlled by
n
where K2 is the digital setting code from 0~2 -1. Similarly, digital value K2 is shown in Fig. 4, and it uses an n to 2n
TK2/TPWM is also given by: decoder to select 2n current sources corresponding to 1/ K2

1268
[7]. Each output of the decoder enable one current source, according to Eq. (10), TK2 can be given by:
where the current source I0 selected by K2 = 0 has a large K2  C K
charging current to make VC be immediately larger than TK 2    n2  TCLK  (1  err ) (11)
the reference voltage VREF, such that the Q output of DFF1 2n i 2
(PWM OUT) is almost equal to TK1 once K2 = 0. Although Referring to Eq. (5) and Eq. (6), similarly, the duty cycle
this proposed RC-CNT DPWM results in hardware D should be modified as:
overhead due to RC charge, it still has less hardware
complexity than that of the DLY DPWM. 2 n  K1  K 2  (1  err )
D (12)
2 m n
n to 2n Decoder
Therefore, the duty cycle error ED caused by capacitance
K2 error is given by:
E2n-1 …. E2 E1 E0 K  ( err ) .
ED  n 2 (13)
2  K1  K 2
i/2n-1 i/2 i I0 Fortunately, small duty cycle is not realistic for most
….
applications, in other words, K1 is usually larger than 0.
Therefore, the impact of PWM duty cycle error resulted
I from capacitance error can be significantly reduced by
combining counter-based DPWM with RC charging circuit,
Figure 4. Structure of current source selector. especially for large n or K1. When K1 equals 0, the duty
C. Operation cycle error directly depends on the capacitance error, and
thus a capacitor with precise capacitance is necessary for
To explicate how the proposed RC-CNT DPWM this situation to obtain an acceptable duty cycle error.
device works, the operating steps are described as follows:
(1) Initially, all Q outputs of two D flip-flops (DFF1 and V. SIMULATION RESULTS
DFF2) are “Lo”, and the /Q output of DFF2 remains In our simulation, a circuit simulation tool, Pspice, is
“Hi” to make switch S on, and thus the voltage of the used to verify the operation and measure the performance
capacitor is zero (VC = 0). of the proposed 8-bit DPWM device, which is
(2) When the m-bit counter counts to K1, the A<B output implemented by a 4-bit counter-based DPWM combining
of comparator can generate TK1 and trigger the DFF1 4-bit RC charging circuit. Therefore the required main
to set “Hi”. The other A=B output (TP) of comparator components include one 4-bit counter, one 4-bit digital
will activate the RC charge for achieving a resolution comparator, two D flip-flops, one 4 to 16 decoder, 16
extension of n bits. current sources, and one comparator. Besides, the
(3) At the rising transit of TP, the /Q output of DFF2 reference clock frequency and output frequency of the
immediately turns S off and the output (TK2) of DFF2 proposed DPWM are fCLK = 16 MHz and fPWM =1 MHz,
is “Hi”, thus the current I corresponding to 1/ K2 from respectively. For our proposed RC-CNT DPWM, we
the current source selector will start the RC charge. choose the capacitance C = 62.5 pF, the resistance R =
(4) TP always will be generated regardless of K1 value. 100 KΩ, and the reference voltage VREF corresponding to
Therefore, in case of K1 = 0, even though there is no 1/24 is 0.0625 V. In the current source selector, the unit
TK1 to trigger the DFF1, the output (TK2) of DFF2 still current i is 1 mA for each current source, where I0 is
can set DFF1 “Hi” by TP only if K2ʳ≠ 0. chosen as 10 times of unit current i in order to make VC be
(5) When VC charges to the reference voltage VREF immediately larger than the reference voltage VREF.
corresponding to 1/2n, the falling transit output (VCMP)
of comparator will clear the DFF1 and DFF2 so that
TK2 returns back to “Lo” and the Q output of DFF1
(PWM OUT) also becomes “Lo”. Simultaneously, the
switch S turns on and VC discharges to zero until the
next rising edge of TP comes again.
(6) In case of K2 = 0, due to that a larger current source I0
is selected, DFF1 and DFF2 are immediately cleared
when starting the RC charge, which means almost no
TK2 is generated.
Finally, the output PWM OUT almost equals TK1+TK2;
therefore, the proposed RC-CNT DPWM will generate the
PWM output with a resolution of m+n bits under the same
reference clock fCLK. Figure 5. Simulation waveforms at K1 = 8 and K2 = 8.
Fig. 5 shows the P-Spice simulation waveforms for the
IV. ANALYSIS OF CAPACITANCE ERROR IMPACT proposed RC-CNT DPWM, where the final PWM output
Because the capacitance error is usually larger than the is synthesized by TK1 at K1 = 8 and TK2 at K2 = 8 [8]. We
other components, therefore, using a capacitor component find that the duty cycle becomes 53.22% from 50% for the
in our proposed RC-CNT DPWM may affect its precision original 4-bit counter-based DPWM; therefore, the
of duty cycle. If the capacitor has a capacitance error (err), resolution of the proposed DPWM indeed can be extended

1269
as 8 bits from the original 4-bit counter-based DPWM VI. CONCLUSIONS
without increasing the reference clock frequency. In this paper, a new DPWM device using RC charge is
Considering K2 = 0, TK2 is only an impulse when TP goes
proposed to successfully extend the resolution of the
“Hi” from “Lo”, and this impulse with very short duration
original counter-based DPWM while maintaining the
time does not cause DFF1 being set to “Hi”. Hence, the
PWM output TK1 still keeps the original output, and the same clock frequency. By this approach of resolution
duty cycle remains at 50% shown in Fig. 6. extension, our proposed RC-CNT DPWM also effectively
reduces the duty cycle error caused by capacitance error,
which is more significant especially for large duty cycle.
According to our simulation, the duty cycle of our
proposed RC-CNT DPWM can be modulated from 0 to
99.6%, and its duty cycle error also indeed can be reduced
to about 0.63% when the duty cycle is 96.8% at 20%
capacitance error. Considering a trade-off between high
frequency of the conventional counter-based DPWM and
high hardware complexity of the delay-line DPWM, the
proposed DPWM device using RC charge therefore can
suit for the digital PWM design with high resolution and
low cost.
Figure 6. Simulation waveforms at K1 = 8 and K2 = 0.
REFERENCES
Due to that the capacitance error may affect the [1] B. Michael, “Pulse Width Modulation,” Embedded Systems
precision in duty cycle for the DPWM using capacitor Programming, pp. 103-104, 2001.
components, hereby considering the capacitor has a [2] A. Syed, E. Ahmed, D. Maksimović, and E. Alarcón, “Digital
Pulse Width Modulator Architectures,” in Proc. IEEE 35th
capacitance error from 1% to 20%, we find that the duty Annual Power Electronics Specialists Conference, pp.4689-4695,
cycle error for different K2ʳ atʳ K1 = 0 increases as the June 2004..
capacitance error increases for our proposed RC-CNT [3] A. Syed, E. Ahmed, and D. Maksimović, “Digital PWM
DPWM shown in Fig. 7, and these duty cycle errors almost Controller with Feed-Forward Compensation,” in Proc. IEEE
equal the capacitance error. However, when K1 is larger 19th Annual Applied Power Electronics Conference and
Exposition, pp. 60-66, Feb. 2004.
than 0 at K2 = 8, the duty cycle error shown in Fig. 8 can be [4] B. J. Patella, A. Prodic, A. Zirger, and D. Maksimović, “High-
significantly reduced especially for large K1. Even the Frequency Digital PWM Controller IC for DC-DC Converters,”
capacitance error increases up to 20%, only not over 7% IEEE Transaction on Power Electronics, vol. 18, no. 1, pp. 438-
for K1 = 1 and 2% for K1ʳ Њ 5 duty cycle errors are 446, Jan. 2003.
achieved. [5] J. Jung and M. J. Hawksford, “An Oversampled Digital PWM
Linearization Technique for Digital-to-Analog Conversion,” IEEE
Transaction on Circuit and System-I, vol. 51, no. 9, pp. 1781-
0.25 K2=2 1789, Sept. 2004.
K2=4 [6] Z Salam and K. M. Salim, “Generation of Pulse Width
Duty Cycle Error

K2=6
0.2 K2=8 Modulation (PWM) Signals for Three-Phase Inverter Using A
K2=10 Single-Chip Microcontroller,” Journal Teknologi, vol. 34, pp. 1-
0.15 K2=12 12, 2001.
K2=14 [7] H. C. Chen, “A High-Resolution Digital PWM Controller Using
0.1
Capacitor Integration,” in Proc. 2010 International Symposium on
0.05 Next-Generation Electronics, pp. 166-169, Nov. 2010..
0 [8] H. C. Chen, “A Counter-Based DPWM Device with Resolution
Extension,” Applied Mechanics and Materials, vol. 145, pp. 593-
0% 1% 5% 10% 15% 20% 597, Jan 2012.
Capacitance Error [9] B. J. Huang, P. C. Hsu, M. S. Wu, and K. Y. Chen, “A High-
Performance Stand-Alone Solar PV Power System for LED
Figure. 7. Duty cycle error of proposed DPWM device for K1 = 0. Lighting,” in Proc. 35th IEEE
Photovoltaic Specialists Conference, pp. 2346-2348, Jun. 2010.

0.07 K1=1
K1=3
0.06
Duty Cycle Error

K1=5
0.05 K1=7
K1=9
0.04 K1=11
K1=13
0.03 K1=15
0.02
0.01
0
0% 1% 5% 10% 15% 20%
Capacitance Error
Figure 8. Duty cycle error of proposed DPWM device for K1 > 0.

1270

You might also like