单片机查表程序设计

单片机查表程序设计

ID:13803668

大小:32.50 KB

页数:4页

时间:2018-07-24

单片机查表程序设计_第1页
单片机查表程序设计_第2页
单片机查表程序设计_第3页
单片机查表程序设计_第4页
资源描述:

《单片机查表程序设计》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库

1、$INCLUDE(C8051F020.INC)BIT_COUNTDATA07FHTIMERDATA07EHTIMER1DATA07DHTENDATA07CHDATA_INDATA020HDATA_OUTDATA021HDATA_OUT1DATA022HDATA_OUT2DATA023HDATA_OUT3DATA024HDATA_OUT4DATA025HCLKBITP1.6DATBITP1.7ORG0000HJMPSTARTORG0100HSTART:movWDTCN,#0deh;disablewatchdogtimer

2、movWDTCN,#0adhmovOSCXCN,#67h;enableexternalcrystal;oscillatorat22.1184MHzclrA;waitatleast1msdjnzacc,$;wait~512usdjnzacc,$;wait~512usosc_wait:;pollforXTLVLD-->1mova,OSCXCNjnbacc.7,osc_waitorlOSCICN,#08h;selectexternaloscillatoras;systemclocksourceorlOSCXCN,#80h;e

3、nablemissingclockdetectorCP1INIT:movCPT1CN,#080h;Comparator1ControlRegistermovA,#010h;CPT1CNdjnzACC,$;CPT1CNwaitatleast20usanlCPT1CN,#not(30h)movEIP1,#040hMOVTIMER,#50PORTINIT:movXBR2,#044hmovP0MDOUT,#001hDELAY0:MOVTIMER1,#255DELAY1:DJNZTIMER1,DELAY1DJNZTIMER,DE

4、LAY0ANLP5,#00HMOVDATA_OUT,#10100100BCALLSENDORLP5,#80HMAIN://MOVR0,0X00//SUBBCPT1CN,R0//JNZMAINMOVA,CPT1CN;等待有键按下,发送读键盘指令ANLA,#40HJNZMAINMOVDATA_OUT,#00010101B;CALLSENDCALLRECEIVEANLP5,#80HCALLSEARCHMOVA,R2ANLA,#0FHMOVDATA_OUT2,AMOVA,R2SWAPAANLA,#0FHMOVDATA_OUT1

5、,AMOVA,R3ANLA,#0FHMOVDATA_OUT4,AMOVA,R3SWAPAANLA,#0FHMOVDATA_OUT3,AMOVDATA_OUT,#10100100BCALLSENDMOVDATA_OUT,#11001011BCALLSENDMOVDATA_OUT,DATA_OUT1CALLSENDMOVDATA_OUT,#11001010BCALLSENDMOVDATA_OUT,DATA_OUT2CALLSENDMOVDATA_OUT,#11001001BCALLSENDMOVDATA_OUT,DATA_

6、OUT3CALLSENDMOVDATA_OUT,#11001000BCALLSENDMOVDATA_OUT,DATA_OUT4CALLSEND//MOVB,#10//MOVA,DATA_IN//DIVAB//MOVTEN,A//MOVDATA_OUT,#10100001B//CALLSEND//MOVDATA_OUT,#10100001B//CALLSEND//MOVDATA_OUT,#10000001B//CALLSEND//MOVDATA_OUT,TEN//CALLSEND//MOVDATA_OUT,#100000

7、00B//CALLSEND//MOVDATA_OUT,B//CALLSENDANLP5,#80HWAIT:MOVA,CPT1CN;等待按键放开ANLA,#40HORLA,#00HJZWAITJMPMAINSEND:MOVBIT_COUNT,#8;发送字符子程序ANLP5,#00HCALLLONG_DELAYSEND_LOOP:MOVC,DATA_OUT.7MOVDAT,CSETBCLKMOVA,DATA_OUTRLAMOVDATA_OUT,ACALLSHORT_DELAYCLRCLKCALLSHORT_DELAYDJN

8、ZBIT_COUNT,SEND_LOOPCLRDATRETRECEIVE:MOVBIT_COUNT,#8;接收字符子程序SETBDATCALLLONG_DELAYRECEIVE_LOOP:SETBCLKCALLLONG_DELAYMOVA,DATA_INRLAMOVDATA_IN,AMOVC,DATMOVDATA_IN.0,CCL

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。