You are on page 1of 4

Sinusoidal Pulse Width Modulation Design Based DDS

Gao Shuangxi, Cao Shufu


College of Information & Technology, Hebei University of Economics & Business, Hebei Shijiazhuang, China. Email: gaosx@126.com Email:caoshufu@heuet.edu.cn
AbstractFPGA chip using Cyclone series designed and implemented a new type of sinusoidal pulse width modulation (SPWM) generator. The generator used direct digital synthesis (DDS) technology with DSP Builder (FPGA chip supported the corresponding algorithm sub-circuits) discreteness as the hardware middle layer, produced triangle and sine modulated carrier wave which can be controlled in frequency, phase, amplitude. After comparator comparison, the output state was automatic overturn at the time of the waveform intersection, br o ug ht S P WM w ave f o r m t o ac hi e ve t h e c o nt r ol of corresponding switching devices on-off. This method avoided compiling complex hardware program, at the same time ensured the scalability of the system, improved the development efficiency and met the requirements of embedded system, but also has onsite programmability. The simulation results show that the SPWM waveform can neatly achieve the adjustment about frequency, phase, amplitude, and have high frequency resolution. Keywords- DDS; SPWM; DSP Builder

Zhang Ying
Department of Electronic and Communication Engineering North China Electric Power University Hebei BaodingChina china.zy.love@163.com

digital synthesis (DDS) and programmable logic gate array (FPGA) have been widely used. DDS as a new type of frequency synthesizer technology has many characteristics such as high frequency resolution, fast frequency conversion speed, and the output phase-continuous when the frequency changes, and easy to implement a variety of modulation functions and so on [2]. This paper presents a design project of realization SPWM waveform based on DSP Builder, which greatly improve the quality of SPWM output waveform. It has high flexibility and controllability. II. DDS BASIC PRINCIPLE

I.

INTRODUCTION

DDS is a digital frequency synthesizer[3]. It is a digital technology synthesis method, by controlling the phase change rate direct produce frequency that has a variety of different frequency and amplitude signals. DDS has a higher frequency resolution, can fast realize frequency switching and maintain a continuous phase when frequency changes. It is easy to realize numerically controlled modulation of frequency, phase and amplitude. DDS system is mainly composed by the phase accumulator, sine ROM look-up table, D/A converters and so on[4]. DDS block diagram is shown in Fig. 1.

In recent years, with the development of microprocessor and its peripheral circuits, some of the problems existing in digital control technology have been greatly improved, and gradually replace the analog control technology to achieve the traditional control functions. PWM technology is a very important part of the power electronic technologies. It has huge function to enhance the performance of power electronic devices and promote the development of power electronic technologies. Sinusoidal pulse width modulation SPWM (Sinusoidal Pulse Width Modulation) changes pulse modulation mode based on PWM, the pulse width time duty ratio arranges according to the sine rule, so that the output waveform can be exported sine wave through proper filtering. Traditional SPWM mainly be composed by the analog circuits, respectively bring triangular wave and sine wave by discrete devices, and then synthesize to get the SPWM waveform by comparator, thus SPWM obtains a higher accuracy. The disadvantage is lack control flexibility, does not easy to compose closed-loop control system with the microcomputer system[1]. With the continuous development of digital communications technologies and the integrated circuits, direct

Phase accumulator Clock f0

Tuning word

f out

Figure 1. DDS block diagram

In the figure, the phase accumulator accumulates phase increment M which is determined by the frequency control word one time when each clock cycle comes. If the count is

ROM

DAC

LPF

978-1-4244-5874-5/10/$26.00 2010 IEEE

greater than 2N, then automatic overflow and only keep the Nbit digital of the back in the accumulator. Sine look-up table ROM is used to implement the conversion from the phase value output by phase accumulator to the sine amplitude value, make the digital of the sine amplitude value convert into analog in the ADC, finally pass the filter and export a very pure sine wave output signal. After given DDS clock frequency, the output signal frequency depends on the frequency control word, the frequency resolution depends on the accumulator bits, the phase resolution depends on the ROM address line digit, the amplitude quantization noise depends on the ROM data-bit word length and D/A converter digit. III. SPWM MODULATION PRINCIPLE

= 2U m sin
2n

2n

sin i
2n

When n is larger sin , there has:

i =

2U m sin i nU s

That is, the width of the ith is approximately proportional to the sine wave value. B. SPWM Modulation Based on DDS In SPWM, sample to a pure single-frequency signal

