内蒙古科技大学
本科生毕业设计说明书(毕业论文)
题 目:基于学生姓名:学 号:专 业:自动化班 级:自动化指导教师:
AT89C51单片机的步进
06-3班 电机控制系统内蒙古科技大学毕业设计说明书(毕业论文)
基于AT89C51单片机的步进电机控制系统
摘要
步进电机是数字控制系统中的一种执行元件,它能按照控制脉冲的要求,迅速起动,制动,正反转和调速。具有步距角精度高,停止时能自锁等特点,因此步进电机在自动控制系统中,特别是在开环的控制系统中得到了日益广泛的应用。
本文以单片机和环形脉冲分配器为核心设计的步进电机控制系统,通过软硬件的设计调试,实现步进电机能根据设定的参数进行自动加减速控制,使控制系统以最短的时间到达控制终点,而又不发生失步的现象;同时它能准确地控制步进电机的正反转,启动和停止。硬件是以AT89C51单片机为核心的控制电路,主要包括:环形脉冲分配器、键盘显示电路、步进电机的驱动电路等。软件部分采用C语言编程,主要包括键盘显示程序、步进电机的调速程序、停止判断程序等。
关键词:步进电机控制系统;调速;单片机
I
内蒙古科技大学毕业设计说明书(毕业论文)
Based on AT89C51 Single-chip Computer
Stepping Motor Control System
Abstract
Stepping motor is a kind of digital control system components. It can achieve quick start-up, positive inversion, stopping and speed control, according to the control pulse. It has high precision step angle, and can be self-locking when it keeps still. As these characteristics, stepping motor in automatic control system, especially in the open loop control system has been widely applied.
This article mainly focuses on taking Single-chip Computer and cycle pulse distributor as the core, and designing the stepping motor control system. Through the design of the software and hardware debugging, it realizes controlling the step motor’s acceleration and deceleration automatically, according to parameter setting. Making the system arrive the end point with the shortest time, but not occur outing of step. Besides it can accurately achieve start-up, positive inversion and shutdown. Hardware takes AT89C51 as the core of control circuit, mainly including: cycle pulse distributor, keyboard and display circuit, stepping motor driving circuit, etc. Software part adopts the C language programming, mainly including keyboard and display program, stepping motor speed control program, stop judging program, etc.
Key words: Stepping motor control system; speed control; Single-chip Computer
II
内蒙古科技大学毕业设计说明书(毕业论文)
目录
摘要 ............................................................................................................................................. I Abstract ..................................................................................................................................... II 第一章 引言 .............................................................................................................................. 1
1.1 课题提出的背景和研究意义 ...................................................................................... 1 1.2 课题的主要研究内容 .................................................................................................. 2 1.3 本章小结 ...................................................................................................................... 2 第二章 步进电机控制系统设计 .............................................................................................. 3
2.1 步进电机的原理 .......................................................................................................... 3
2.1.1 三相单三拍通电方式 ........................................................................................ 3 2.1.2 三相双三拍通电方式 ........................................................................................ 5 2.1.3 三相六拍通电方式 ............................................................................................ 6 2.2 环形脉冲分配器 .......................................................................................................... 8 2.3 续流电路 .................................................................................................................... 12
2.3.1 二极管续流 ...................................................................................................... 13 2.3.2 二极管—电阻续流 .......................................................................................... 14 2.4 步进电机驱动电路 .................................................................................................... 15 2.5 步进电机的变速控制 ................................................................................................ 17
2.5.1 变速控制的方法 .............................................................................................. 19 2.6 步进电机在自动生产线中的应用 ............................................................................ 20 2.7 本章小结 .................................................................................................................... 22 第三章 控制系统硬件设计 .................................................................................................... 23
3.1 硬件系统设计原则 .................................................................................................... 23 3.2 控制系统组成 ............................................................................................................ 23 3.3 主要元件的选择 ........................................................................................................ 24
3.3.1 单片机的选择 .................................................................................................. 24 3.3.2 EPROM的选择 ................................................................................................ 25 3.3.3 可逆计数器的选择 .......................................................................................... 27 3.4 控制系统接口电路的设计 ........................................................................................ 27
III
内蒙古科技大学毕业设计说明书(毕业论文)
3.4.1 环形脉冲分配器设计 ...................................................................................... 27 3.4.2 显示电路设计 .................................................................................................. 29 3.4.3 外部复位电路设计 .......................................................................................... 30 3.5 控制系统整体电路设计 ............................................................................................ 31 3.6 本章小结 .................................................................................................................... 31 第四章 控制系统软件设计 .................................................................................................... 32
4.1 软件系统设计原则 .................................................................................................... 32 4.2 步进电机控制系统功能设计 .................................................................................... 32 4.3 主程序设计 ................................................................................................................ 33
4.3.1 主程序工作过程 .............................................................................................. 33 4.3.2 主程序工作流程图 .......................................................................................... 34 4.3.3 定时器T0中断程序流程图 ........................................................................... 34 4.4 Proteus仿真 ................................................................................................................ 37 4.5 显示程序设计 ............................................................................................................ 39 4.6 键盘程序设计 ............................................................................................................ 39 4.7 调速程序设计 ............................................................................................................ 41
4.7.1 20BY步进电机参数 ........................................................................................ 41 4.7.2 步进电机转速与频率的关系 .......................................................................... 41 4.8 本章小结 .................................................................................................................... 42 第五章 结束语 ........................................................................................................................ 43 参考文献 .................................................................................................................................. 44 附录 .......................................................................................................................................... 46
附录A 系统程序(C) ................................................................................................... 46 附录B 20BY步进电机转速与定时器定时常数关系表 ................................................ 59 附录C 控制系统电路图 ................................................................................................. 62 致谢 .......................................................................................................................................... 63
IV