【正文】
0xe0,0x60,0xe0,0xb0,0xe0,0xb0,0x00,0xe0,0xe0,0xf0,0xe0,0xf0,0x00,0x00}。......vinit_ht1621(void){ write_mand_ht1621(0x52)。 write_mand_ht1621(0x30)。 write_mand_ht1621(0x0a)。 write_mand_ht1621(0x08)。 write_mand_ht1621(0x02)。}......void led_clr(void){unsigned char i。 for (i=0。j6。i++){ display_ht1621(0x00,0x00,2*i)。}write_mand_ht1621(0x06)。 //led on}......void display_ht1621(unsigned char disp_date1,unsigned char disp_date2,unsigned char disp_add_offset){HT1621_CS=0。 //CS=0write_byte_ht1621(1,0x80)。//10100,0000,39。39。WRITE39。39。,RAM=00Hwrite_byte_ht1621(8,0x40+disp_add_offset)。write_byte_ht1621(4,disp_data1)。HT1621_WR=1。 //WR=1delay(0,50)。HT1621_CS=1。 //CS=1delay(0,50)。HT1621_CS=0。write_byte_ht1621(1,0x80)。 //CS=0//10100,0000,39。39。WRITE39。39。,RAM=00Hwrite_byte_ht1621(8,0x40+disp_add_offset+1)。write_byte_ht1621(4,disp_data2)。HT1621_WR=1。 //WR=1delay(0,50)。HT1621_CS=1。 //CS=1}......void write_mand_ht1621(unsigned char mand){HT1621_CS=0。 //CS=0write_byte_ht1621(4,0x80)。write_byte_ht1621(8,mand)。HT1621_WR=1。 //WR=1delay(0,50)。HT1621_CS=1。 //CS=1HT1621_DATA=1。 //DATA=1}......void write_byte_ht1621(unsigned char times,unsigned char data_ht1621){unsigned char i,data_tmp。 for(i=0。itimes。i++){ data_tmp=data_ht1621。 data_tmpamp。=0x80。 if(data_tmp=0x80) { HT1621_DATA=1。 //DATA=1 } else { HT1621_DATA=0。 //DATA=0 } data_ht1621=1。 HT1621_WR=0。 //WR=0。 write data by the up_edge WR single delay(0,30)。 HT1621_WR=1。 delay(0,30)。 }}4 .PID控制define filtA //PID輸出的濾波系數()define FiltB //PID輸出的濾波系數(1FilterA)define Kp //PID控制器的比例系數define Ki //PID控制器的積分系數define Kd //PID控制器的微分系數define Emax //誤差積分上限float Err[4][2]。float InteE[4][2]。float OnMs[4][2]。/*function: unsigned char pid(unsigned char i,unsigned char j,unsigned char k,unsigned char 1)description: this function for pid controlparameter: i:channel j:time k:set temprature 1:actual tempraturereturn: adjust_timeadjust time*/void pid(unsigned char ch,float refval){float DiscE,Tmpr。Err[ch][1]=refvalGetTmp(GetData7705(ch+1))。 //e(k)if(Err[ch][1]=Emax) InteE[ch][1]=InteE[ch][0]+Err[ch][1]。else InteE[ch][1]=InteE[ch][0]。DiscE=Err[ch][1]Err[ch][0]。Tmpr=Kp*Err[ch][1]+Ki*InteE[ch][1]+Kd*DiscE。OnMs[ch][1]=GetOnMs(FiltA*OnMs[ch][0]+FiltB*Tmpr)Err[ch][0]=Err[ch][1]。InteE[ch][0]=InteE[ch][1]。OnMs[ch][0]=OnMs[ch][1]。}/*function : float GetOnMs(float On Time)description : output control timeparameter: nonereturn: ftmp*/ float GetOnMs(float On Time){float ftmp。if(On Time=0) ftmp=0。else if (On Time=100) ftmp=100。else ftmp=On Time。return(ftmp)。}英文原文 A New Approach to the Harmonic Analysis of SPWM Waves 1)Faculty of Information Science and Technology 2) Department of Systems and Computer Engineering Ningbo University Carleton University Ningbo, China 315211 Ottawa, ON, Canada K1S 5B6 linweixing@ wlin@ Abstract The Sinusoidal Pulse Width Modulation (SPWM) wave is very important for the design of frequency and voltage adjustable DC to AC inverters. Currently, SPWM waves are usually generated through the pulse width modulation (PWM) pins of a singerchip microputer or digital signal processor (DSP). In order to achieve desired SPWM waves and know them better, it is essential to analyze their harmonic ponents. In this paper, we introduce a new approach to the harmonic analysis of SPWM waves based on Discrete Fourier Series (DFS) and the area equivalent principle. The developed method is convenient and the results of simulation and experiments are more accurate pared to conventional methods. The advantages of our approach are confirmed by the simulation and experimental results.Index terms: Area equivalent principle。 Sinusoidal pulse width modulation。Harmonic wave 。Discrete Fourier series.I. INTRODUCTION The SPWM wave is of key importance in the design of frequencyadjustable electronic ponents. In the past, the SPWM wave was often generated by individual medium or smallsize integrated circuits due to the plexity of required electric circuits. With the advance in digital circuits, specialized chips coupled with the use of singlechip microputers were used to generate SPWM waves in the last few years. Currently, people usually use the PWM signal from the pins of a singlechip microputer or DSP ponent to generate SPWM waves, for which the advantage is obvious: the system circuits are very simple and the software is very flexible. To be more specific, in order to generate SPWM waves, we need to use the two plimentary PWM pins to control the dead interval for which the purpose is to drive a pair of bridge arms and to avoid direct turning on the two bigpower switch tubes. For example, the 16bits singlechip microputer (such as: the 8XC196MC/MD of Intel Inc. etc.) and DSP (such as: the TMS320LF/C240X series of TI Inc. etc.) in later 90’s provides such a pair of plementary PWM pins for controlling AC motors or inverters. Next, the generation of SPWM waves based on the area equivalent principle is analyzed. The SPWM wave is deposed in the frequency domain using the DFS method. The developed scheme is found to be more accurate and simple.II. PRINCIPLE OF GENERATING SPWMWAVES BASE O