计程车计价器_第1页
计程车计价器_第2页
计程车计价器_第3页
计程车计价器_第4页
计程车计价器_第5页
已阅读5页,还剩15页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、微机原理与接口技术信息科学与技术学院微机原理与接口技术课程设计报告课 程 题 目: 计程车计价器 学 生 姓 名: 刘郁 学 号: 2009082212 专业、年级 : 计科09级一班 指 导 教 师: 裘 祖 旗 时 间: 2012年1月11 181.题目要求11.1 题目:计程车计价器11.2 要求12、 功能设计12. 1 输出字符串宏 (str)122 定义光标定位宏123 清屏宏 (clearscreen)124 延时模块125 数字显示模块126 数字自增模块22.7 设置单价模块23、 详细设计23.1 主函数23.2 输出字符串宏模块33.1.1 本设计的方法,计算公式33.1

2、.3 本设计的重点、难点和解决方法333将数字显示成数管的形式的disp子程序334 实现自加功能435 延时模块的实现44.程序运行界面55总结56参考文献:67附原程序:61.题目要求1.1 题目:计程车计价器1.2 要求1实现计价功能;2实现手动设计单价3实现显示里程、单价与总价2、 功能设计2. 1 输出字符串宏 (str) 功能:将字符串定义在宏里面,然后输出。22 定义光标定位宏 功能:指定光标的位置。23 清屏宏 (clearscreen)功能:设置开始和结尾的行列数以及属性。24 延时模块 功能:延缓每次显示的时间,使之能够准确的输出。25 数字显示模块 功能:显示所有的数字内

3、容,其中包括行驶过程中的价格,和里程的显示。在数据段中定义数字的格式,通过中断显示出数字能容。光标定位,使数字显示在指定的位置。26 数字自增模块 功能:设计程车每走100m,总价格增加0.2元,起步价为5元。此时在行驶的里程中,不断的加100m,当达到3km的时候,通过cx的判断,使价格从5元开始,每走100m加0.2元。需要用到延时程序,和跳转功能。2.7 设置单价模块 功能:手动设置单价,设定每公里要走的单价。在数据段定义后,每输入一次,通过取数据段的数据,完成定价的功能3、 详细设计3.1 主函数主函数main定义界面Inc cx显示总价,显示里程显示总价,价格增加0.2元/100m显

4、示不响应从键盘输入字符Cx<32?CmpsCmpgYYYNNN3.2 输出字符串宏模块3.1.1 本设计的方法,计算公式 显示字符串是本模块的功能,方法是将字符串传送到dx中,然后用09中断输出。strDx ax压栈字符>dx输出Ax dx出栈结束3.1.2 本模块的流程图 3.1.3 本设计的重点、难点和解决方法 我认为本设计的重点和难点在于字符串的传送,解决方法在于用09输出和字符串的定义一起搭配使用。33将数字显示成数管的形式的disp子程序置光标位置取disptime中的时的十位至al将取得数字乘以16得到其对应在shuzi段的对应显示显示字符串重复上述过程,将时分秒全部显

5、示置光标,并显示字符串置光标,并显示字符串Dx加0634 实现自加功能moval, valuenum+6inc almov valuenum+6,alCmp al,10Nymov valuenum+6,00hmov al,valuenum+4inc almov valuenum+4,al直到最后完成最高位进位35 延时模块的实现Mov bl,75d36Mov cx,6632d检测61h端口的第四位,直到第四位发生改变Cx-1>0YNBl-1>0YN结束4.程序运行界面5总结在这次的课程设计中,学到的知识有很多,收获也不小。可以从理论结合实际,可以把身边的一些所涉及到的编程工具自己也

6、能够体会和学习一下。比如这次所做的计程车计价器。由于能力有限不能拿单片机或仿真的工具来做,只是用汇编基础的模拟了一下,其中也了解到了最基本的原理,锻炼了自己的基础知识水平。可以用到将来的实际应用当中。能够体会到其中的乐趣。但是这次也有许多的问题,首先是自己的编程水平不好,所以做起来速度很慢,需要以后多多练习,实验。有些功能还没有能够实现,所以还需要进一步的学习,要学的知识还有很多,还应该花更多的精力在这些方面,这样才能够提高自己的专业水平。汇编语言和微机接口原理也是最基层的计算机语言和最接近硬件的,只有了解了这里的本质,才能更有效准确的运用其他工具。6参考文献: 1 IBM-PC汇编语言程序设

