资源描述:
《步进电机角度控制》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、考试序列号08论文题目:步进电机角度控制(2)课程名称:微型计算机控制技术学院自动化专业班级10学号3姓名联系方式任课教师2013年6月25日程序设计流程图NYNY驱动电机反转正转控制键输入Start置位CLR置位CLR置位数字输入显示电机工作?输入?键盘扫描初始化开始源程序:ORG0000HLJMPMAINORG0100HMAIN:-------------------初始化--------------------MOV50H,#00H;角度个位MOV51H,#00H;角度十位MOV52H,#00H;角度百
2、位MOV53H,#00H;转次数MOV54H,#00H;START标志位MOV55H,#00H;CLR标志位MOV56H,#00HMOV57H,#00H;正反转标志位MOV58H,#01H;前后4拍标志位MOV59H,#00H;存放转的步数MOV60H,#00H;角度个位MOV61H,#00H;角度十位MOV62H,#00H;角度百位MOV63H,#00H;转次数MOVDPTR,#7F03HMOVA,#81HMOVX@DPTR,ABEGIN:MOVDPTR,#7F01H;键盘检测MOVA,#00HMOVX@D
3、PTR,AMOVDPTR,#7F02HMOVXA,@DPTRANLA,#0FHCJNEA,#0FH,INK1MOVA,54H;电机运动及正反转判断CJNEA,#01H,TEST1;START=0跳MOVA,55HCJNEA,#01H,ZHENG;CLR=0跳AJMPNT;跳去显示TEST1:MOVA,55H;start=0CJNEA,#01H,NT;跳去显示FAN:MOV57H,#00H;给个反转标志LCALLBJFAJMPBEGINZHENG:MOV57H,#01H;给个正传标志ACALLBJZNT:ACA
4、LLDISAJMPBEGIN---------------------键盘扫描程序----------INK1:ACALLDL1MSMOVDPTR,#7F02HMOVXA,@DPTRANLA,#0FHCJNEA,#0FH,INK2AJMPBEGININK2:MOVDPTR,#7F01HMOVA,#0FEHRLARLAMOVX@DPTR,AMOVDPTR,#7F02HMOVXA,@DPTRJNBACC.1,KEY2JNBACC.2,KEY4MOVDPTR,#7F01HMOVA,#0FDHRLARLAMOVX@D
5、PTR,AMOVDPTR,#7F02HMOVXA,@DPTRJNBACC.1,KEYCLRJNBACC.2,KEYSETMOVDPTR,#7F01HMOVA,#0FBHRLARLAMOVX@DPTR,AMOVDPTR,#7F02HMOVXA,@DPTRJNBACC.1,KEY5JNBACC.2,KEYSTARTMOVDPTR,#7F01HMOVA,#0F7HRLARLAMOVX@DPTR,AMOVDPTR,#7F02HMOVXA,@DPTRJNBACC.1,KEY7JNBACC.2,KEY0LJMPSTTKK
6、EY2:MOVA,#02HACALLPUTBUFACALLDISLJMPSTTKKEY4:MOVA,#04HACALLPUTBUFACALLDISLJMPSTTKKEYCLR:MOV54H,#00HLJMPSTTKKEYSET:MOV60H,50HMOV61H,51HMOV62H,52HMOV63H,53HMOV50H,#00HMOV51H,#00HMOV52H,#00HMOV53H,#00HLJMPSTTKKEY5:MOVA,#05HACALLPUTBUFACALLDISLJMPSTTKKEYSTART:M
7、OV54H,#01HLJMPSTTKKEY7:MOVA,#07HACALLPUTBUFACALLDISLJMPSTTKKEY0:MOVA,#00HACALLPUTBUFACALLDISLJMPSTTK------------显示左移------------------PUTBUF:PUSH00HPUSHACCMOVR1,#3MOVR0,#52HPUTBUF0:MOVA,@R0INCR0MOV@R0,ADECR0DECR0DJNZR1,PUTBUF0POPACCMOV50H,APOP00HRET--------
8、-------显示子程序----------------------DIS:PUSHACCPUSH00HPUSH03HMOVR0,#50HMOVR3,#0F7HAA2:MOVA,@R0MOVDPTR,#A1MOVCA,@A+DPTRMOVDPTR,#7F00HMOVX@DPTR,AMOVDPTR,#7F01HMOVA,R3RLARLAMOVX@DPTR,AACALLDL1MSMOVA,R3JNBAC