【正文】
I 摘 要 本文主要設(shè)計(jì)一個(gè)基于 單片機(jī) 的 直流電機(jī) PWM 控制系統(tǒng)。 PWM 控制提高了調(diào)速范圍, 提高了調(diào)速精度,改善了快速性能、功率和功率因數(shù)。 系統(tǒng)在設(shè)計(jì)中 被控對(duì)象 采用 5V 的直流電機(jī), 以 MCS51 單片機(jī)為控制核心, 采用 LCD1602 液晶作為顯示元件,進(jìn)行 軟硬件的設(shè)計(jì)。硬件電路由 protel 設(shè)計(jì)制作, 主要設(shè)計(jì)了液晶顯示電路、鍵盤控制電路、時(shí)鐘電路、 復(fù)位電路、 霍爾測(cè)速電路和驅(qū)動(dòng)電路。 軟件設(shè)計(jì)在 Keil 開(kāi)發(fā)平臺(tái)用 C語(yǔ)言編寫,程序采用模塊化設(shè)計(jì)方案, 包括液 初始化程序、 晶顯示程序、鍵盤控制程序、時(shí)鐘中斷程序。 本系統(tǒng) PWM 控制直流電機(jī)采用調(diào)壓調(diào)速的方法,整體設(shè)計(jì)包括軟件和硬件兩個(gè)部分。 通過(guò)利用單片機(jī)產(chǎn)生 PWM 控制信號(hào)控制直流電機(jī),詳細(xì)介紹脈寬調(diào)制( PWM)控制原理,直流電機(jī)的工作原理和數(shù)學(xué)模型以及 用 H 型橋電路基本原理 設(shè)計(jì)的驅(qū)動(dòng)電路。通過(guò)硬件電路的模擬情況 ,說(shuō)明系統(tǒng)運(yùn)行正常,各個(gè)功能模塊實(shí)現(xiàn)是可行的,控制精度比較高,能夠滿足系統(tǒng)的基本要求。 關(guān)鍵字 : 單片機(jī); PWM; 直流電機(jī) II Abstract In this paper, it is designed by using PWM speed control system to control the speed of DCmotor based microcontroller. PWM speed control system can improve the speed range and speed accuracy, it also can improved speed performance, power and power factor. Controlled object in the design of the system is a 5V DCmotor controlled by MCS51 microcontroller as the core, using LCD1602 as the display device. Based which we can begin the hardware and software design. The hardware circuit is designed by the software of Protel which contains the circuit design of the liquid crystal display, the keyboard control circuit, clock circuit and reset circuit, the Hallspeed circuit and drive circuit. Software development platform used in the Keil C language, the program is modular in design, including liquid crystal display program, the keyboard control program and clock interrupt routine. The system uses voltage DCmotor PWM speed control method. Overall design includes two parts of software and hardware design. The DCmotor is controlled through the use of single chip PWM control signal, and detailed pulsewidth modulation (PWM) control theory, the working principle of DCmotor and mathematical models and Hbridge circuit with the basic principles of design of the drive circuit. Hardware circuit simulations, indicates that the system is operating normally and each functional module is feasible, especially control precision is relatively high. The system can meet the basic requirements. Key words: Single Chip Microcontroller; PWM; DCmotor III 目 錄 緒 論 ........................................................................................................................................ 1 1 系統(tǒng)的總體分析與器件的選擇 .......................................................................................... 3 本系統(tǒng)的設(shè)計(jì)方案 .................................................................................................... 3 單片機(jī)電路的介紹 .................................................................................................... 3 2 系統(tǒng)硬件結(jié)構(gòu)的設(shè)計(jì) .......................................................................................................... 7 時(shí)鐘電路 的設(shè)計(jì) ........................................................................................................ 7 復(fù)位電路的設(shè)計(jì) ........................................................................................................ 8 液晶顯示器電路的設(shè)計(jì) ............................................................................................ 9 液晶顯示元件的選擇 ...................................................................................... 9 液晶顯示元件 1602 ......................................................................................... 9 液晶顯示電路設(shè)計(jì) ........................................................................................ 11 鍵盤控制電路的設(shè)計(jì) .............................................................................................. 12 霍爾測(cè)速電路的設(shè)計(jì) .............................................................................................. 13 驅(qū)動(dòng)電路的設(shè)計(jì) ...................................................................................................... 14 直流電機(jī)簡(jiǎn)介 ................................................................................................ 14 直流電機(jī)調(diào)速 ................................................................................................ 16 H 型橋驅(qū)動(dòng)電路 ............................................................................................ 16 3 系統(tǒng)軟件程序的設(shè)計(jì) ........................................................................................................ 19 系統(tǒng)的軟件主程序設(shè)計(jì) .......................................................................................... 19 系統(tǒng)初始化子程序設(shè)計(jì) .......................................................................................... 20 LCD 液晶驅(qū)動(dòng)子程序設(shè)計(jì) ..................................................................................... 21 鍵盤控制子程序設(shè)計(jì) .............................................................................................. 22 時(shí)鐘中斷子程序設(shè)計(jì) .............................................................................................. 22 4 系統(tǒng)的調(diào)試 ........................................................................................................................ 24 硬件調(diào)試 .................................................................................................................. 24 軟件調(diào)試 .................................................................................................................. 25 系統(tǒng)的編譯器和燒錄軟件 ...................................................................................... 26 結(jié) 論 ...................................................................................................................................... 34 IV 致 謝 ...................................................................................................................................... 35 參考文獻(xiàn) .................................................................................................................................. 36 附錄 A 英文原文 .................................................................................................................. 37 附錄 B 漢語(yǔ)翻譯 ..................................................................................