四川理工学院毕业设计
数字式直流电机控速系统设计
学 生:张 平 学 号:09021020227 专 业:电子信息工程 班 级:2009.2 指导教师:王贤秋
四川理工学院自动化与电子信息学院
二O一三年六月
张平:数字式直流电机控速系统设计
数字式直流电机控速系统设计
摘要:本设计采用脉宽调制的方法实现电机的控速,利用单片机在控制方面简单灵活操作特点,通过检测光栅的方式实现了电机的转速测量,再通过相应的处理生成控制信息之后,采用调节占空比的方式控制电机的转速。并且为了适应联机操作,本设计电路还提供了一个串行接口提供给上位机发送命令以及接收数据使用。
关键词:数字式;直流电机;光栅控速;串行通信
II
四川理工学院本科毕业设计
DC motor digital speed control system
ZhangPing
(Sichuan University of Science and Engineering, Zigong, China, 643000)
Abstract: This article make the control of the motor by pulse duration modulation. This article use a kind of simple and practical design solution .By help of Single Chip Micyoco , we could do something more flexible . the system can compute the speed of the motor by checking the optical grating . when get the data , it will dispose the data with a corresponding way , and then control DC motor by adjusting the PWM . on the other side , online is very important for a system , so to communicate with other system , the system support a Serial interface ,too .
Key words: digital ; DC motor ; optical grating ; Serial port communication
III
张平:数字式直流电机控速系统设计
目录
摘要 ............................................................... II Abstract .......................................................... III 第1章 引 言 ........................................................ 1
1.1 设计背景 ............................................................................................................................... 1 1.2 目的和意义 ........................................................................................................................... 1 1.3研究方法 ................................................................................................................................ 2 1.4 本章小节 ............................................................................................................................... 2
第2章 总体电路设计 ................................................. 3
2.1系统工作原理简介 ................................................................................................................. 3 2.2 系统框图 ............................................................................................................................... 4 2.3 本章小结 ............................................................................................................................... 5 3.1 PWM信号发生电路 .............................................................................................................. 6
3.1.1 PWM的基本原理 ....................................................................................................... 6 3.1.2 PWM的实现 ............................................................................................................... 7 3.1.3 硬件实现..................................................................................................................... 8 3.2 主控电路 ............................................................................................................................... 8
3.2.1.芯片的组成原理 ....................................................................................................... 8 3.2.2.CPU及部件的作用功能 .......................................................................................... 9 3.2.3 引脚功能................................................................................................................... 10 3.2.4 硬件实现................................................................................................................... 11 3.3显示模块 .............................................................................................................................. 12
3.3.1工作原理.................................................................................................................... 12 3.3.2元件—地址锁存器 .................................................................................................... 13 3.3.3 硬件实现................................................................................................................... 13 3.4 串行通信模块...................................................................................................................... 14
3.4.1模块工作原理 ............................................................................................................ 14 3.4.2 元件-MAX232 .......................................................................................................... 15 3.4.3 单片机串口通信简介 ............................................................................................... 16 3.4.4 九针串口................................................................................................................... 19 3.4.5 硬件实现................................................................................................................... 21 3.5 电机驱动电路...................................................................................................................... 22
四川理工学院本科毕业设计
3.5.1 H型桥式驱动电路 .................................................................................................... 22 3.5.2 硬件实现................................................................................................................... 23 3.6 光电测速模块...................................................................................................................... 23
3.6.1 工作原理................................................................................................................... 23 3.6.2 硬件实现................................................................................................................... 24 3.7 本章小节 ............................................................................................................................ 25
致 谢 .............................................................. 32 参考文献 ........................................................... 33 附 录 .............................................................. 34
附录一 详细电路设计图 ........................................................................................................... 34 附录二 软件设计....................................................................................................................... 35