收藏 分销(赏)

广工自动化单片机课程设计样本.docx

上传人:二*** 文档编号:4517563 上传时间:2024-09-26 格式:DOCX 页数:13 大小:17.28KB
下载 相关 举报
广工自动化单片机课程设计样本.docx_第1页
第1页 / 共13页
亲,该文档总共13页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

1、 自动化 学院 网络工程 专业 班 学号 姓名 1. 程序一:在显示屏上显示任意四位十六进制数:56AFORG 0000HLJMP MAINORG 1000HMAIN:MOV52H,#02HMOV53H,#03HMOV51H,#01HMOV50H,#00HMOV R5,#53HKEYSUB:MOVA,#0DHMOVDPTR,#7F00HMOVXDPTR,ABEGIN:ACALLDISAJMPBEGINDIS:PUSHACCPUSH00HPUSH03HMOVR0,#50HMOVR3,#7FHMOVA,R3AGAIN:MOVDPTR,#7F03HMOVXDPTR,AMOVA,R0MOVDPTR,#

2、DDEGMOVA,A+DPTRMOVDPTR,#7F01HMOVXDPTR,AACALLDLIMSINCR0MOVA,R3JNBACC.3,OUTRRAMOVR3,AAJMPAGAINOUT:POP03HPOP00HPOPACCRETDDEG:DB79H,7CH,07H,5BH,6FH,7FH,77H,39HA1:MOVA,R3MOVDPTR,#7F01HMOVXDPTR,AMOVDPTR,#1000HMOVA,R2MOVCA,A+DPTRMOVDPTR,#7F02HMOVXDPTR,ACALLDLIMSINCR2MOVA,R3RLAMOVR3,AJNBACC.4,BEGINJMPA1DLIM

3、S:MOVR7,#05HDL0:MOVR6,#0FFHDL1:DJNZR6,DL1DJNZR7,DL0RETEND2.程序二:将8个键按实验室规定定义键值,按任意键在显示屏上显示相应键值,规定显示值能左移;98ACEB72ORG0000HLJMPMAINORG1000HMAIN:MOV 52H,#00HMOV 53H,#00HMOV 51H,#00HMOV 50H,#00HMOV R5,#53HKEYSUB:MOV A,#0DHMOVDPTR,#7F00HMOVX DPTR,ABEGIN:ACALL DISACALL CLEARACALL CCSCANJNZ INK1AJMPBEGININK1

4、:ACALL DISACALL DLIMSACALL DLIMSACALL CLEARACALL CCSCANJNZ INK2AJMP BEGININK2:MOV R2,#07fHMOV R4,#00HCOLUM:MOV DPTR,#7F03HMOV A,R2MOVX DPTR,AINC DPTRINC DPTRMOVX A,DPTRJB ACC.2,LONEMOV A,#00HAJMP KCODELONE:JBACC.6,NEXTMOV A,#04HKCODE:ADD A,R4CJNEA,#00H,XYGMOVA,#09HAJMPXYG7XYG:CJNEA,#01H,XYG1MOVA,#08

5、HAJMPXYG7XYG1:CJNEA,#02H,XYG2MOVA,#0AHAJMPXYG7XYG2:CJNEA,#03H,XYG3MOVA,#0CHAJMPXYG7XYG3:CJNEA,#04H,XYG4MOVA,#0EHAJMPXYG7XYG4:CJNEA,#05H,XYG5MOVA,#0BHAJMPXYG7XYG5:CJNEA,#06H,XYG6MOVA,#07HAJMPXYG7XYG6:CJNEA,#07H,XYG7MOVA,#02HAJMPXYG7XYG7:ACALLPUTBUFPUSHACCKON:ACALL DISACALL CLEARACALL CCSCANJNZ KONPOP

6、 ACCNEXT:INC R4MOV A,R2JNB ACC.3,KEERRR AMOV R2,AAJMP COLUMKERR:AJMP BEGINCCSCAN:MOV DPTR,#7F03HMOV A,#00HMOV DPTR,AINC DPTRINC DPTRMOVX A ,DPTRCPL AANL A,#44HRETCLEAR:MOV DPTR,#7F03HMOV A,#00HMOVX DPTR,ARETDIS:PUSH ACCPUSH 00HPUSH 03HMOV R0,#50HMOV R3,#0F7HMOV A,R3AGAIN:MOV DPTR,#7F03HMOVX DPTR,AMO

7、V A,R0MOV DPTR,#DDEGMOVC A,A+DPTRMOV DPTR,#7F01HMOVX DPTR,AACALL DLIMSINC R0MOV A,R3JNBACC.0,OUTRL AMOV R3,AAJMP AGAINOUT:POP 03HPOP 00HPOP ACCRETDDEG:DB0FCH,60H,0DAH,0F2HDB66H,0B6H,0BEH,0E0HDB0FEH,0F6H,0EEH,3EHDB9CH,7AH,9EH,8EHDLIMS:MOV R7,#01HDL0:MOV R6,#0FFHDL1:DJNZ R6,DL1DJNZ R7,DL0RETPUTBUF:PUS

