您好,欢迎访问三七文档
当前位置:首页 > 电子/通信 > 综合/其它 > (完整word版)微机课程设计(模拟计数器设运算)
合肥工业大学宣城校区信息工程系课程设计课程:微机原理与接口技术设计专业班级:学号:xxxxxx姓名:xx一、设计题目及要求模拟计算器运算(加,减,乘,括号)1.通过小键盘做加、减、乘、括号运算。七段数码管显示器作输入数据和结果数据的显示。2.按键规定:(1)数字用小键盘0~9输入。(2)功能按键设定:“A”——“+”“B”——“-”“D”——“*”“E”——“括号”“F”——“=”“C”——开始运算(包括撤消运算),屏幕显示“0”。3.运算要求:(1)输入一原始数据,显示器跟随显示。(2)按“+”、“-”、“*”或“括号”时,显示器内容不变。(3)再输入数据时,显示器跟随显示。(4)按“=”时,显示器显示最终结果数据。(5)按“C”时,屏幕显示“0”。(6)需要考虑运算的优先级问题。(7)可以只考虑正整数运算,不考虑负数和实数运算。注:输入数据时,若超出显示范围则不响应超出部分。在计算结果超出显示范围时,则显示“F”。二、设计思想调用键盘扫描子程序不断扫描键盘是不是有输入,如果没有就一直扫描,如果有就停止扫描,完成输入,并将输入的数字通过调用显示子程序显示到LED显示器上。利用汇编的程序核对输入键的数值,通过调用加,减,乘,括号,子程序实现一位十进制数以内的及加、减、乘以及括号法运算。运算完成后将运算的结果储存并显示到LED显示器上。三、功能流程图NYYNYNYNYNYNYNY四、结果讨论及心得开始8255初始化扫描有无按键数字键调用括号子程序调用乘法子程序调用减法子程序调用加法子程序保存数据加减乘括号清零等号显示进行加减乘运算并存结果显示清除标志及数据分到这个课设题目第一反应是比较简单,但仔细一思考有没多大头绪,又感觉挺复杂,尤其是实现括号运算一点思路都没有。后来经过网上找相关资料和队友讨论渐渐有了思路。经过一个星期的反复实验终于完成了这次课设,在实验箱上可以完成一位数的加减乘以及括号运算。这次课设中遇到很多问题,让我看到了自己的很多不足比如汇编能力不足,对芯片不了解等等。同时这次课设让我巩固了所学的课本知识,提高了动手实践能力和团队合作能力,自己感觉收获还是很大的。附录:实验代码(完整的源程序).MODELTINYCOM_8255EQU0273H;8255控制口PA_8255EQU0270HPB_8255EQU0271HPC_8255EQU0272H.STACK100.DATAZ1DB8DUP(?)bufferDB8DUP(?);8个字节显示缓冲区SEG_TABDB0C0H,0F9H,0A4H,0B0H,99H,92H,82H,0F8HDB080H,90H,88H,83H,0C6H,0A1H,86H,8EH,0FFH.CODESTART:MOVAX,@DATAMOVDS,AXMOVES,AXNOPCLD;0-DF,地址自动递增MOVDX,COM_8255MOVAL,89Hgg:OUTDX,AL;PA、PB输出,PC输入LEADI,bufferMOVAL,10HMOVCX,08HREPSTOSBCALLDIRMAIN3:LEADI,bufferMAIN2:CALLkeyiCMPAL,0AH;+JZe3CMPAL,0DH;*JZQ3CMPAL,0CH;=JZggCMPAL,0BH;-JZE4CMPAL,0EH;()JZE5QQ:STOSBQQQ:CALLDIRCMPDI,offsetbuffer+8JNZMAIN2JMPMAIN3e3:JMPQ1E4:JMPQ6E5:JMPQ7Q3:CALLKEYICMPAL,0AHJZQ1CMPAL,0DHJZQ3CMPAL,0CHJZggCMPAL,0BHJZE7CMPAL,0EHJZQ5BSTOSBCALLDIRCMPDI,OFFSETBUFFER+8MOVBL,ALLEASI,BUFFERLODSBMULBLLEADI,BUFFERSTOSBMOVBL,ALCALLKEYIJMPFE8:JMPggE7:JMPQ6Q5B:JMPQ5AQx:CALLKEYICMPAL,0AHJZQ1CMPAL,0DHJZQ3CMPAL,0CHJZE8CMPAL,0BHJZQ6CMPAL,0EHJZM3STOSBCALLDIRCMPDI,OFFSETBUFFER+8MOVBL,ALLEASI,BUFFER+4LODSBMULBLLEADI,BUFFERSTOSBMOVBL,ALCALLKEYIJMPFM3:JMPQ5ASA:JMPS9Q1:CALLkeyiSTOSBCALLDIRCMPDI,offsetbuffer+8S1:CALLKEYICMPAL,0EHJZRCMPAL,0DHJZSLEADI,BUFFER+3STOSBLEASI,BUFFERLODSBMOVBL,ALLEASI,BUFFER+1LODSBADDAL,BLLEADI,BUFFERSTOSBMOVBL,ALJMPDYQC:JMPQ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PAL,0DHJZQ9CMPAL,0CHJZQACMPAL,0BHJZQBCMPAL,0EHJZQ5SE:JMPSJRT:JMPggV1:JMPQ9V2:JMPQBV3:JMPQAQ56:CALLKEYISTOSBCALLDIRCMPDI,offsetbuffer+8LEADI,BUFFER+5STOSBCALLkeyiCMPAL,0AHJZSWCMPAL,0DHJZV1CMPAL,0CHJZV3CMPAL,0BHJZV2CMPAL,0EHJZQ56QU:JMPQ6QP:JMPQ3S9:CALLKEYICALLDIRCMPDI,offsetbuffer+8STOSBCALLKEYICMPAL,0EHJZSQCMPAL,0DHJZSFSTOSBCALLDIRCMPDI,offsetbuffer+8LEADI,BUFFER+7STOSBLODSBMOVBL,ALLEASI,BUFFER+5LODSBADDAL,BLLEADI,BUFFER+4STOSBMOVBL,ALSQ:LEASI,BUFFER+6LODSBMOVBL,ALLEASI,BUFFER+1LODSBADDAL,BLLEADI,BUFFER+4STOSBMOVBL,ALJMPDZPP:JMPFDZ:LEASI,BUFFERLODSBMOVBL,ALLEASI,BUFFER+4LODSBMULBLLEADI,BUFFERSTOSBCALLKEYICMPAL,0FHJZPPDIRPROCNEARPUSHAXPUSHBXPUSHDXLEASI,buffer;置显示缓冲器初值MOVAH,0FEHLEABX,SEG_TABLD0:MOVDX,PA_8255LODSBXLAT;取显示数据OUTDX,AL;段数据-8255PA口INCDX;扫描模式-8255PB口MOVAL,AHOUTDX,ALCALLDL1;延迟1msMOVDX,PB_8255MOVAL,0FFHOUTDX,ALTESTAH,80HJZLD1ROLAH,01HJMPLD0LD1:POPDXPOPBXPOPAXRETDIRENDPDL1PROCNEAR;延迟子程序PUSHCXMOVCX,500LOOP$POPCXRETDL1ENDPKEYIPROCNEARPUSHBXPUSHDXLK:CALLAllKey;调用判有无闭合键子程序JNZLK1CALLDIRCALLDIR;调用显示子程序,延迟6msJMPLKLK1:CALLDIRCALLDIRCALLAllKey;调用判有无闭合键子程序JNZLK2CALLDIRJMPLKLK2:MOVBL,0FEH;R2MOVBH,0;R4LK4:MOVDX,PB_8255MOVAL,BLOUTDX,ALINCDXINAL,DXTESTAL,01HJNZLONEXORAL,AL;0行有键闭合JMPLKPLONE:TESTAL,02HJNZNEXTMOVAL,08H;1行有键闭合LKP:ADDBH,ALLK3:CALLDIR;判断释放否CALLAllKeyJNZLK3MOVAL,BH;键号-ALPOPDXPOPBXRETNEXT:INCBH;列计数器加1TESTBL,80HJZKND;判是否已扫到最后一列ROLBL,01HJMPLK4KND:JMPLKKEYIENDPAllKeyPROCNEARMOVDX,PB_8255XORAL,ALOUTDX,AL;全0-扫描口INCDXINAL,DX;读键状态NOTALANDAL,03H;取低二位RETAllKeyENDPENDSTART
本文标题:(完整word版)微机课程设计(模拟计数器设运算)
链接地址:https://www.777doc.com/doc-6877998 .html