【正文】
置PWM的使能與否、每個(gè)通道的工作脈沖極性、每個(gè)通道輸出的對(duì)齊方式、時(shí)鐘源以及使用方式(八個(gè)8位通道還是四個(gè)16位通道)。PWMPRCLK=0X30。 所有PWM為左對(duì)齊PWMCTL=OXFO。 電機(jī)占空比PWME_ PWMES=1。以4KHz為采樣頻率,檢測(cè)該I/0端口的電平狀態(tài)并計(jì)數(shù),即可通過一段時(shí)間內(nèi)的計(jì)數(shù)值計(jì)算出電機(jī)轉(zhuǎn)速。數(shù)字PID算法的表達(dá)式如下列式子所示: (51) 其中為第k個(gè)采樣時(shí)刻的速度偏差值。、和可通過實(shí)際測(cè)試調(diào)整獲得,經(jīng)實(shí)測(cè),當(dāng)=1/2, =3/16, =1/16時(shí),轉(zhuǎn)速波動(dòng)幅度可控制在士1轉(zhuǎn)/秒以內(nèi)。其流程如下圖所示所示。圖58 主程序流程圖在轉(zhuǎn)速設(shè)定子程序中,數(shù)碼管閃爍顯示當(dāng)前設(shè)定轉(zhuǎn)速,并通過Keyl和Key2鍵對(duì)轉(zhuǎn)速進(jìn)行增減設(shè)置。其流程如圖所示 圖59 電機(jī)啟動(dòng)子程序本章主要對(duì)系統(tǒng)的軟件進(jìn)行了設(shè)計(jì),流電機(jī)控制和測(cè)速、PID算法實(shí)現(xiàn)調(diào)速、繼電反饋軟件設(shè)計(jì)。達(dá)到了要求系統(tǒng)具有下列功能:1:通過三個(gè)按鍵設(shè)定電機(jī)的轉(zhuǎn)速,并顯示設(shè)定值;2:可實(shí)時(shí)測(cè)量電機(jī)的實(shí)際轉(zhuǎn)速,并在LED數(shù)碼管上顯示出來;3:可對(duì)電機(jī)進(jìn)行以繼電反饋的PID自整定轉(zhuǎn)速調(diào)節(jié),當(dāng)電機(jī)參數(shù)發(fā)生變化時(shí),繼電反饋工作,測(cè)得需要用到的PID值,使其轉(zhuǎn)速趨近于設(shè)定值。 考慮到電機(jī)控制的高速、精確、穩(wěn)定和節(jié)省成本等方面的問題,出現(xiàn)了多元化發(fā)展,現(xiàn)今市面上在控制和驅(qū)動(dòng)方面出現(xiàn)了一種集成產(chǎn)品,就是控制和驅(qū)動(dòng)集成在為一件配件。 s Guide .1987.[17]Astrom K J, Hang C C, Persson and Ho W K,Towards Intelligent PID Control. Automation, 1992, 28 (1):19[18]Ho WK, Lim and Xu Wen, Optimal gain and phase margin tuning for PID controllers Automation, 1998,vo1,34,No,8:10091011[19]M Zhuang, ,Automatic tuning of optimum PID controllers[J], IEE proceedings Control and Application, 140:216224[20]D. F. Geiger Phaselocks Loops for DC Motor Speed Control[M].John Wileyamp。s interest. In order to obtain the improvement, the stochastic PWM method arises at the historic moment. !ts principle is the stochastic change turnon frequency causes the electrical machinery electromagnetism noise to be limited to approximately the belt white noise (in linear tiequency coordinate system, various frequencies energy distribution is even), although the noise a decibel number has not always changed, but weakens greatly take the fixed turnon frequency as the characteristic colored noise intensity. Because of this, even if in 1GBT by widespread application today has had to limit regarding the carrier frequency is paring the low frequency the situation, stochastic PWM still had its special value: On the other hand explained eliminates the machinery and the electromagnetism noise best method enhances the operating frequency blindly, the stochastic PWM technology was precisely provides an analysis, has solved this kind ofqucstion brandnew mentality.Spatial voltage vector control PWM Spatial voltage vector control PWM (SVPWM) also calls the magnetic flux sine PWM law .It take the threephase profile whole production eficet as the premise, take approaches the electrical machinery air gap the ideal circular rotary field path as the goal, has the actual magnetic flux with the inventor ditTcrent sv}itett pattern to approach the base director circle magnetic flux, by theirs parison result decided the inventor the switch, forms the PWM profile. This law embarks from the electric motor angle, regards as the inventor and the electrical machinery a whole, inscribes the polygon to approach the circle the way to carry on the control, causes the electrical machinery to obtain the peaktopeak value constant circular magnetic field(sine magnetic flux). The concrete method divides into the magnetic flux splitring type and themagnetic flux closed loop type. The magnetic flux splitring law synthesizes anequivalent voltage vector with a two nanvanishing vector sum null vector, if the sampling time enough is small, may synthesize the random voltage vector. When this law output r。 A temperature regulator must maintain the temperature of say, an oven constant despite the heat loss in the oven. A voltage regulator must also maintain must output voltage constant despite variation in the load current. For any system to provide an output, ., speed, temperature, voltage, etc, an error signal must exist under steadystate conditions.electrical brakingIn many speed control system, ., rolling mills mine winders, etc., the load has to be frequently brought to a standstill and reversed. The rate at which the speed reduces following a reduced speed demand is dcpdent on the stored crgy and the braking system used. A small speed control system (sometimes known as a velodyne) can employ mechanical braking, but this is not feasible with large speed controllers since it is difficult and costly to remove the heat generated.The various methods of electrical braking avaiable are:(I)Regenerative braking.(2) Eddy current braking(3) Dynamic braking.(4) Reverse current braking(plugging).Regenerative braking is the best method, though not necessarily the most economic. The stored energy in the load is converted into electrical energy by the work motor(acting temporarily,a gcrator) and is returned to the power supply system, The supply system thus acts as a sink into which the unwanted energy is delivered. Providing the supply system has adequate capacity, the consequent rise in terminal voltage will be small during the short periods of regeneration. In the WardLeonard method of speed control of DC motors, regenerative braking is inherent, but thyristor drives have to be arranged to invert to regenerate. Induction motor driver can regcrate if the rotar shaft is driven faster than speed of the field. The advent of lowcost variable variablefrequency supplies from rotating Thyristor inverters have brought about considerable charges in the use of induction motors in variable speed drives. Eddy current braking can be applied to any machine, simply by mounting a copper or aluminium disc on the shaft and rotating it in a magnetic field. The problem of removing the heat generated is severe in large system as the temperature of the shaft, bearing, and motor will be raised if prolonged braking is applied.In dynamic breaking, the stored energy is a resistor in the circuit. When applied to small DC machines, the armature supply is disconnected and a resistor is connected across the armature (usually by a relay, contactor, or thyristor). The field voltage is maintained, and braking is applied down to the lowest speed. Induction motors require a somewhat more plex arrangement, the stator windings being disconnected from the AC supply and reconne