8、H 00HPUSHACCMOV53H,52HMOV52H,51HMOV51H,50HPOPACCMOV50H,AGOBACK:POP 00HRETEND2. 程序三:程序实现如下规定a) 定义键盘按键b) 可进行三位16进制除法运算c) 可进行两位10进制乘法运算 ORG0000HLJMPMAINORG1000HMAIN:MOV53H,#00HMOV52H,#00HMOV51H,#00HMOV50H,#00HMOV60H,#00HMOV61H,#00HMOV62H,#00HMOV63H,#00HMOV64H,#00HMOV65H,#00HMOV66H,#00HMOV67H,#00HMOV68H

9、,#0CCHKEYSUB:MOV A,#0DHMOVDPTR,#7F00HMOVX DPTR,ABEGIN:ACALL DISACALL CLEARACALL CCSCANJNZ INK1AJMPBEGININK1:ACALL DISACALL DLIMSACALL DLIMSACALL CLEARACALL CCSCANJNZ INK2AJMP BEGININK2:MOV R2,#07fHMOV R4,#00HCOLUM:MOV DPTR,#7F03HMOV A,R2MOVX DPTR,AINC DPTRINC DPTRMOVX A,DPTRJB ACC.2,LONEMOV A,#00HAJ

10、MP KCODELONE:JBACC.6,NEXTMOV A,#04HKCODE:ADD A,R4CJNEA,#00H,XYGMOVA,#09HAJMPXYG7XYG:CJNEA,#01H,XYG1MOVA,#08HAJMPXYG7XYG1:CJNEA,#02H,XYG2MOVA,#0AHAJMPXYG7XYG2:CJNEA,#03H,XYG3MOVA,#0CHAJMPXYG7XYG3:CJNEA,#04H,XYG4MOVA,#0EHAJMPXYG7XYG4:CJNEA,#05H,XYG5MOVA,#0BHAJMPXYG7XYG5:CJNEA,#06H,XYG6MOVA,#07HAJMPXYG

11、7XYG6:CJNEA,#07H,XYG7MOVA,#02HAJMPXYG7XYG7:ACALLPUTBUFPUSHACCKON:ACALL DISACALL CLEARACALL CCSCANJNZ KONPOP ACCNEXT:INC R4MOV A,R2JNB ACC.3,KEERRR AMOV R2,AAJMP COLUMKERR:AJMP BEGINCCSCAN:MOV DPTR,#7F03HMOV A,#00HMOV DPTR,AINC DPTRINC DPTRMOVX A ,DPTRCPL AANL A,#44HRETCLEAR:MOV DPTR,#7F03HMOV A,#00H

12、MOVX DPTR,ARETDIS:PUSH ACCPUSH 00HPUSH 03HMOV R0,#50HMOV R3,#0F7HMOV A,R3AGAIN:MOV DPTR,#7F03HMOVX DPTR,AMOV A,R0MOV DPTR,#DDEGMOVC A,A+DPTRMOV DPTR,#7F01HMOVX DPTR,AACALL DLIMSINC R0MOV A,R3JNBACC.0,OUTRL AMOV R3,AAJMP AGAINOUT:POP 03HPOP 00HPOP ACCRETDDEG: DB 11H,12H,0CH,66HDB 10H,09H,04H,08HSZDEG

13、:DB 0FCH,60H,0DAH,0F2HDB 66H,0B6H,0BEH,0E0HDB 0FEH,0F6H,0EEH,3EHDB 9CH,7AH,9EH,8EHDB 0CCH,0DDH,0EEHPUTBUF:PUSH 00HPUSHACCMOVA,62HMOV63H,AMOVA,61HMOV62H,AMOVA,60HMOV61H,APOPACCPUSHDPHPUSHDPLMOVR5,AMOVDPTR,#DDEGMOVCA,A+DPTRMOV60H,AMOVA,R5POPDPLPOPDPHGOBACK:POP 00HJISUAN:CJNEA,#02H,CHUHAOACALLFUHAOAJMP

14、JSENDCHUHAO:CJNEA,#01H,DENGYUHAOACALLFUHAOAJMPJSENDDENGYUHAO:CJNE A,#03H,SHUZIACALLDENGYUAJMPJSENDSHUZI:ACALLPUTBUFJSEND:RETFUHAO:PUSHACCPUSHDPHPUSHDPLMOVDPTR,#DDEGMOVCA,A+DPTRMOVDPTR,#SEDEGMOVCA,A+DPTRMOV68H,AMOVA,60HMOV64H,AMOVA,61HMOV65H,AMOVA,62HMOV66H,AMOVA,63HMOV67H,AMOV60H,#00HMOV61H,#00HMOV6

