单片机课程设计报告——单片机控制步进电机

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

单片机原理及应用课程设计报告江西农大单片机原理及应用课程设计报告设计课题:单片机控制步进电机专业班级:信工091班学生姓名:崔**指导教师:何老师2012年5月单片机原理及应用课程设计报告-21-目录目录·············································································································11设计任务书···································································································21.1基本设计要求·······················································································21.2选作项目·····························································································22设计阐明······································································································32.1设计内容·····························································································32.2设计要求·····························································································32.3设备及工作环境····················································································33系统方案整体设计··························································································43.1设计思路·····························································································44硬件设计······································································································64.1系统硬件设计·······················································································64.1.1最小单片机系统··········································································64.1.2键盘设计···················································································64.2系统工作原理论述················································································75软件设计······································································································95.1分析论证·····························································································95.1.1步进电机运行驱动模块·································································95.1.2温度采集模块·············································································95.1.3主函数模块················································································95.1.4整体功效···················································································95.2程序流程图·························································································105.3程序清单····························································································116调试过程及分析····························································································187设计总结·····································································································19参考文献···································································································20单片机原理及应用课程设计报告-2-1设计任务书1.1基本设计要求(1)用万能板、主芯片AT89S52、35BYJ412步进电机、BLN2003以及其他周围原件芯片完成实验设计。(2)程序的首地址应使目标机可以直接运行,即从0000H开端。在主程序的开端部分必须设置一个合适的栈底。程序放置的地址须持续且靠前,不要在中间留下大批的空间地址,以使目标机可以应用较少的硬件资源。(3)采用单片机控制一个三相单三拍的步进电机工作。步进电机的旋转方向由正反转控制信号控制。步进电机的步数由键盘输入,可输入的步数分别为3、6、9、12、15、18、21、24和27步,且键盘具有键盘锁功能,当键盘上锁时,步进电机不接受输入步数,也不会运转。只有当键盘锁打开并输入步数时,步进电机才开始工作。(4)电机运转的时候有正转和反转指示灯指示。(5)电机在运转过程中,如果过热,则电机停止运转,同时红色指示灯亮,同时警报响。本题目的关键之处是:如何生成控制步进电机的脉冲序列。1.2选作项目1、用单片机(AT89S52)为主芯片设计电路来控制步进电机。2、设三个自锁按键,分别作开关键盘、左转、右转控制。3、设9个触电按键分别控制输入的步数为3、6、9、12、15、18、21、24和27步。4、设置一片LCD12864显示器实时显示步进电机工作状态,并提示用户步操作。单片机原理及应用课程设计报告-3-2设计阐明2.1设计内容用ZY15MCU12BD型综合单片机实验箱仿真实现控制步进电机集采问过程。2.2设计要求(1)采用单片机控制一个三相单三拍的步进电机工作。步进电机的旋转方向由正反转控制信号控制。步进电机的步数由键盘输入,可输入的步数分别为3、6、9、12、15、18、21、24和27步,且键盘具有键盘锁功能,当键盘上锁时,步进电机不接受输入步数,也不会运转。只有当键盘锁打开并输入步数时,步进电机才开始工作。(2)电机运转的时候有正转和反转指示灯指示。(3)电机在运转过程中,如果过热,则电机停止运转,同时红色指示灯亮,同时警报响。(4)上机调试程序。(5)写出设计报告。2.3设备及工作环境(1)硬件:AT89S52单片机一片、35BYJ412步进电机一台、ISP下载器一个、LCD12864显示器、温度传感器18B20芯片。(2)软件:Windows操纵系统、KeilC51软件。单片机原理及应用课程设计报告-4-3系统方案整体设计3.1设计思路步进电机的不同驱动方式,都是在工作时,脉冲信号按一定顺序轮流加到三相绕组上,从而实现不同的工作状态。由于通电顺序不同,其运行方式有三相单三相拍、三相双三拍和三相单、双六拍三种(注意:上面“三相单三拍”中的“三相”指定子有三相绕组;“拍”是指定子绕组改变一次通电方式;“三拍”表示通电三次完成一个循环。“三相双三拍”中的“双”是指同时有两相绕组通电)。(1)三相单三拍运行方式:下页图所示为反应式步进电动机工作原理图,若通过脉冲分配器输出的第一个脉冲使A相绕组通电,B,C相绕组不通电,在A相绕组通电后产生的磁场将使转子上产生反应转矩,转子的1、3齿将与定子磁极对齐,如果图(a)所示。第二个脉冲到来,使B相绕组通电,而A、C相绕组不通电;B相绕组产生的磁场将使转子的2、4齿与B相磁极对齐,如图(b)所示,与图(a)相比,转子逆时针方向转动了一个角度。第三个脉冲到来后,是C相绕组通电,而A、B相不通电,这时转子的1、3齿会与C组对齐,转子的位置如图(c)所示,与图(b)比较,又逆时针转过了一个角度。图反应式步进电机工作原理图当脉冲不断到来时,通过分配器使定子的绕组按着A相--B相--C相--A相……的规律不断地接通与断开,这时步进电动机的转子就连续不停地一步步的逆时针方向转动。如果改变步进电动机的转动方向,只要将定子各绕组通电的顺序改为A相--C相--B相--A相,转子转动方向即改为顺时针方向。单三拍分配方式时,步进电动机由A相通电转换到B相同点,步进电动机的转子转过一个角度,称为一步。这时转子转过的角度是30度。步进电动机每一步转过的角度称为步距角。(2)三相双三拍运行方式三相双三拍运行方式:每次都有两个绕组通电,通电方式是AB--BC--CA--AB……,如果通电顺序改为AB--CA--BC--AB……则步进电机反转。双三拍分配方式时,步进电动机的步距角也是30度(3)三相单,双六拍运行方式:三相六拍分配方式就是每个周期内有六个通电状态。这六中通电状态的顺序可以使A--AB--B--BC--C--CA--A……或者A--CA--C--BC--B--AB--A……六拍通电方式中,有一个时刻两个绕组同时通电,这是转子齿的位置将位于通电的两相的中间位置。在三相六拍分配方式下,转子单片机原理及应用课程设计报告-5-每一步转过的角度只是三相三拍方式下的一半,步距角是15度。单三拍运行的突出问题是每次只有一相绕组通电,在转换过程中,一相绕组断电,另一相绕组通电,容易发生失步;另外单靠一相绕组通电吸引转子,稳定性不好,容易在平衡位置附近震荡,故用的较少。双三拍运行的特点是每次都有两相绕组通电,且在转换过程中始终有一相绕组保持通电状态,因此工作稳定,且步距角与单三拍相同。六拍运行方式转换时始终有一相绕组通电,且步距角较小,故工作稳定性好,但电源较复杂,实际应用较多。单片机原理及应用课程设计报告-6-4硬件设计4.1系统硬件设计4.1.1最小单片机系统5V电源:给系统供电。复位电路:程序跑飞时复位电路可以使程序从新执行,相当于电脑的重启。晶振:给单片机运行提供时钟。比如电脑的2.2

1 / 22
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功