微型计算机控制技术课程设计步进电机讲解学习.doc
《微型计算机控制技术课程设计步进电机讲解学习.doc》由会员分享,可在线阅读,更多相关《微型计算机控制技术课程设计步进电机讲解学习.doc(11页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、Good is good, but better carries it.精益求精,善益求善。微型计算机控制技术课程设计步进电机-课程设计课程名称微型计算机控制技术题目名称_步进电机角度控制(2)学生学院_自动化_专业班级_学号学生姓名_指导教师_李传芳_2013年06月28日-一、软件设计流程图如下图所示:开始判断键值设定8255A工作方式,A、B口输出,C口PC4PC7输入,PC0PC3输出,故控制字为88H延时驱动电机动作LED显示返回调用延时扫描键盘否是否有键按下是判断键值二、心得与体会这次的课程设计主要针对键盘及可编程接口芯片8255A的编程,在上机调试过程中由于自己的疏忽及算法的不完
2、善导致了程序不能实现预期的功能,经过一遍又一遍的检查和思考,终于完成了这次课程设计的任务。虽然上机调试的经历是痛苦的,但是期间的细节错误给了我们应有的教训,使我们在以后的学习及工作中尽量避免,对于汇编语言的编程也有了进一步的了解加深了对步进电机的理解和使用技巧,设计中,需要对步进电机进行角度控制,即需要对步进电机的角度进行计算分析,以得到所需的步数。总之,这次课程设计锻炼了我解决问题的能力,激发了我的思考,相信通过这次课程设计对我以后对微机的继续学习及以后的工作会有很大的帮助。任务1连接数码管显示电路和键盘电路,实现如下表所示的按键控制,并能够左移显示:360AB72F1.2源程序:STACK
3、SEGMENTSTACKDB64DUP(?)STACKENDSDATASEGMENTORG0030HVAR1DB0FCH,0FCH,0FCH,0FCHVAR5DBOF7H,0FBH,0FDH,0FEHVAR2DB0FCH,0FCH,0FCH,0FCH,0FCH,0FCH,0FCH,0FCHVAR3DB00H,00H,00H,00H,00H,00H,00H,00HVAR4DB00H,00H,00H,00H,00H,00H,00H,00HTABLE1DB0FCH,60H,0DAH,0F2H,66H,0B6H,0BEH,0E0H,0FEH,0F6H,0EEH,3EH,9CH,7AH,9EH,8EHD
4、ATAENDSCODESEGMENTASSUMECS:CODE,DS:DATASTART:MOVAX,DATAMOVDS,AXMOVAL,88H;8255初始化MOVDX,0606HOUTDX,ALSTT:MOVAL,60HMOVDX,0604HOUTDX,ALNEXT:MOVDX,0604HINAL,DXANDAL,60HCMPAL,60HJNZKEYABCCALLDISPJMPSTT;.键盘扫描.KEYABC:CALLTIMEMOVDX,0604HINAL,DXANDAL,60HCMPAL,60H;PC6PC5=01100000JNZKEYJMPSTTKEY:MOVAL,0FEH;扫描PC
5、0口PC0=0MOVDX,0604HOUTDX,ALMOVDX,0604HINAL,DXTESTAL,20H;检测PC5JNZKEY_FCALLKEYAJMPSTTKKEY_F:TESTAL,040H;检测PC6口JNZKEY_0CALLKEYFJMPSTTKKEY_0:MOVAL,0FDH;扫描PC1口,PC1=0MOVDX,0604HOUTDX,ALMOVDX,0604HINAL,DXTESTAL,20H;检测PC5JNZKEY_2CALLKEY0JMPSTTKKEY_2:TESTAL,040H;检测PC6口JNZKEY_6CALLKEYF;否则是按键2JMPSTTKKEY_6:MOVAL
6、,0FBH;PC2=0MOVDX,0604HOUTDX,ALMOVDX,0604HINAL,DXTESTAL,20H;检测PC5JNZKEY_7CALLKEY6JMPSTTKKEY_7:TESTAL,040H;检测PC6口JNZKEY_3CALLKEY7JMPSTTKKEY_3:MOVAL,0F7HPC3=0MOVDX,0604HOUTDX,ALMOVDX,0604HINAL,DXTESTAL,20H;检测PC5JNZKEY_BCALLKEY3JMPSTTKKEY_B:TESTAL,040H;检测PC6口JNZKEY_111CALLKEYBKEY_111:JMPSTTK;.数字XIANSHI.
7、KEYA:CMPBH,00HJZKEYA_1KEYA_1:CALLLP1MOVAL,0EEHMOVSI,ALMOVAL,0AHMOVDI,ALCALLDISPRETKEYF:CMPBH,00HJZKEYE_1KEYF_1:CALLLP1MOVAL,8EHMOVSI,ALMOVAL,0FHMOVDI,ALCALLDISPRETKEY0:CMPBH,00HJZKEY1_1KEY0_1:CALLLP1MOVAL,0FCHMOVSI,ALMOVAL,00HMOVDI,ALCALLDISPRETKEY2:CMPBH,00HJZKEYF_1KEY2_1:CALLLP1MOVAL,0DHMOVSI,ALMO
8、VAL,02HMOVDI,ALCALLDISPRETKEY6:CMPBH,00HJZKEY7_1KEY6_1:CALLLP1MOVAL,0BEHMOVSI,ALMOVAL,06HMOVDI,ALCALLDISPRETKEY7:CMPBH,00HJZKEYA_1KEY7_1:CALLLP1MOVAL,0E0HMOVSI,ALMOVAL,07HMOVDI,ALCALLDISPRETKEY3:CMPBH,00HJZKEY8_1KEY3_1:CALLLP1MOVAL,0F2HMOVSI,ALMOVAL,03HMOVDI,ALCALLDISPRETKEYB:CMPBH,00HJZKEYB_1KEYB_1
9、:CALLLP1MOVAL,3EHMOVSI,ALMOVAL,0BHMOVDI,ALCALLDISPRETLP1:MOVSI,OFFSETVAR1PUSHAXMOVAL,SI+2MOVSI+3,ALMOVAL,SI+1MOVSI+2,ALMOVAL,SIMOVSI+1,ALPOPAXMOVSI,ALRET;.显示.DISP:PUSHDXPUSHCXMOVSI,OFFSETVAR1MOVDX,0604HMOVAL,11111110BOUTDX,ALMOVDX,0602HMOVAL,SI+3OUTDX,ALDECSICALLTIMEMOVDX,0604HMOVAL,11111101BOUTDX,A
10、LMOVDX,0602HMOVAL,SI+3OUTDX,ALDECSICALLTIMEMOVDX,0604HMOVAL,11111011BOUTDX,ALMOVDX,0602HMOVAL,SI+3OUTDX,ALDECSICALLTIMEMOVDX,0604HMOVAL,11110111BOUTDX,ALMOVDX,0602HMOVAL,SI+3OUTDX,ALDECSICALLTIMEPOPAXPOPDXRET;.延时.TIME:PUSHAXPUSHCXMOVCX,0006HTIME1:MOVAX,0100HTIME2:DECAXJNZTIME2LOOPTIME1POPCXPOPAXRET;
11、.放键测试.STTK:CALLDISPMOVAL,00HMOVDX,0604HOUTDX,ALMOVDX,0604HINAL,DXANDAL,60HCMPAL,60HJNZSTTKJMPSTTCODEENDSENDSTART任务2实现:定义键盘按键:5个为数字键:0、1、3、5、9;3个功能键:设置SET、清零CLR、开始START;按键分布如下表所示:0365SET4STARTCLR2.2源程序:STACKSEGMENTSTACKDB100DUP(?)STACKENDSDATASEGMENTVAR1DBOF7H,0FBH,0FDH,0FEHVAR2DB0FCH,0FCH,0FCH,0FCHV
12、AR5DB00H,00H,00H,00H,00H,00HTABLDB0FCH,60H,0DH,0F2H,66H,0B6H,0BEH,0E0H,0FEH,0F6H,0EEH,3EH,9CH,7AH,9EH,8EHTAB_CDW00HORG0100HVAR3DB64DUP(?)ORG0200HVAR4DW64DUP(?)COUNTDB00HTABLEDB08H,18H,10H,30H,20H,60H,40H,48HD_COUNTDB00HD_TIMESDB00HDATAENDSCODESEGMENTASSUMECS:CODE,DS:DATASTART:MOVAX,DATAMOVDS,AXPUSHD
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 微型计算机 控制 技术 课程设计 步进 电机 讲解 学习
限制150内