资源描述:
《PC机实时时钟的设计》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、1PC机实时时钟的设计利用PC机现有的硬件和软件资源设计程序,以实现在显示器上显示XX(时):XX(分):XX(秒)。(1)设计思路PC机系统板上使用一片8253,其地址为40H—43H,其通道0以方式3工作,每55ms向中断控制器8259AIRQ0端发一次中断请求。本设计题要求借用原有电路,重新设置8253的计数器0每10ms产生一次中断,100次中断后加1秒,然后调整时、分、秒并显示在屏幕上。(2)实时时钟的功能按下任意键开始显示数据区中存放的时间值,并且每秒更新一次,运行中按下空格键则停止运行并返回DOS。程
2、序中应保护原系统的08H中断矢量以便退出时恢复原系统的设置。(3)题目的要求①PC机实时时钟的基本程序如附录一,请根据中断服务程序设计时钟时、分、秒调整的中断服务程序,然后调试实现时钟的基本功能②在原有程序基础上,增加键盘输入字符功能,可通过修改时、分、秒的数据,实现实时时钟可调整功能。③在原有程序基础上,设计美观的时钟显示方式及友好的操作方式。附录一STACKsegmentparastack'stack'db256dup(0)stackendsdatasegmentparapublic'data'countdb1
3、00tenhdb'1'hourdb'3',20htenmdb'1'minutedb'0'db':'tensdb'5'seconddb'0',0dh,'$'dataendscodesegmentparapublic'code'startprocfarassumecs:codepushdsxorax,axpushaxmovah,01int21hclicldmovax,0000hmovds,axmovsi,0020hlodswmovbx,axlodswpushax;segpushbx;offsetmovax,datamo
4、vds,axassumeds:datamovax,0000hmoves,axmovdi,0020hmovax,offsettimerstoswmovax,csstoswmoval,00110110bout43h,almovax,11932out40h,almoval,ahout40h,alinal,21hpushaxmoval,0fchstiforever:movdl,0ffhmovah,06int21hjzdispcmpal,20hjzexitdisp:movdx,offsettenhmovah,9int21hm
5、oval,secondwaitcha:cmpal,secondjzwaitchajmpforeverexit:clicldpopaxout21h,axmoval,36hout43h,almoval,0out40h,alout40h,almovax,0moves,axmovdi,4*8popaxstoswpopaxstoswstiretstartendptimer:pushaxpushcxstimoval,countdecalmovcount,aljnzint_retmovcount,100moval,seconda
6、ddal,1aaamovsecond,aljncint_retmoval,tensadcal,0aaaandal,0fhmovtens,alcmpal,6jnzint_retmoval,0movtens,almoval,minuteaddal,1aaamovminute,aljncint_retmoval,tenmadcal,0aaaandal,0fhmovtenm,alcmpal,6jnzint_retmoval,0movtenm,almoval,tenhmovcl,4shlal,clmovcl,almoval,
7、hourandal,0fhoral,claddal,1daacmpal,24hjzresethmovch,almovcl,4shral,cloral,30hmovtenh,almoval,chandal,0fhoral,30hmovhour,aljmpint_retreseth:movtenh,'0'movhour,'0'int_ret:moval,secondandal,0fhoral,30hmovsecond,almoval,tensandal,0fhoral,30hmovtens,almoval,tenman
8、dal,0fhoral,30hmovtenm,almoval,minuteandal,0fhoral,30hmovminute,alclimoval,20hout20h,alpopcxpopaxiretcodeendsendstart附录一 STACK segment para stack 'stack' db 256 dup (0) stac