7、计 沈美明 清华大学出版社 2001年8月第2版 2 IBM-PC汇编语言程序设计例题习题集沈美明 清华大学出版社 1991年6月第1版 3 微机系统和接口应用技术朱世鸿 著 清华大学出版社 2006年9月第1版 7附原程序:data segment valuenum db 00,00,00,".",00,"$"distance valuenum3 db 00,00,05,".",00,"$"price num1 db "total value","$" num2 db &q

8、uot;distance","$" num3 db "km","$" num4 db "yuan","$" stop db "*press s to stop!","$" go_on db"*press g to go on","$"shuzi db " _ ",0dh,0ah,"$" db "| |",0dh,0ah,"$"

9、db "|_|",0dh,0ah,"$" db " ",0dh,0ah,"$"db " |",0dh,0ah,"$" db " |",0dh,0ah,"$" db " _ ",0dh,0ah,"$" db " _|",0dh,0ah,"$" db "|_ ",0dh,0ah,"$" db " _ "

10、,0dh,0ah,"$" db " _|",0dh,0ah,"$" db " _|",0dh,0ah,"$" db " ",0dh,0ah,"$" db "|_|",0dh,0ah,"$" db " |",0dh,0ah,"$" db " _ ",0dh,0ah,"$" db "|_ ",0dh,0ah,"$

11、" db " _|",0dh,0ah,"$" db " _ ",0dh,0ah,"$" db "|_ ",0dh,0ah,"$" db "|_|",0dh,0ah,"$" db " _ ",0dh,0ah,"$" db " |",0dh,0ah,"$" db " |",0dh,0ah,"$" db "

12、; _ ",0dh,0ah,"$" db "|_|",0dh,0ah,"$" db "|_|",0dh,0ah,"$" db " _ ",0dh,0ah,"$" db "|_|",0dh,0ah,"$" db " _|",0dh,0ah,"$"data endsposcurse macro dh1,dl1 ;定义光标定位宏 push ax push bx push d

13、x mov ah,2h mov bh,0h mov dh,dh1 mov dl,dl1 int 10h pop dx pop bx pop axendmcode segmentassume cS:code,ds:datamain proc far mov ax,data mov ds,ax clear macro aL1,bh1,ch1,cl1,dh1,dl1 MOV AH,06H mov aL,aL1 mov bh,bh1 mov ch,ch1 mov cl,cl1 mov dh,dh1 mov dl,dl1 INT 10H endm clear 0,01000000b,2,3,20,75

14、clear 0,00011110b,5,5,18,73 mov cx,0B: inc cxcmp cx,32jz ccall disp3call delay call disp2 call delay call delay call inc_2 call delaymov ah,0bhint 21hinc aljnz bmov ah,01hint 21hcmp al,'s'jnz bjmp ac: clear 0,01000000b,2,3,20,75 clear 0,00011110b,5,5,18,73 call disp1;显示价格 call delay call inc

15、_1;价格加2 call delay call disp2;显示里程 call delay call inc_2;里程加2 call delaymov ah,0bhint 21hinc aljnz cmov ah,01hint 21hcmp al,'s'jnz cjmp am:jmp ba:mov ah,0bhint 21hinc aljnz amov ah,01hint 21hcmp al,'g'jnz amov al,valuenumcmp al,0ja cmov al,valuenum+1cmp al,0ja cmov al,valuenum+2cmp a

16、l,3ja ccmp al,3jnz mjmp cRETmain endp;-output子程序-output proc nearpush axmov ah,09hint 21hpop axretoutput endp;inc_1 子程序inc_1 proc near push ax mov al,valuenum3+4 inc al inc al mov valuenum3+4,al cmp al,0ah jnz return3 mov valuenum3+4,00h mov al,valuenum3+2 inc al mov valuenum3+2,al cmp al,0ah jnz re

