【正文】
唐 山 學(xué) 院畢 業(yè) 設(shè) 計設(shè)計題目:基于AVR單片機(jī)的開關(guān)電源的設(shè)計與實現(xiàn) 系 別: 信息工程系 班 級: 姓 名: 2012年6月10 日基于AVR單片機(jī)的開關(guān)電源的設(shè)計與實現(xiàn)摘 要電源是電子設(shè)備中不可缺少的功能模塊,是各種電器設(shè)備的能量的來源,其性能的優(yōu)劣直接影響電子設(shè)備的技術(shù)性能與其可靠性。因此,能否設(shè)計出性能良好的電源是電子設(shè)備是否能夠高效、可靠運行的一個基本保障。本設(shè)計是以Atmega8單片機(jī)作為主要控制器,制作輸出電壓可以調(diào)節(jié)的開關(guān)電源。該系統(tǒng)不僅可以預(yù)置輸出電壓而且還可以調(diào)節(jié)輸出電壓,并具有過流保護(hù)、短路保護(hù)以及數(shù)碼管顯示等功能。本論文主要講述的是由單片機(jī)產(chǎn)生PWM波來控制功率管的通斷。通過單片機(jī)內(nèi)部集成的AD轉(zhuǎn)換器檢測輸出電壓,并和預(yù)置電壓進(jìn)行比較得到誤差信號,調(diào)用調(diào)節(jié)函數(shù)實現(xiàn)穩(wěn)壓。單片機(jī)可以通過鍵盤來改變輸出電壓的大小,從而修改PWM波的占空比來調(diào)節(jié)輸出電壓的大小。開關(guān)電源的輸出電壓以及輸出電流可以通過數(shù)碼管來顯示,當(dāng)線路發(fā)生短路或者過載時都會通過數(shù)碼管的示數(shù)顯示出來。本開關(guān)電源的主要性能有穩(wěn)壓效果好、效率高、輸出電壓可調(diào)、響應(yīng)速率快。關(guān)鍵詞:開關(guān)電源 單片機(jī) 電壓可調(diào) 電壓顯示 The Design and Implementation of Switching Power Supply Based on MCUAbstractTo electronic equipments, power is a indispensable function module. It is the energy source of all sort of electric equipment . And the performance of the power influences the technical characteristics and reliability of the electronic equipment. Therefore, it is the basic of the electronic equipments’ efficient and reliable operation that if we can design the good power or not.This design makes a power whose output voltage can be adjusted based on Atmega8 MCU as a main controller,. The system can not only preset the output voltage but also adjust the output voltage, and it has functions such as the flow protection, short circuit protection and digital pipe display. This thesis is about that PWM waves generated by MCU can control the hige power tube. It can test the output voltage through MCU integrated AD converter, and get error signals by parison of preset voltage, and stabilize voltage by calling adjustment function. MCU can change the size of the output voltage through the keyboard modifying the PWM waves’ buty cycle. Switch power’s output voltage and output current can be show through the digital tube, and it can be show by the digital when the line shortcircuited or overload happened. The switch power has a good effect to stabilize the voltage, high efficiency, and its output voltage can be adjusted, and its response speed is high.Key words: Switching power 。PWM 。Voltage adjustable 。Voltage display目 錄1 引言 12 開關(guān)電源方案設(shè)計 3 3 3 43 系統(tǒng)核心器件選擇 6 6 6 Atmega8I/O口概述 8 Atmega8的AD功能 9 ADC功能簡介 9 ADC相關(guān)寄存器 10 Atemga8的PWM功能 14 PWM波形發(fā)生器選擇 14 164硬件電路設(shè)計 17 17 17 17 18 18 18 19 20 215系統(tǒng)軟件設(shè)計 23 23 24 24 ADC轉(zhuǎn)換子程序設(shè)計 25 調(diào)節(jié)函數(shù)子程序設(shè)計 266系統(tǒng)調(diào)試 28 28 28 317 PCB電路板的繪制以及制作 33 33 PCB圖繪制 33 PCB電路板的制作流程 33 348 結(jié)論 35謝辭 36參考文獻(xiàn) 37附錄 38附錄一 總體設(shè)計電路圖 38附錄二 制作樣機(jī)圖 39附錄三 器件清單 41附錄四 源程序 42外文資料 52Stepper motor is a kind of pure digital control motor and brushless dc motor controlled by electric pulse signal type. Stepper motor is the core of the modern orientation drive, widely used in machinery, electric power, textile, electronics, instruments, printing and aerospace, ships, weapons, and other areas of the defense industry, etc. The characteristics of the stepping motor control system based on single chip microputer include high stability, low cost, convenient control and wide application , etc.The IR remote control is used as rhe input to the contrler, which can send an input signal of mand for the the design of the stepper motor control system with the single chip processor as the core processor. The remote control can change the rotation states of stepper motor and the running status can be showed on LCD1602 display.The infrared remote control with carrier for 38 KHZ is used as the control end of the user, which can convert the users’ mands into the infrared signal. The TL1838 can receive the infrared signal and convert it into electrical signal, which input to MCU can obtain instructions of users by processing the ining signal and control stepping motor of the 28BYJ48 type, the current status can be shown by LCD1602. Users can control acceleration, deceleration, forward, inversion for the stepping motor. The features of the control system of stepper motor includes high precision, stable running, convenient control and simple maintenance and wide application, etc.1 引言電源技術(shù)是一種綜合電力變換技術(shù)、現(xiàn)代電子技術(shù)、自動控制技術(shù)等的多學(xué)科應(yīng)用功率半導(dǎo)體器件的邊緣交叉的技術(shù)。它對電子儀器、工業(yè)自動化、現(xiàn)代通訊、計算機(jī)、國防、電力工程以及某些高新技術(shù)提供高效率、高質(zhì)量、高可靠性的電源起著關(guān)鍵性的作用。而隨著科學(xué)技術(shù)的發(fā)展,電源技術(shù)又與微電子技術(shù)、電機(jī)工程、材料科學(xué)、現(xiàn)代控制理論等許多領(lǐng)域密切相關(guān)。當(dāng)代許多高新的技術(shù)均與市電的電流、電壓、相位、頻率、以及波形等基本參數(shù)的控制和變換相關(guān),電源技術(shù)可以實現(xiàn)對這些參數(shù)的精密控制及高效率處理,尤其是可以實現(xiàn)大功率的電能頻率的變換,從而為多項高新技術(shù)的發(fā)展提供有力的支持。電源技術(shù)以及其產(chǎn)業(yè)的進(jìn)一步發(fā)展必將為降低材料消耗、大幅度節(jié)約電能以及提高生產(chǎn)效率提供重要的手段。所以,不僅電源技術(shù)其本身是一項高新的技術(shù),亦為其他多項高新技術(shù)的發(fā)展基礎(chǔ)。電源,現(xiàn)如今已經(jīng)是非常重要的基礎(chǔ)科技以及產(chǎn)業(yè),從日常生活到高尖端的科技,都離不開電源技術(shù)的參與與支持,電源技術(shù)亦正是在這種環(huán)境中不斷的發(fā)展以及壯大起來的。電源的重要性不能否認(rèn),但是傳統(tǒng)電源存在著不足的地方,比如,傳統(tǒng)的電源效率不高,線性電源由于功率管是工作在線性放大狀態(tài),輸出電流和功率管的電流是成正比的,因此當(dāng)輸出電流越大時,功耗就越大。通常情況下,線性電源效率只有40~50%左右,因此,提高電源效率是電源發(fā)展中應(yīng)重點解決的問題,而開關(guān)電源就能夠很好地解決這個問題,開關(guān)電源的功率開關(guān)管是工作在開關(guān)狀態(tài)的,亦是說,只要開關(guān)管導(dǎo)通,管子就會產(chǎn)生損耗,因此,開關(guān)電源的效率比線性電源要高很多,一般情況下可以達(dá)到80%以上,本設(shè)計選擇開關(guān)電源作為研究對象,利用其輸出電壓和輸入電壓之間的占空比的關(guān)系,假定輸入基本上是穩(wěn)定的,利用單片機(jī)控制占空比,就可以控制輸出電壓,通過A/D轉(zhuǎn)換,采樣輸出電壓,并使用數(shù)碼管顯示,然后通過鍵盤預(yù)置電壓,最終完成可調(diào)開關(guān)電源的制作。本文研究的單片機(jī)控制開關(guān)電源,可以通過鍵盤預(yù)置期望的輸出電壓值,通過A/D轉(zhuǎn)換器對輸出的電壓值進(jìn)行采樣,由軟件控制單片機(jī)輸出相應(yīng)占空比的脈沖寬度,對開關(guān)電源進(jìn)行脈寬調(diào)制,輸出預(yù)期的電壓值,并采用調(diào)節(jié)函數(shù)控制輸出電壓穩(wěn)定,構(gòu)成可輸出1V到14V的可調(diào)電壓,并顯示實時電壓和預(yù)置值。目前電子設(shè)備的日益小型化更需要供電電源的小型化,因此,制作小型化電源是未來電源制作發(fā)展的一個趨勢,傳統(tǒng)的開關(guān)電源線路一般都是很復(fù)雜體積也比較大,如果使用的單片機(jī)作為控制核心,那么必將可以大大地簡化電源的結(jié)構(gòu),為制作更加小的電源提供很大的可能,并且,使用單片機(jī)可以擴(kuò)展出許多的功能,如顯示、可維護(hù)性強、實時控制調(diào)整電壓。由于目前國內(nèi)擁有的專門的PWM輸出的單片機(jī)價格很昂貴,普通的單片機(jī)I/O口模擬的脈寬頻率又太低,速度太慢,遠(yuǎn)遠(yuǎn)達(dá)不到現(xiàn)代電源要求的工作頻率,因此,目前單片機(jī)控制的電源的使用并不廣泛,但是單片機(jī)在智能化、擴(kuò)展性強、可實現(xiàn)的人機(jī)交互界面等方面的優(yōu)勢使其成為未來電源的重要發(fā)展的方向。所以,我們研究單片機(jī)控制的開關(guān)電源,非常具有現(xiàn)實意義以及研究意義。開關(guān)電源的效率往往是與開關(guān)管的變換速度成正比的,要進(jìn)一步提高開關(guān)電源的效率,就必須要提高電源的工作頻率。但是頻率提高之后,對整個電路中的元器件又有了新的要求。要進(jìn)一步研制并且生產(chǎn)出適合于高頻工作的儲能電感、開關(guān)管、開關(guān)變壓器、高頻電容等元器件是開關(guān)電源設(shè)計與實現(xiàn)所面臨的另一個問題。由于開關(guān)電源中,功率晶體管工作在開關(guān)狀態(tài),當(dāng)開關(guān)速度提高之后,會受到電路中分布的電感以及電容成分或者二極管中儲存的電荷的影響從而產(chǎn)生了較大的浪涌和噪聲,使其交變電流和電壓會通過電路中的元器件產(chǎn)生較強的諧波干擾以及尖峰干擾,這些尖峰電壓或電流可能會損壞電路當(dāng)中的器件,同時這些諧波以及尖峰干擾會污染市電電網(wǎng),影響鄰近的電子儀器與設(shè)備的正常性工作。雖然也可以采取一些抑制干擾的措施,在一定程度上降低這些干擾的影響,但是目前階段的精密電子儀器中,仍然難以使用開關(guān)電源,因此,克服開關(guān)電源產(chǎn)生的各種噪聲干擾,是我們要努力解決的第三個問題。近年來開關(guān)電源的發(fā)展速度越來越快,而且其應(yīng)用越來越廣泛。本文著重研究基于Atmega8單片機(jī)的開關(guān)電源設(shè)計與實現(xiàn)的基本原理、硬件組成以及設(shè)計、程序編寫與調(diào)試、硬件電路PCB的繪制以及樣機(jī)的制作等。2 開關(guān)電源方案設(shè)計開關(guān)電源指的是功率管工作在開關(guān)方式,即功率管工作在截止和導(dǎo)通狀態(tài)的電源,縮寫為SPS