基于51系列单片机的直流电机PWM调速系统设计
- 格式:doc
- 大小:435.50 KB
- 文档页数:15
西安交通大学城市学院
本科毕业设计(论文)开题报告
题目基于51单片机的PWM
直流电机调速系统设计
所在系电气与信息工程系
学生姓名 XX
专业测控技术与仪器
班级测控XXX学号 XXXXX
指导老师 XXXXXX
教学服务中心制表
2014年3月
B=KP [1+2T/TI+TD /T]
C=KP KD /T
式中 KP———比例系数;
T———采样周期;
TD———微分周期;
TI———积分周期;
KI———积分系数,KI= KP T/TI;
KD———微分系数,KD=TD /T。
(4)在Proteus环境下系统的硬件电路和仿真
利用Proteus软件对各个子电路及整体电路进行了仿真,确保设计的电路能够满足性能指标要求,并给出了仿真结果。
完成本课题所需的工作条件(如工具书、计算机、实验、调研等)及解决办法KEILC 和Proteus软件、计算机
4、系统流程图如下:。
基于51系列单片机的直流电机PWM调速系统设计
随着社会的发展,直流电机作为机械设备中重要的驱动件,已经被越来越多的应用起来,而PWM(脉冲宽度调制)技术是控制直流电机转速的有效方法。
本文介绍了一种基于
51系列单片机的直流电机PWM调速系统设计,该调速系统可以实现对直流电机的转速调节。
首先,本文详细描述了该调速系统的硬件结构,包括51系列单片机控制器,PWM模块,旋转编码器,按键,LED指示灯,直流电机等构成组件。
其中,51系列单片机控制器负责
信号的采集和处理,PWM模块负责调节直流电机的转速,旋转编码器负责实时测量直流电
机的转速,按键和LED指示灯则用于进行键盘操作和系统状态指示。
接着,本文提出了该系统的主要程序流程设计。
首先,通过旋转编码器获取当前直流
电机的转速,并经过51系列单片机的实时校准,作为调节直流电机的转速的PWM信号的
参考值。
然后,通过按键输入参考值,调节PWM模块的输出比例,从而调节直流电机的转速。
最后,将调节结果通过LED指示灯反馈出来,用于系统状态的指示。
整个调速系统的设计都在51系列单片机上完成,功能完善。
基于单片机的直流电机PWM调速控制系统的设计第一章:前言1.1前言:直流电机的定义:将直流电能转换成机械能(直流电动机)或将机械能转换成直流电能(直流发电机)的旋转电机。
近年来,随着科技的进步,直流电机得到了越来越广泛的应用,直流具有优良的调速特性,调速平滑,方便,调速范围广,过载能力强,能承受频繁的冲击负载,可实现频繁的无极快速起动、制动和反转,需要满足生产过程自动化系统各种不同的特殊要求,从而对直流电机提出了较高的要求,改变电枢回路电阻调速、改变电压调速等技术已远远不能满足现代科技的要求,这是通过PWM方式控制直流电机调速的方法就应运而生。
采取传统的调速系统主要有以下的缺陷:模拟电路容易随时间飘移,会产生一些不必要的热损耗,以及对噪声敏感等。
而用PWM技术后,避免上述的缺点,实现了数字式控制模拟信号,可以大幅度减低成本和功耗。
并且PWM调速系统开关频率较高,仅靠电枢电感的滤波作用就可以获得平滑的直流电流,低速特性好;同时,开关频率高,快响应特性好,动态抗干扰能力强,可获很宽的频带;开关元件只需工作在开关状态,主电路损耗小,装置的效率高,具有节约空间、经济好等特点。
随着我国经济和文化事业的发展,在很多场合,都要求有直流电机PWM调速系统来进行调速,诸如汽车行业中的各种风扇、刮水器、喷水泵、熄火器、反视镜、宾馆中的自动门、自动门锁、自动窗帘、自动给水系统、柔巾机、导弹、火炮、人造卫星、宇宙飞船、舰艇、飞机、坦克、火箭、雷达、战车等场合。
1.2本设计任务:任务: 单片机为控制核心的直流电机PWM调速控制系统设计的主要内容以及技术参数:功能主要包括:1)直流电机的正转;2)直流电机的反转;3)直流电机的加速;4)直流电机的减速;5)直流电机的转速在数码管上显示;6)直流电机的启动;7)直流电机的停止;第二章:总体设计方案总体设计方案的硬件部分详细框图如图一所示。
示数码管显PWM单片机按键控制电机驱动基于单片机的直流电机PWM调速控制系统的设计键盘向单片机输入相应控制指令,由单片机通过P1.0与P1.1其中一口输出与转速相应的PWM脉冲,另一口输出低电平,经过信号放大、光耦传递,驱动H型桥式电动机控制电路,实现电动机转向与转速的控制。
Chapter 1 Overview of DC Motor Speed Regulation1.1 DC motor speed regulation principleAccording to the different e*citation modes of DC motors, DC motors are divided into two types: self-e*citation and separate e*citation. The mechanical characteristic curves of DC motors with different e*citation modes are different. But there is the following formula for the speed of DC motor: n=U/Cc-TR /CrCc where: u-voltage; —resistance of e*citation winding itself; —magnetic flu* per pole (WB); Cc-potential constant; Cr-Torque constant. It can be seen from the above formula that the speed control of DC motor can be either armature control method or magnetic field control method. Magnetic field control method controls magnetic flu*. Although its control power is small, it is limited by saturation of magnetic pole at low speed, commutation spark and structure strength of commutator at high speed, and its dynamic response is poor due to large inductance of e*citation coil. Therefore, the commonly used method in industrial production is armature control method.φ-TRφR内—励磁绕组本身的电阻;φ—每极磁通Figure 1-1 Working schematic diagram of DC motorArmature control is to add the control voltage signal to the armature of the motor under the condition of constant e*citation voltage to control the speed of the motor. It is widely used in industrial production, among which pulse width modulation (PWM) is more widely used. Pulse width regulation uses a fi*ed frequency to control the on or off of the power supply, and changes the average voltage by changing the "on" and "off" time in a cycle, that is, changing the "duty ratio" of the voltage on the armature of the DC motor, so as to control the speed of themotor. Therefore, PWM is also called "switch drive device".Figure 1-2 Relationship between armature voltage duty ratio and average voltageAccording to the above figure, if the ma*imum speed of the motor is vma* and the duty cycle is D=/T when the motor is always powered on, the average speed of the motor is:, so itV=V*D,可见只要改变占空比can be obtained by changing the duty cycle D.1/T D m a xTo different motor speeds, so as to achieve the purpose of speed regulation.1.2 Implementation of DC speed regulation systemPWM speed regulation system is the main control circuit: PWM is realized by software based on single chip microcomputer. In PWM speed regulation system, duty ratio D is an important parameter. Under the condition of constant power supply voltage ud, the average value of armature terminal voltage depends on the duty ratio D. Changing the value of D can change the average value of armature terminal voltage to achieve the purpose of speed regulation. There are three ways to change the value of duty ratio D: A, fi*ed width frequency modulation method: keep t1 unchanged and only change T, so that the period (or frequency) will also change. (Figure 1-2) B. Width-modulation and frequency-modulation method: keep T constant and only change t1, so that the period (or frequency) will also change. (Figure 1-2) C. Fi*ed frequency and width modulation method: keep the period t (or frequency) constant, and change t1 and t at the same time. (Figure 1-2)The first two methods change the period (or frequency) of the control pulse when adjusting the speed. When the frequency of the control pulse is the same as that ofWhen the natural frequency of the system approaches, it will cause oscillation, so the method of fi*ed frequency and wide width is often used to change the duty cycle.So as to change that voltage across the armature of the DC motor.1.3 89C51 single chip microcomputer89C51 MCU interface is shown in Figure 1-3:Figure 1-3 89C51 Single Chip MicrocomputerChapter 2 Hardware Circuit Design2.1 program realization of PWM waveformWith the development of computer technology and power electronics technology, it is veryfle*ible and practical to realize PWM waveform by software method. The 89C51 single chip microcomputer is used as the control core, and the clock counter TO with the frequency of12MHz is used as the timer. It works in mode 1, and the timing time is 0.1 ms. If the frequency of PWM waveform is 50 Hz and the duty ratio is 1: 1, the value loaded into the 30H and 31H units with R0 is initially 100. If the key is used to generate interrupt call in the program to change the values of 30H and 31H units, the duty ratio can be changed. The system flow chart is shown in Figure 2-1:Figure 2-1 Program Flow Chart2.2 DC motor driveIn the driving of DC motors, IGBT is often used as the main switching element for high-power motors, and power field-effect transistors are often used for medium and small-power motors. In addition, integrated circuits can be used to drive the motors, and integrated circuits L298 are used in the system to drive the motors.Figure 2-2 Pin diagram of internal structure and function of L298L298 is a dual-H high-voltage high-current power integrated circuit. It is directly controlled by L logic level and can be driven.Inductive loads such as relays, DC motors and stepping motors. There are two identical power amplification circuits in it. Its internal structure and pin functions are shown in Figure 2-2.L298 Pin Symbol and FunctionSENSA and SENSB: current feedback pins of two H-bridges, which can be directly grounded when not in use.ENA, ENB: enable terminal, input PWM signalIN1, IN2, IN3, IN4: input terminal, TTL logic level signal1, OUT2, OUT3, OUT4: output terminals, with the same logic as the corresponding input terminals.VCC: logic control power supply, 4.5~7V GND: groundVSS: motor driving power supply, the minimum value of which should be higher than the input low-level voltage.When the enable terminal is at a high level, the input terminal IN1 is a PWM signal, and when the input terminal IN2 is at a low level, the motor rotates forward; When the input terminal IN1 is a low-level signal and IN2 is a PWM signal, the motor reverses; ; At the same time of IN1 and IN2, the motor stops quickly. When the enable terminal is at a low level, the motor stops rotating.2.3 design of freewheeling circuitBecause the motor has great inductance, the current can't suddenly change. If the current is cut off suddenly, it will generate high voltage at both ends of the power tube and damage the device. In this circuit, we use a diode to follow the current, and make use of the unidirectional conductivity of the diode. The selection of diode should be determined according to thefrequency of PWM and the current of motor. The diode should have fast enough recovery time and sufficient current bearing capacity.Because the motor has great inductance, if the current suddenly changes, it will easily damage the power arm, that is, L298 chip. Add a wash-and-follow circuit to the protection chip. The working principle of the circuit is shown in Figure 3.7.Working principle of the circuit:When the motor is rotating forward, if there is a sudden power failure, D1 and D4 are turned on, and D2 and D3 are turned off; When the motor reverses, D2, D3 turn on and D1, D4 turn off when suddenly powered off.Figure 2-3 Working schematic diagram of freewheeling circuitChapter III Software Design3.1 Main program designThe main program mainly completes the initialization, sets the timing constant and interrupts the entry program, and the main program is constantly in the state of waiting for interrupts.ORG 0000HAJMP STARTORG 0003HLJMP INT0; T0 interruptORG 000BHLJMP ITT0; T1 interruptORG 0030H ; System initializationSTART: MOV SP,#60H ; Initial value stack pointerMOV R0,#00H ; Send value 0 to R0.MOV R1,#00H ; Send value 0 to R1.CLR P1.5; Set to 0CLR P1.6; Set to 0CLR P1.7; Set to 0MOV TMOD,#01H ; Write control word control modeMOV TL0,#0FFH; Set timing constantMOV TH0,#0FFHSETB EA ; Allow interruptSETB E*0; Allow e*ternal interrupt 0SETB ET0 ; Allow TL0 interruptCLR IT0SETB TR0 ; Start TL03.2 Digital Display DesignP1.1 and P1.2 ports are used to control the digital number, and the number display is realized by looking up the table and calling the delay.Program code:MOV DPTR,#TABMOV 40H,#0; Clear 0MOV 41H,#0; Set to 0LED: SETB P1.1; P1.1 set to 1.CLR P1.2 ; P1.2 cleared to 0.MOV A,40H ; Send the content of 40H to A.MOVC A,@A+DPTR ; table look-atMOV P0,A; The value of a found in the table is sent to port P0.LCALL TTS ; Call delayCLR P1.1 ; P1.1 cleared to 0.SETB P1.2; P1.2 set to 1.MOV A,41H ; Send the content of 41H to A.MOVC A,@A+DPTR ; table look-atMOV P0,A; The value of a found in the table is sent to port P0.LCALL TTS ; Call delayCLR P1.2 ; P1.2 the mouth is cleared.LJMP LED; Jump to LEDORG 2000HTAB: DB 40H,79H,24H,30H,19HDB 12H,02H,78H,00H,10H3.3 Functional programmingAfter the interruption, switch to the corresponding function key program, which is acceleration, deceleration, forward rotation, reverse rotation and pause.Program code:ITT0: CPL P1.5 ; P1.5 reversal of mouthJNB P1.5,Z1MOV A,#0FFH; Low level timing SUBB A,R0MOV TH0,ASETB TR0 ; Start TL0RETIZ1:MOV TH0,R0 ; High level timing SETB TR0RETIINT0:CLR E*0; Implement keyboard control. MOV A,#0FFHMOV P2,AMOV A,P2JNB ACC.0,JIAJNB ACC.1,JIANJNB ACC.2,FFFigure 3-2 digital display flow chart Figure 3-3 interrupt subroutine flow chart JNB ACC.3,ZZJNB ACC.4,TZAJMP CCJIA: CJNE R0,#0FFH,AA ; Achieve motor accelerationAJMP CCAA: MOV A,R0ADD A,#25MOV R0,AAJMP CCJIAN: CJNE R0,#00,BB ; Achieve motor decelerationAJMP CCBB: MOV A,R0SUBB A,#25MOV R0,AAJMP CCCC: MOV A,R0 ; Digital displayMOV B,#25DIV ABMOV B,#10DIV ABMOV 40H,AMOV 41H,BSETB E*0LCALL TTS; Call delayLCALL TTS; Call delayLCALL TTS; Call delayLCALL TTS; Call delayRETIFF: SETB P1.6 ; Motor reverse transmissionCLR P1.7LCALL TTSLCALL TTSLCALL TTSSETB E*0RETIZZ:CLR P1.6; Motor ForwardSETB P1.7LCALL TTSLCALL TTSLCALL TTSSETB E*0RETITZ: CLR P1.6 ; The motor stops.CLR P1.7LCALL TTSLCALL TTSLCALL TTSSETB E*0RETITTS: MOV R3,#0E0H ; Delay subroutine TT1S: MOV R4,#40HTT0S: DJNZ R4,TT0SDJNZ R3,TT1SRETEND3.4 Simulation diagramIn this design, Proteus software is used for simulation. The simulation results are shown in Figure 3-4:Figure 3-4 Simulation DiagramThe display of the corresponding motor is shown in Figure 3-5.Figure 3-5 Simulation Results3.5 Analysis of simulation resultsWhen the simulation starts running, each module is in the initial state. Click the independent keyboard acceleration or deceleration button on the right. The display module starts to display numbers, and then click forward or reverse. The driving module of the motor can realize the operation of forward rotation, reverse rotation, acceleration, deceleration and stop of the motor. And the working voltage of the motor changes when the duty ratio of the PWM pulse is changed. Therefore, it can be seen from the simulation results that this design can get the e*pected simulation results.feelings and e*periencesThrough this course design, I learned a lot of knowledge that I can't learn in books, and I deeply realized the wide application of single-chip microcomputer technology. Not only have I consolidated my knowledge of MCU, but also I am more interested in the course of MCU. In the course of this course design, I learned to find the hardware resources related to this design on the Internet, including: PWM speed regulation of DC motor, AT89C51 single chip microcomputer, L289 pin diagram and its pin function, etc., which provided some information for this course design.In the early stage of curriculum design, it is very difficult and there is no clue. By turning to teacher Zhang, I cleared my mind. At the same time, consulting materials in the library and online has overcome the difficult problems in curriculum design. Finally, the teacher Zhang's patient guidance and continuous struggle are the basic qualifications. As long as you have a clue, it will be much easier. I can finish this design independently, which is a great achievement. The total feelings are as follows:1. Through this design, I not only have a deeper understanding of single-chip microcomputer, but also how about a subject?Have a certain understanding of drawing flow charts, programming, etc.2. Further strengthened my hands-on ability and the ability to use professional knowledge, and learned how to think and solve problems, and how to fle*ibly change methods to realize the design scheme. In particular, I deeply realized the importance of the combination of software and hardware, and the relationship and cooperation between them.3. Let me know the importance of SCM technology to people's life today. At the same time, the e*perience of doing curriculum design has also benefited me a lot, and made me know that everything should be done in a down-to-earth manner and diligently. Only in this way can I do well.references[1] Li Chaoqing, Principle and Interface Technology of Single Chip Microcomputer (concise revision) [M], Beijing University of Aeronautics and Astronautics Press, 1998.[2] Li Guangdi, Fundamentals of Single Chip Microcomputer [M], Beijing University of Aeronautics and Astronautics Press, 1994.[3] Yan Shi, Fundamentals of Digital Electronic Technology (3rd Edition) [M], Higher Education Press, 1989.[4] Liao Changchu, Overview of Fieldbus [J], Electrical Technology, 1999[5] Yu Yong*ue, Ge Jian, 1-WIRE bus digital temperature sensor DS18B20 and its application [J], Electronic Products World, 2003.[6] Chen Yuedong, Principle and Application of DS18B20 Integrated Temperature Sensor [J], Journal of Anhui Institute of Electromechanical Technology, 2002[7] Hu Zhenyu, Liu Luyuan, Du Zhenhui, C language programming of DS18B20 interface [J], Application of Single Chip Microcomputer and Embedded System, 2002[8] Jin Weizheng, Principle and Application of Single Wire Digital Temperature Sensor [J], Electronic Technology and Application, 2000[9] Ma Yunfeng, Chen Zifu, Li Peiquan, Principle and Application of Digital Temperature Sensor DS18B20 [EB/ OL], 2000[10] Li Gang, Principle and Application of 1-Wire Bus Digital Temperature Sensor DS18B20, Modern Electronic Technology [J], 1994ADC EQU 35HCLOCK BIT P2.4ST BIT P2.5EOC BIT P2.6OE BIT P2.7PWM BIT P3.7ORG 00HAJMP STARTORG 0BHLJMP INT_T0ORG 100HSTART:SETB PWM; settingMOV TMOD,#02H; Timer working mode selection MOV TH0,#20; The upper eight bits of the timer MOV TL0,#00H ; The lower eight bits of the timer MOV IE,#82H ; interrupt controlSETB TR0CLR STwait:SETB STnopCLR STJNB EOC,$SETB OEMOV ADC,P1CLR OECLR PWMMOV A,ADCLCALL DELAY; Call delay subroutine SETB PWMMOV A,#0FFHSUBB A,ADCLCALL DELAYSJMP WAITINT_T0:CPL CLOCKRETIDELAY:MOV R5,AD1: MOV R6,#30DJNZ R6,$DJNZ R5,D1RETEND。
运动控制系统课程题目:基于增强型51单片机的直流电机PWM调速姓名:姓名:姓名:姓名:姓名:姓名:2011年5月24日目录1 设计要求............................................................................................................................................... - 1 -2 系统方案论证与选择 ........................................................................................................................ - 1 -3 系统的原理与应用............................................................................................................................. - 2 -4 硬件部分............................................................................................................................................... - 3 -4.1 单片机的选型 ......................................................................................................................... - 3 -4.2 驱动模块................................................................................................................................... - 4 -4.3 测速模块................................................................................................................................... - 6 -4.4 显示模块................................................................................................................................... - 7 -5 软件部分............................................................................................................................................... - 7 -5.1主程序及系统初始化模块.................................................................................................... - 7 -5.2程序代码(Keil51编译)................................................................................................... - 8 -6 报告总结............................................................................................................................................... - 2 -7 参考文献............................................................................................................................................... - 2 - 附件............................................................................................................................................................. - 2 -基于增强型51单片机的直流电机PWM调速1 设计要求设计一套电机功率15W可逆直流调速系统。
畢業設計(論文)基於單片機實現直流電機PWM調速系統系別:電氣與資訊工程系專業班級:電氣自動化06—32(1)班指導教師:董曉紅老師完成日期:2009年6月12日一、題目:基於單片機實現直流電機PWM調速系統二、指導思想和目的:通過畢業設計,培養學生綜合運用所學的知識和技能解決問題的本領,鞏固和加深對所學知識的理解;培養學生調查研究的習慣和工作能力;培養學生建立正確的設計和科學研究的思想,樹立實事求是、嚴肅認真的科學工作態度。
三、設計任務或主要技術指標:利用MCS-51系列單片機,通過PWM方式控制直流電機調速的方法。
採用了專門的晶片組成了PWM信號的發生系統,然後通過放大來驅動電機。
利用直流測速發電機測得電機速度,經過濾波電路得到直流電壓信號,把電壓信號輸入給A/D轉換晶片最後回饋給單片機,在內部進行PI運算,輸出控制量完成閉環控制,實現電機的調速控制。
四、設計進度與要求:1):佈置設計任務,深入瞭解設計內容,搜集參考資料,學習有關內容。
2):學習學校畢業設計的的實際情況,和格式要求。
3):設計網路拓撲結構以及構思設計的基本思路和設計過程。
4):根據根據設計要求和構思思路查找設計內容。
5):根據要求和設計的基本方案對設計要求的材料進行預算。
6):完善設計方案並繪製必須的圖紙草圖,編寫設計說明書。
7):對圖紙進行校正和測繪,畫合格的正式圖紙。
8):總結,熟悉設計內容,準備畢業答辯,完成答辯。
五、主要參考書及參考資料:[1] 王離九,黃錦恩編著,電晶體脈衝直流調速系統,華中理工大學出版社出版[2] 丁元傑主編,上海市教育委員會組編,單片微機原理及應用,機械工業出版社[3] 李榮生主編,電氣傳動控制系統設計指導,機械工業出版社[4] 吳守箴,臧英傑編著,電氣傳動的脈寬調製控制技術,機械工業出版社[5] 陳伯時主編,自動控制系統---電力拖動控制,中央廣播電視大學出版社專業班級:電氣自動化06—32(1)班學生:景天紅指導教師:董曉紅老師教研室主任(簽名):系(部)主任(簽名):年月日新疆工業高等專科學校畢業設計(論文)評定意見書設計(論文)題目:基於單片機實現直流電機PWM調速系統專題:基於單片機實現直流電機PWM調速系統設計者:姓名景天紅專業電氣自動化班級06—32(1)班設計時間:2009年4月20日—2009年6月12日指導教師:姓名職稱單位評閱人:姓名職稱單位評定意見:評定成績:指導教師(簽名):年月日評閱人(簽名):年月日答辯委員會主任(簽名):年月日(上頁背面)畢業設計評定意見參考提綱1.學生完成的工作量與內容是否符合任務書的要求。
单片机原理及应用—— P W M直流电机调速控制系统概括直流电动机具有良好的启动性能和调速特性。
具有起动转矩大、调速平稳、经济大范围、调速容易、调速后效率高等特点。
本文设计的直流电机调速系统主要由51单片机、电源、H桥驱动电路、LED 液晶显示器、霍尔测速电路和独立按键组成的电子产品组成。
电源采用78系列芯片,采用PWM波方式实现电机+5V、+15V调速,PWM为脉宽调制,通过51单片机改变占空比实现。
通过独立的按键实现电机的启停、调速和转向的手动控制,LED实现测量数据(速度)的显示。
电机转速采用霍尔传感器检测输出方波,通过51单片机统计1秒内方波脉冲个数,计算电机转速,实现直流电机的反馈控制。
关键词:直流电机调速; H桥驱动电路; LED显示屏; 51单片机目录摘要2摘要错误!未定义书签。
目录3第 1 章引言41.1 概述41.2 国外发展现状41.3 要求51.4 设计目的及6第 2 章项目论证与选择72.1 电机调速模块72.2 PWM调速工作模式72.3 PWM脉宽调制方式错误!未定义书签。
2.4 PWM 软件实现错误!未定义书签。
第三章系统硬件电路设计83.1 信号输入电路83.2 电机PWM驱动模块电路9第 4 章系统的软件设计104.1 单片机选型104.2 系统软件设计分析10第 5 章 MCU 系统集成调试135.1 PROTEUS 设计与仿真平台错误!未定义书签。
18传统开发流程对比错误!未定义书签。
第一章简介1.1 概述现代工业的电驱动一般要求部分或全部自动化,因此必须与各种控制元件组成的自动控制系统相联动,而电驱动可视为自动电驱动系统的简称。
在这个系统中,生产机械可以自动控制。
随着现代电力电子技术和计算机技术的发展以及现代控制理论的应用,自动电驱动正朝着计算机控制的生产过程自动化方向发展。
以实现高速、高质量、高效率的生产。
在大多数集成自动化系统中,自动化电力牵引系统仍然是不可或缺的组成部分。
课程设计设计题目:基于51系列单片机的直流电机PWM调速系统设计学院:机电工程学院专业:机械工程及自动化班级:机自07级01班姓名:强艳梅学号:20702010135指导老师:张敏完成时间:2011年1月11日目录1 直流电动机调速概述 (3)1.1直流电机调速原理 (3)1.2直流调速系统实现方式 (4)1.3 89C51单片机 (5)2 硬件电路设计 (5)2.1 PWM波形的程序实现 (5)2.2直流电动机驱动 (6)2.3续流电路设计 (6)3 软件设计 (7)3.1主程序设计 (7)3.2 数码显数设计 (8)3.3 功能程序设计 (9)3.4仿真图 (12)3.5 仿真结果分析 (13)心得体会 (14)参考文献 (15)1 直流电动机调速概述1.1直流电机调速原理直流电动机根据励磁方式不同,直流电动机分为自励和他励两种类型。
不同励磁方式的直流电动机机械特性曲线有所不同。
但是对于直流电动机的转速有以下公式: n=U/Cc φ-TR内/CrCcφ其中:U—电压;R内—励磁绕组本身的电阻;φ—每极磁通(Wb);Cc —电势常数;Cr—转矩常量。
由上式可知,直流电机的速度控制既可采用电枢控制法,也可采用磁场控制法。
磁场控制法控制磁通,其控制功率虽然较小,但低速时受到磁极饱和的限制,高速时受到换向火花和换向器结构强度的限制,而且由于励磁线圈电感较大,动态响应较差。
所以在工业生产过程中常用的方法是电枢控制法。
图1-1 直流电机的工作原理图电枢控制是在励磁电压不变的情况下,把控制电压信号加到电机的电枢上,以控制电机的转速。
在工业生产中广泛使用其中脉宽调制(PWM)应用更为广泛。
脉宽调速利用一个固定的频率来控制电源的接通或断开,并通过改变一个周期内“接通”和“断开”时间的长短,即改变直流电机电枢上电压的“占空比”来改变平均电压的大小,从而控制电动机的转速,因此,PWM又被称为“开关驱动装置”。
图1-2电枢电压占空比和平均电压的关系图根据上图,如果电机始终接通电源时,电机转速最大为maxV ,占空比为D=1t /T ,则电机的平均速度为:D max V =V *D,可见只要改变占空比D ,就可以得到不同的电机速度,从而达到调速的目的。
1.2直流调速系统实现方式PWM 为主控电路的调速系统:基于单片机类由软件来实现PWM ,在PWM 调速系统中占空比D 是一个重要参数在电源电压d U 不变的情况下,电枢端电压的平均值取决于占空比D 的大小,改变D 的值可以改变电枢端电压的平均值从而达到调速的目的。
改变占空比D 的值有三种方法: A 、定宽调频法:保持1t 不变,只改变t ,这样使周期(或频率)也随之改变。
(图1-2)B 、调宽调频法:保持t 不变,只改变1t ,这样使周期(或频率)也随之改变。
(图1-2)C 、定频调宽法:保持周期T(或频率)不变,同时改变1t 和t 。
(图1-2)前两种方法在调速时改变了控制脉冲的周期(或频率),当控制脉冲的频率与 系统的固有频率接近时,将会引起振荡,因此常采用定频调宽法来改变占空 比从而改变直流电动机电枢两端电压。
1.3 89C51单片机图 1-3 89C51单片机2 硬件电路设计2.1 PWM波形的程序实现随计算机技术及电力电子技术的发展,PWM波形采用软件方法实现显得非常灵活和实用以89C51单片机为控制核心,晶振频率为12MHz定时计数器TO,T1作定时器使用,工作在方式1,定时时间为0.1ms,若PWM波形的频率为50 Hz ,占空比为1:1,则和 R0载入30H和31H单元的值初始100,若在程序中利用按键产生中断调用来改变30H和31H单元的值就可以改变占空比.系统流程图如图2-1所示:图 2-1 程序流程图2.2直流电动机驱动在直流电动机的驱动中对大功率的电动机常采用IGBT作为主开关元件,对中小功率的电机常采用功率场效应管作为主开关元件.另外还可以采用集成电路来完成对电机的驱动,系统采用集成电路L298来驱动电机图2-2 L298内部结构和功能引脚图L298是双H高电压大电流功率集成电路.直接采用 L逻辑电平控制,可以驱动继电器、直流电动机、步进电动机等电感性负载。
其内部有两个完全相同的功率放大回路。
其内部结构和引脚功能如图 2-2所示。
L298 引脚符号及功能SENSA、SENSB:分别为两个H桥的电流反馈脚,不用时可以直接接地ENA 、ENB:使能端,输入PWM信号IN1、IN2、IN3、IN4:输入端,TTL逻辑电平信号OUT1、OUT2、OUT3、OUT4:输出端,与对应输入端同逻辑VCC:逻辑控制电源,4.5~7V GND:地VSS:电机驱动电源,最小值需比输入的低电平电压高当使能端为高电平时,输入端IN1为PWM信号,IN2为低电平信号时,电机正转;输入端IN1为低电平信号,IN2为PWM信号时,电机反转;;IN1与IN2相同时,电机快速停止。
当使能端为低电平时,电动机停止转动。
2.3续流电路设计由于电机具有较大的感性,电流不能突变,若突然将电流切断,将在功率管两端产生很高的电压,损坏器件。
我们在此电路中应用的是二极管来续流,利用二极管的单向导通性。
二极管的选用要根据PWM的频率和电机的电流来决定,二极管要有足够迅速的恢复时间和足够的电流承受能力。
由于电机具有较大的感性,电流如果突变易损坏功率胳即L298芯片。
为保护芯片加上洗续流电路。
电路的工作原理替如图3.7所示。
电路的工作原理:当电机正转时,若突然掉电,D1、D4导通,D2、D3截止;当电机反转时,突然掉电D2、D3导通,D1、D4截止。
图2-3 续流电路工作原理图3 软件设计3.1主程序设计该主程序主要完成初始化,设置定时常数和中断入口程序,主程序不断的循环处于等待中断状态.ORG 0000HAJMP STARTORG 0003HLJMP INT0; T0中断ORG 000BHLJMP ITT0; T1中断ORG 0030H ;系统初始化START: MOV SP,#60H ;赋初值堆栈指针MOV R0,#00H ;给R0送值0MOV R1,#00H ;给R1送值0CLR P1.5 ;置0CLR P1.6 ;置0CLR P1.7 ;置0MOV TMOD,#01H ;写控制字控制方式MOV TL0,#0FFH ;置定时常数MOV TH0,#0FFHSETB EA ;允许中断SETB EX0 ;允许外部中断0SETB ET0 ;允许TL0中断CLR IT0SETB TR0 ;启动TL0图3-1主流程图3.2 数码显数设计通过P1.1,P1.2口来控制数码,显示通过查表和调用延时实现数的显示程序代码:MOV DPTR,#TABMOV 40H,#0 ;置0MOV 41H,#0 ;置0LED: SETB P1.1 ;P1.1置1CLR P1.2 ;P1.2清0MOV A,40H ;将40H的内容送往AMOVC A,@A+DPTR ;查表MOV P0,A ;查表所得A值送往P0口LCALL TTS ;调用延时CLR P1.1 ;P1.1清0SETB P1.2 ; P1.2置1MOV A,41H ;将41H的内容送往AMOVC A,@A+DPTR ;查表MOV P0,A ;查表所得A值送往P0口LCALL TTS ;调用延时CLR P1.2 ;P1.2口清0LJMP LED ;跳转到LEDORG 2000HTAB: DB 40H,79H,24H,30H,19HDB 12H,02H,78H,00H,10H3.3 功能程序设计结束中断后转入相应的功能键程序,为加速、减速、正转、反转、暂停程序代码:ITT0: CPL P1.5 ;P1.5口取反JNB P1.5,Z1MOV A,#0FFH ;低电平定时SUBB A,R0MOV TH0,ASETB TR0 ;启动TL0RETIZ1:MOV TH0,R0 ;高电平定时SETB TR0RETIINT0:CLR EX0 ;实现键盘控制MOV A,#0FFHMOV P2,AMOV A,P2JNB ACC.0,JIAJNB ACC.1,JIANJNB ACC.2,FF图3-2 数码显示流程图图3-3中断子程序流程图 JNB ACC.3,ZZJNB ACC.4,TZAJMP CCJIA: CJNE R0,#0FFH,AA ;实现电机加速AJMP CCAA: MOV A,R0ADD A,#25MOV R0,AAJMP CCJIAN: CJNE R0,#00,BB ;实现电机减速AJMP CCBB: MOV A,R0SUBB A,#25MOV R0,AAJMP CCCC: MOV A,R0 ;数码显数MOV B,#25DIV ABMOV B,#10DIV ABMOV 40H,AMOV 41H,BSETB EX0LCALL TTS ;调用延时LCALL TTS ;调用延时LCALL TTS ;调用延时LCALL TTS ;调用延时RETIFF: SETB P1.6 ;电机反传CLR P1.7LCALL TTSLCALL TTSLCALL TTSSETB EX0RETIZZ:CLR P1.6 ;电机正转SETB P1.7LCALL TTSLCALL TTSLCALL TTSSETB EX0RETITZ: CLR P1.6 ;实现电机停止 CLR P1.7LCALL TTSLCALL TTSLCALL TTSSETB EX0RETITTS: MOV R3,#0E0H ;延时子程序TT1S: MOV R4,#40HTT0S: DJNZ R4,TT0SDJNZ R3,TT1SRETEND3.4仿真图在该设计中,利用Proteus软件进行仿真。
仿真结果如图3-4所示:图3-4仿真图相应电机的显示如图3-5所示图3-5仿真结果3.5 仿真结果分析当仿真开始运行时,各个模块处于初始状态。
点击右边的独立键盘加速或是减速按钮。
显示模块便开始显示数字,然后点击正传或是反转。
电机的驱动模块能够实现电机的正转、反转、加速、减速、停止等操作。
且改变PWM脉冲时的占空比电机的工作电压改变。
因此,从仿真结果可以看出,本设计可以得到预期的仿真效果。
心得体会通过本次课程设计,使我学到了许多书本上无法学到的知识,也使我深刻体会到单片机技术应用领域的广泛。
不仅让我对学过的单片机知识有了很多的巩固,同时也对单片机这一门课程产生了更大的兴趣。
在本次课程设计过程中,我学会了在网络上查找有关本设计的各硬件的资源,其中包括:直流电机PWM调速、AT89C51单片机、L289引脚图及其引脚功能等,为本次课程设计提供了一定的资料。
在做课程设计的初期阶段,难度很大,没有头绪。