SPWM waveform is a series of constant amplitude and different width rectangular pulse waveform equivalent to sine wave[5]. Its principle is: the sine wave is divided into n equal portions, and then the sine-curve of each equal portions and the horizontal axis close in areas, which are replaced by a rectangular pulse having equivalent areas. In which the amplitude of rectangular pulse is constant, the midpoint of each pulse overlaps the midpoint of each equal portion. In this way, the waveform consisting of n constant amplitude and different width rectangular pulse is equivalent sine wave, which calls SPWM waveform. A. SPWM BasicPrinciple of theModulation In SPWM, sine wave is often as a modulated signal, the isosceles triangle wave is often as the carrier, generates modulated wave through the modulation. As shown in Fig. 2.

s ( t ) = sin ( t ) = sin( 2 f 0 t )
the sampling cycle is Tc, then discrete waveform sequence can be gotten:

u (n) = sin(2f 0 nTc ) (n = 0,1,2) 3 The corresponding of discrete phase sequence is:

(n) = 2f 0 nTc = n (n = 0,1,2) 4 In formula: = 2f 0Tc = 2 f 0 f c is the phase


increment between two successive sampling. According to sampling theorem the following conclusions can be gotten.

f0 <

The discrete sequence can be gotten: From (3) can be unique recovered the original analog signal; The slope of the phase function decides the frequency of the signals, but the phase increment decides the slope of the phase function.

1 fc 2

Therefore, if controlling the phase increment, then the frequency of the synthesis signal can be controlled. Now the phase 2 of the whole cycle is divided into M equal parts, for
Figure 2. Bipolar SPWM waveform

K-times of the obtained:

then the frequency of the signal can be

On the assumption that equivalent sine wave is UmSint, SPWM pulse sequences wave amplitude is Us/2, the pulse width is different width, but has the same center distance /n, n is the number of pulses of the half cycle sine wave, so that if the ith rectangular pulse width is i, its phase angle of the focal points is i, then the equivalent principle according to the area theory has:

K K = f 2Tc M c The corresponding analog signal is:

i (U s 2 ) = U m

i + 2 n

i 2 n

sin td ( t )