17、turn3 mov valuenum3+2,00h mov al,valuenum3+1 inc al mov valuenum3+1,al cmp al,0ah jnz return3 mov valuenum3+1,00h mov al,valuenum inc al mov valuenum3,al cmp al,0ah jnz return3 mov valuenum3,00h return3:pop axretinc_1 endp;inc_2 子程序inc_2 proc near push ax mov al,valuenum+4 inc al mov valuenum+4,al c

18、mp al,0ah jnz return mov valuenum+4,00h mov al,valuenum+2 inc al mov valuenum+2,al cmp al,0ah jnz return mov valuenum+2,00h mov al,valuenum+1 inc al mov valuenum+1,al cmp al,0ah jnz return mov valuenum+1,00h mov al,valuenum inc al mov valuenum,al cmp al,0ah jnz return mov valuenum,00h return:pop axr

19、etinc_2 endp ;-delay子程序-delay proc nearpush bxpush axpush cxmov bl,75dwaitf2:mov cx,1000d waitf1:in al,61hand al,10hcmp al,ahje waitf1mov ah,alloop waitf1dec blcmp bl,0jnz waitf2pop cxpop axpop bx retdelay endp;-disp1子程序, 从5开始显示-disp1 proc near lea dx,num1 poscurse 09h,6h call output lea dx,num2 pos

20、curse 0ch,08h call output lea dx,num3 poscurse 0ch,23h call output lea dx,num4 poscurse 09h,23h call output lea dx,stop poscurse 12h,06h call output lea dx,go_on poscurse 12h,30h mov ah,09h int 21h mov al,valuenum3 mov bl,12h mul bl mov dx,offset shuzi poscurse 07h,13h add dx,ax call output poscurse

21、 08h,13h add dx,06h call output poscurse 09h,13h add dx,06h call output poscurse 07h,16h mov al,valuenum3+1 mov bl,12h mul bl mov dx,offset shuzi poscurse 07h,16h add dx,ax call output poscurse 08h,16h add dx,06h call output poscurse 09h,16h add dx,06h call output poscurse 07h,19h mov al,valuenum3+2

22、 mov bl,12h mul bl mov dx,offset shuzi poscurse 07h,19h add dx,ax call output poscurse 08h,19h add dx,06h call output poscurse 09h,19h add dx,06h call output poscurse 09h,1ch mov dl,2eh mov ah,02h int 21h poscurse 07h,1eh mov al,valuenum3+4 mov bl,12h mul bl mov dx,offset shuzi poscurse 07h,1eh add

23、dx,ax call output poscurse 08h,1eh add dx,06h call output poscurse 09h,1eh add dx,06h call output ret disp1 endp;-disp2子程序-disp2 proc near push ax mov al,valuenum mov bl,12h mul bl mov dx,offset shuzi poscurse 0ah,13h add dx,ax call output poscurse 0bh,13h add dx,06h call output poscurse 0ch,13h add

24、 dx,06h call output poscurse 0ah,16h mov al,valuenum+1 mov bl,12h mul bl mov dx,offset shuzi poscurse 0ah,16h add dx,ax call output poscurse 0bh,16h add dx,06h call output poscurse 0ch,16h add dx,06h call output poscurse 0ah,19h mov al,valuenum+2 mov bl,12h mul bl mov dx,offset shuzi poscurse 0ah,19

25、h add dx,ax call output poscurse 0bh,19h add dx,06h call output poscurse 0ch,19h add dx,06h call output poscurse 0ch,1ch mov dl,2eh mov ah,02h int 21h poscurse 0ah,1eh mov al,valuenum+4 mov bl,12h mul bl mov dx,offset shuzi poscurse 0ah,1eh add dx,ax call output poscurse 0bh,1eh add dx,06h call outp

26、ut poscurse 0ch,1eh add dx,06h call output pop axret disp2 endp;-disp3子程序-disp3 proc near lea dx,num1 poscurse 09h,6h mov ah,09h int 21h lea dx,num2 poscurse 0ch,8h mov ah,09h int 21h lea dx,num3 poscurse 0ch,23h call output lea dx,num4 poscurse 09h,23h call output lea dx,stop poscurse 12h,06h mov ah,09h int 21h lea dx,

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论