基于单片机的步进电机控制系统设计与研究.doc
文本预览下载声明
基于单片机的步进电机控制系统设计与研究
摘 要:随着我国工业的快速发展,步进电机在很多领域受到了广泛的应用,对步进电机的控制要求也越来越高;步进电机作为一个动力元件,其控制器的好坏,直接影响到步进电机运行的稳定性,进而影响到整个系统。本文研究一种基于STC89C52RC单片机和L298N驱动芯片的步进电机控制系统的设计,控制系统可以控制步进电机以给定速度进行任意合理的角度的旋转,有按键输入模块和1602液晶屏显示模块进行人机交互,同时控制系统还可以选择通过串口和基于VB语言的上位机软件进行通信,进而控制步进电机的运动。经调试,该系统可以实现预期的控制目标,驱动器也可以和上位机软件通信来控制步进电机,具有一定的实用价值。
关键字:单片机,步进电机,串口通信,VB语言,L298N
Design and research of Stepping motor control system
based on MCU
Abstract: With the rapid development of industry in our country, Stepping motor is widely used in many areas, the control requirements of the Stepping motor is bec-oming high and higher. Stepping motor as a power element, its controller is good or bad, directly affect the stability of the stepping motor, and then affect the whole system. In this thesis, we study a control system of stepping motor which based on the STC89C52RC MCU and L298N driver chip, the control system can control a stepping motor at a given speed for any reasonable angle of rotation, key input module and 1602 LCD display module for human-computer communication, at the same time control system can also communicate with PC software based on VB la-nguage by a serial port , it can also control the Stepping motor to move. After de-bugging, the system can achieve the expected target, and the controller can commu-nicate with the PC software to control the Stepping motor, and it has some practic-al value.
Keyword: MCU, Stepping motor, Serial communication, VB language, L298N
目 录
1 绪 论 1
1.1 步进电机及其发展 1
1.2 步进电机在我国的应用及前景 1
1.3 本设计要研究的内容 2
2 总体方案设计 3
2.1 步进电机控制原理 3
2.2 步进电机的驱动 3
2.2.1 基于电子电路的控制 4
2.2.2 基于PLC的控制 4
2.2.3 基于单片机的控制 5
2.3 硬件方案的提出与选型 6
2.3.1 单片机的选型 6
2.3.2 显示模块的选型 7
2.3.3 驱动芯片的选择 8
3 硬件电路设计 10
3.1 STC89C52RC单片机及外围电路设计 10
3.1.1 STC89C52RC单片机管脚介绍 10
3.1.2 STC89C52RC单片机最小系统 12
3.2 显示模块设计 13
3.3 电机驱动电路设计 14
3.4 电源稳压模块设计 15
4 单片机软件设计 17
4.1 Keil UV3软件使用 17
4.2 主程序工作过程 20
4.3 初始化程序设计 20
4.4 步进电机控制算法设计 22
4.4.1 步进电机的正反转 22
4.4.2步进电机的调速 23
4.4.3 串口接收函数编写 24
4.5 显示程序设计 25
4.6 键盘程序设计 29
5 上位机软件设计
显示全部