(论文 页数:42 字数:17483 带程序)摘要:单片机对步进电机的控制有串行控制和并行控制两种方式。本设计采用的是串行控制方式,此方式下单片机控制系统与步进电机驱动器之间只有两条控制线。一条发出时钟脉冲信号来控制步进电机的转速;另一条发出转向信号控制步进电机的转向。这两个信号都是送入步进电机驱动器的输入端,驱动器中含有环行分配器,对步进电机励磁方式的控制和控制脉冲的分配都是由环行分配器来完成的。由于单片机控制系统与驱动器之间只有两条控制线,从而使系统结构大为简化。控制系统按速度控制的要求从时钟脉冲控制线发出相应的控制脉冲即可对步进电机的转速进行控制。当需要恒速运行时,就发出恒定频率的控制脉冲;当需要加速运行时,就发出频率递增的控制脉冲;当需要减速运行时,就发出频率递减的控制脉冲;当需要锁定状态时,只需要停止发脉冲并通入直流电就可以了。因此,可以方便地对电动机的转速进行控制。转向控制线可实现对步进电机转向的控制,当输出高电平“1”时,环行分配器按正方向进行脉冲分配,步进电机正向旋转;当输出低电平“0”时,环行分配器按反方向进行脉冲分配,步进电机反方向旋转。
关键词:单片机系统,控制,步进电机,环行分配器
Abstract Series control and parallel control are two modes of controlling step motors by single chip microcomputer. The design adopts serial control mode, in this case there are only two controlling lines between the single chip microcomputer system and the driver of the step motor .One is used to give out clock pulse to control the velocity, another is used to give out directional signal to control the direction. The two signals are all sent to the input of the driver of the step motor, which includes the ring dividing driver .Because of this, the system has a very simple structure. According to the demand of controlling speed, the system give out corresponding clock pulse to control the speed of the motor through the clock pulse. when constant speed is needed, constant clock pulse is gave out; when adding speed is needed, adding clock pulse is gave out; when reducing speed is needed, reducing clock pulse is gave out; When the lock-in state is needed, direct current is needed instead of the pulse. so the speed control of the step motor is very easy. The direction control line is used to control the direction of the step motor. when the voltage is “1”, the ring dividing driver shares the pulses according to the right direction, the step motor runs in the right direction. When the voltage is “0”, the ring dividing driver shares the pulses according to the revert direction, the step motor runs in revert direction. Keywords: Single chip microcomputer system; Control; Step motor; Ring distributing driver
目录 1 绪论••••••••••••••••••••••••••••••••••••••••••••••••••••••1 1.1 提出问题并确定设计方案••••••••••••••••••••••••••••••••••1 1.1.1 问题的提出••••••••••••••••••••••••••••••••••••••••••1 1.1.2 明确课题任务••••••••••••••••••••••••••••••••••••••••1 1.1.3 确定设计方案••••••••••••••••••••••••••••••••••••••••1 1.2 研究内容和方法••••••••••••••••••••••••••••••••••••••••••2 1.2.1 研究内容••••••••••••••••••••••••••••••••••••••••••••3 1.2.2 研究方法••••••••••••••••••••••••••••••••••••••••••••3 1.3 本课题研究的意义••••••••••••••••••••••••••••••••••••••••4 2 控制系统硬件电路的设计•••••••••••••••••••••••••••••••••5 2.1 单片机最小应用系统设计••••••••••••••••••••••••••••••••••5 2.1.1 8051单片机简介••••••••••••••••••••••••••••••••••••••6 2.1.2 时钟电路设计••••••••••••••••••••••••••••••••••••••••7 2.1.3 复位电路设计••••••••••••••••••••••••••••••••••••••••8 2.2 键盘和显示部分设计••••••••••••••••••••••••••••••••••••••9 2.2.1 8255A简介••••••••••••••••••••••••••••••••••••••••••10 2.2.2 显示电路简介•••••••••••••••••••••••••••••••••••••••12 2.2.3 74LS138和74LS373简介••••••••••••••••••••••••••••••13 2.2.4 键盘显示接口设计•••••••••••••••••••••••••••••••••••14 2.3 步进电机控制系统设计•••••••••••••••••••••••••••••••••••15 2.3.1 脉冲分配器PMM8713简介•••••••••••••••••••••••••••••15 2.3.2 功率放大电路设计•••••••••••••••••••••••••••••••••••17 2.4 光电耦合电路设计•••••••••••••••••••••••••••••••••••••••18 2.5 步进电动机概述•••••••••••••••••••••••••••••••••••••••••19 2.5.1 步进电机结构和原理•••••••••••••••••••••••••••••••••19 2.5.2 步进电机的控制方法•••••••••••••••••••••••••••••••••20 2.5.3 步进电机的矩频特性•••••••••••••••••••••••••••••••••21 2.5.4 步进电机的启动••••••••••••••••••••••••••••••••••••22 2.6 电源电路设计•••••••••••••••••••••••••••••••••••••••••••23 2.7 单片机对步进电机的控制原理•••••••••••••••••••••••••••••25 3 控制系统软件设计•••••••••••••••••••••••••••••••••••••••26 3.1 程序流程图•••••••••••••••••••••••••••••••••••••••••••••26 3.1.1 正反转控制程序流程图•••••••••••••••••••••••••••••••26 3.1.2 加减速控制程序流程图•••••••••••••••••••••••••••••••27 3.1.3 键输入程序流程图•••••••••••••••••••••••••••••••••••28 3.2 程序设计•••••••••••••••••••••••••••••••••••••••••••••••29 3.2.1 主程序设计•••••••••••••••••••••••••••••••••••••••••29 3.2.2 步进电机驱动子程序设计•••••••••••••••••••••••••••••29 4 控制系统可靠性设计••••••••••••••••••••••••••••••••••••33 4.1 抗干扰措施设计•••••••••••••••••••••••••••••••••••••••••33 4.1.1 硬件抗干扰措施•••••••••••••••••••••••••••••••••••••33 4.1.2 软件抗干扰措施•••••••••••••••••••••••••••••••••••••34 5 结论•••••••••••••••••••••••••••••••••••••••••••••••••••36 致谢•••••••••••••••••••••••••••••••••••••••••••••••••••37 参考文献 ••••••••••••••••••••••••••••••••••••••••••••••38
1 绪论 1.1 提出问题并确定设计方案 1.1.1问题的提出 传统的步进电机控制方法是由触发器产生控制脉冲来进行控制的,但此种控制方法工作方式单一且难于实现人机交互,当步进电机的参数发生变化时,需要重新进行控制器的设计。而且由传统的触发器构成的控制系统具有控制电路复杂、控制精度低、生产成本高等缺点。为了克服传统控制器的缺点,满足工业生产新的控制要求,在此设计一种以单片机为核心的新型控制器。 1.1.2明确课题任务 单片机对步进电机的控制有如下几项要求: (1)为用户使用方便,需要实现人机交互。 (2)为实现对不同相数的步进电机进行控制而不更换控制器的要求,需要实现励磁方式的可控性。 (3)要求实现步进电机的转速可控和旋转角度可控。 (4)要求有足够的控制精度。 1.1.3 确定设计方案 通过对控制系统的分析,确定了如下的设计方案: (1)确定系统的I/O点数和通道: ①输入和输出量的确定: 输入量:主要是键盘输入。 输出量: 步进电机的驱动信号和LED数码管显示信号。 ②输入、输出通道的确定: 除了键盘/显示器的输入/输出外,输出通道还有驱动步进电机信号的输出通道。 (2)选择单片机: 根据控制系统所要求的控制精度、响应速度、开发环境、I/O点数、输入/输出通道数等情况选择了MCS-51系列的8位单片机8051,其具有4KB ROM和256B RAM,因此不需要进行存储器的扩展。
|