K 7 f t) M c In the formula, K and M are positive integers, according to the requirement of the sampling theorem, the maximum value of K should be less than the half of the M. u (t ) = sin( 2 In summary, at the circumstances of the sampling frequency is certain, by controlling the phase increment between the two samples (not greater than ) control the

= U m cos( i 2 n ) cos i +

2 n

obtained frequency of discrete sequence, the analog signal of the frequency can be only recovered after keeping and filtering. IV. SPWM IMPLEMENTATION BASED ON DDS

then complete VHDL conversion, integration and adaptation using the DSP Builder, finally integrate the generated VHDL, SPWM module shown in Fig.4. AW FW PR CLK C TF PR AV AG TC
Figure 4. SPWM model in the DSP builder Lane

A. Verification system design In order to verify the SPWM generator that is proposed in the paper, design a small control system based on power electronics. The system uses EP1C12Q240C8 series of Cyclone offered by Altera company. The chip offers 173 I/O interfaces, has 12060 LES, 52 RAM Block of 4 KB, the total available 239616Bit RAM, in addition chip also has two phase-locked loop, this can ensure the system clock signals stability when the system high-speed operation. Memory module use 256K 32Bit SRAM and 2M 8Bit FLASH ROM, in which SRAM is mainly to store the executable code and variables using in the program when develop SOPC, while the FLASH is used to solidify the debugged SOPC code, etc. The system overall structure is shown in Fig. 3. Power circuit Lower-pass filter

ROM

AG SPWM

In Fig.4, AW is amplitude control word, FW is frequency control word, TF is triangular wave frequency, CLK is reference clock, PR is phase register, ROM is sine look-up table, AV is absolute value, AG is amplitude gain, C is comparator, and TC is triangular carrier. Under the control of the reference clock, frequency control word accumulate by the accumulator, in order to obtain the corresponding phase data, the phase modulator receive the phase output of the phase accumulator, mainly is used for signal phase modulation, the output data as sample address to addressable sine ROM lookup table, accomplish the counterchange of phase to amplitude, output different amplitude encoding, progress the amplitude gain through the amplitude control word, generate adjustable frequency-domain amplitude digital sine wave and triangular wave, moreover to produce the needed SPWM wave. C. parameter selection In order to facilitate system validation selectes as follows: The word length D of ROM data bit and D/A converter is 10. The word length of phase accumulator N is 10. The system reference clock fc which generate by phase-locked loop is 50MHz. The storage format of addressable memory is 1024 10Bit. The phase control is 0 P 1024 . The phase step is. 2 N 1024

Drive circuit

Feedback circuit

PWM module

CPU

Display module

Figure 3. Thepower electronic control system basic structure

As the last figure shown, the main circuit of input power uses the inverter circuit, switching device uses IGBT with a 2.5-5v threshold voltage, due to a very small input capacitance, fast switching speed and high frequency. The output circuit is low-pass filter. Driver circuit realizes isolation and protection, protection measures of IGBT include voltage and dv/dt suppression, overcurrent protection, over temperature protection. The feedback circuit make system form the closed-loop structure, so that improve the control accuracy. B. User-defined SPWM module design SPWM modules use the DSP Builder interface tool which is between Quartus and Matlab/ Simulink to design. Using direct digital frequency synthesis (DDS) technology, produce stability frequency triangular carrier and modulated sine wave, which are compared by high-speed analog comparator. Its output state automatically turns at the time of the waveform intersection point, consequently control the corresponding switches device on-off, completely avoid real-time computing. First of all, call DSPBuilder and the other graphical blocks in Simulink libraries using graphical mode in Simulink environment of Matlab, constitute a system-level or algorithmlevel design block diagram, that is, Simulink design model,

By the DDS theory the output frequency resolution can be gotten as follows:

f = f 0 min =

fc = 48.9kHz 2N ,

And the maximum frequency is:

f 0 max =

fc = 25MHz 2 .

V.

SIMULATION VERIFICATION VI. CONCLUSION

At first select chip models based on top-level design, lock the chip pin, then do analysis to result using of timing simulation. A. Behavioral simulation In the simulink of Matlab, respectively set the triangular amplitude value is 300. Frequency word is 100 million. Phase word is 0. Sine wave amplitude is 220, Frequency word is 9 million. Phase word is 0. The modulation depth m is 4. Simulation is processed. This simulation results are shown in Fig. 5. The results showed that the frequency can be controlled by the frequency control words, their amplitude can also be controlled by the amplitude control words.

Paper uses FPGA series of Cyclone offered by Altera company as the master chip. using VHDL hardware description language design PWM generator, UART and liquid crystal display and so on module in the FPGA hardware development. Also use Nios soft core offered by Altera's. Using C language processes program to soft-core CPU. This Not only ensures the scalability of the system, but also improves the development efficiency. Realize SPWM with FPGA has more flexible than the special chip, as long as change the data in the ROM and the control parameters, frequency and phase tuning can be achieved. System has many virtues such as design simple, reliable, easy tuning and so on. The whole design idea is flexible, and intuitive graphical interface is simple and objective, development cycle is short. The simulation results show that the design principles are correct and effective. REFERENCE
[1] YANG Chun-hua and WU Qing-biao, Research on producing SPWM wave based on SOC and DDS, ELECTRIC DRIVE AUTOMATION, Vol31, No. 5, 2009, pp. 3941 DONG Xiu-jie and YANH Yan, A VHDL Design and Realization of2FSK Modulator Based on DDS, JOURNAL OF ZHONGYUAN UNIVERSITY OF TECHNOLOGY, Vol.20 No.5, 2009, pp. 69~72 Chen Xiaozheng, Design and Realization of Virtual Frequency Scanner Based on DDS Technology, Communication & Audio and Video, No. 1 2006, pp. 40~46 LiYong1, Ai Zhujun1 and Liu Qiaoyun etc. A design for DDS based on FPGA, Cryo.& Supercond, Vo.l 35 No. 6, 2007, pp.539~542 Liang Yu-ming and Chen De-hai, Analysis and Design of High Frequency SPWM Velometer Based on DSP, MICROELECTRONICS & COMPUTER, Vol.26 No.2, pp.72~75

[2]

[3]

Figure 5. SPWM simulation waveform m = 4

[4] [5]

RTL functional simulation Link for ModelSim is a co-simulation interface expansion module. It seamlessly links up the Matlab, FPGA and the ASIC hardware design flows. It provides a fast two-way connection connecting Matlab and Modelsim. Progress the direct cosimulation between these two simulation models, and more efficiently verify the register transfer level (RTL) model in Matlab Modelsim In the ModelSim simulation environment, simulation is processed to VHDL that was inborn by Signalcompiler. Since the simulation is not related to hardware time sequence, it belongs to functional simulation. This simulation results are shown in Fig. 6.

B.

Figure 6. ModelSim simulation results

You might also like