15、2H,#00HMOV63H,#00HPOPDPLPOPDPHPOPACCRETDENGYU:PUSHACCMOVA,61HANLA,#0FHRLARLARLARLAMOVR5,AMOVA,60HANLA,#0FHORLA,R5MOV50H,AMOVA,63HANLA,#0FHRLARLARLARLAMOVR5,AMOVA,62HANLA,#0FHORLA,R5MOV51H,AMOVA,65HANLA,#0FHRLARLARLARLAMOVR5,AMOVA,64HANLA,#0FHORLA,R5MOV52H,AMOVA,67HANLA,#0FHRLARLARLARLAMOVR5,AMOVA,66

16、HANLA,#0FHORLA,R5MOV53H,AMOVA,68HCJNEA,#0DDH,CHENGFAAJMPJIWANCHENGFA:MOVA,50HANLA,#07HMOV69H,AMOVA,50HANLA,#10HRRAORL69H,AMOVA,50HANLA,#60HRRAMOV70H,AMOVA,51HANLA,#03HSWAPARLARLAORL70H,AMOVA,51HANLA,#04HRRARRAMOV71H,AMOVA,51HANLA,#70HRRARRARRAORL71H,AMOVA,#00HORLA,71HMOV51H,AMOVA,70HORLA,69HMOV50H,A

17、MOVA,52HANLA,#07HMOV69H,AMOVA,52HANLA,#10HRRAORL69H,AMOVA,52HANLA,#60HRRAMOV70H,AMOVA,53HANLA,#03HSWAP ARLARLAORL70H,AMOVA,53HANLA,#04HRRARRAMOV71H,AMOVA,53HANLA,#70HRRARRARRAORL71H,AMOVA,#00HORLA,71HMOV53H,AMOVA,70HORLA,69HMOV52H,ADBMUL:MOVA,52HMOVB,50HMULABXCHA,50HMOV74H,BMOVB,53HMULABADDA,74HMOV7

18、5H,ACLRAADDCA,BMOV74H,AMOVA,51HMOVB,52HMULABADDA,75HXCHA,51HXCHA,BADDCA,74HMOV74H,AMOV73H,#00HPUSHACCMOVA,73HRLCAMOV73H,APOPACCMOVA,53HMULABADDA,74HMOV74H,ACLRAMOVACC.0,CPUSHACCMOVA,73HMOVC,ACC.0POPACCADDCA,BMOV75H,AMOV53H,51HMOV52H,50HCOVER:MOVA,52HANLA,#07HMOV60H,AMOVA,52HRRARRARRAANLA,#07HMOV61H,

19、AMOVA,52HRRA RRARRARRARRARRAANLA,#03HMOV62H,AMOVA,53HJNBACC.0,BUMOVA,62HADDA,#04HMOV62H,ABU:MOVA,53HRRAANLA,#07HMOV63H,AAJMPQKJIWAN:MOVA,50HANLA,#0FHMOV60H,AMOVA,50HANLA,#0F0HRRARRARRARRAMOV61H,AMOVA,51HANLA,#0FHMOV62H,AMOVA,51HANLA,#0F0HRRARRARRARRAMOV63H,AQK:MOV50H,#00HMOV51H,#00HMOV52H,#00HMOV53H

20、,#00HMOV64H,#00HMOV65H,#00HMOV66H,#00HMOV67H,#00HMOV68H,#0CCHPOPACCRETDL1MS:MOV R7,#05HDL0:MOV R6,#0FFHDL1:DJNZ R6,DL1DJNZ R7,DL0RETRETEND心得体会:这次课程设计重要是对单片机编程知识一次综合运用,也是由理论结合实践第一步,为我后来学习奠定了良好基本。通过这次课程设计,我对单片机系统有了更加清晰地结识,懂得了所学知识重要性,对设计过程与环节以及应注意细节均有了更为深刻理解和领略。设计中遇到了许多平时没有遇到问题,但是,在教师精心指点,以及在同窗协助下,基本上得到理解决。

展开阅读全文
部分上传会员的收益排行 01、路***(¥15400+),02、曲****(¥15300+),
03、wei****016(¥13200+),04、大***流(¥12600+),
05、Fis****915(¥4200+),06、h****i(¥4100+),
07、Q**(¥3400+),08、自******点(¥2400+),
09、h*****x(¥1400+),10、c****e(¥1100+),
11、be*****ha(¥800+),12、13********8(¥800+)。
相似文档                                   自信AI助手自信AI助手
搜索标签

当前位置:首页 > 学术论文 > 其他

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        获赠5币

©2010-2024 宁波自信网络信息技术有限公司  版权所有

客服电话:4008-655-100  投诉/维权电话:4009-655-100

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :gzh.png    weibo.png    LOFTER.png 

客服