資源描述:
《【精品】廣東工業(yè)大學(xué)單片機(jī)課程設(shè)計(jì)(何教授)》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在工程資料-天天文庫。
1、課程設(shè)計(jì)課程名稱題目名稱單片機(jī)原理課程設(shè)計(jì)學(xué)生學(xué)院自動(dòng)化學(xué)院專業(yè)班級(jí)學(xué)號(hào)學(xué)生姓名指導(dǎo)教師何X敏、李X芳2010年09月10日(1)把兩條輸入線同一端口的一根輸入線接到kO接口。當(dāng)kO=l,顯示78FA;當(dāng)k0=0,顯示12BE:程序如下:ORG0000HHJMPMAINORGI000HDB0EEH,8EH,0FEH,0E0HDB9EH,3EH,0DAH,60HMAIN:MOV52H,#00HMOV53H,#00HMOV51H,#OOHMOV5()H,#()()HMOVR5,#53HKEYSUB:MOVA,#03HMOVDPTR,#7F00HMOVX@DPTR,A
2、BEGIN:MOVDPTR,#()7F()3HMOVA,@DPTRMOVR3,#0FEHJBACCDISPLAY】JMPD1SPLAY2DISPLAY1:MOVR2,#(X)HJMPAlDISPLAY2:MOVR2,#04HAl:MOVA,R3MOVDPTR,#7F01HMOVX@DPTR,AMOVDPTR,#1000HMOVA,R2MOVCA,@A+DPTRMOVDPTR,#7F02HMOVX@DPTR,ACALLDLIMSINCR2MOVA,R3RLAMOVR3,AJNBACC.4,BEGINJMPA1DLIMS:MOVR7,#05HDLO:MOVR6,#0
3、FFHDL1:DJNZR6,DL1DJNZR7,DL0RETEND(2)編程實(shí)現(xiàn)鍵盤ORG0000HHJMPMAINORGI000H54790EBA并能左移顯示:程序如下:MAIN:MOV52H,#()()HMOV53H,#00HMOV51H,#OOHMOV50H,#00HMOVR5,#53HKEYSUB:MOVA,#()3HMOVDPTR,#7F00HMOVX@DPTR,ABEG1N:ACALLDISACALLCLEARACALLCCSCANJNZINK1AJMPBEGININKkACALLDISACALLDLIMSACALLDLIMSACALLCLEARAC
4、ALLCCSCANJNZINK2AJMPBEGININK2:MOVR2,#0FEHMOVR4,#00HCOLUM:MOVDPTR,#7F01HMOVA,R2MOVX@DPTR,AINCDPTRINCDPTRMOVXA,@DPTRJBACC.3JLONEMOVA,#00HAJMPKCODELONE:JB.ACC.2,NEXTMOVA,#04HKCODE:ADDA,R4ACALLPUTBUFPUSHACCKON:ACALLDISACALLCLEARACALLCCSCANJNZKONPOPACCNEXT:INCR4MOVA,R2JNBACC.4,KEERRLAMOVR
5、2,AAJMPCOLUMKERR:AJMPBEGINCCSCANiMOVDPTR,#7F01HMOVA,#()()HMOV@DPTR,AINCDPTRINCDPTRMOVXA,@DPTRCPLAANLA,#0CHRETCLEAR:MOVDPTR,#7F02HMOVA,#00HMOVX@DPTR,ARETDIS:PUSHACCPUSHOOHPUSH03HMOVR(),#()5HMOVR3,#0F7HMOVA,R3AGAIN:MOVDPTR,#7F01HMOVX@DPTR,AMOVA,@R()MOVDPTR,#DDEGMOVCA,@A+DPTRMOVDPTR,#7F
6、02HMOVX@DPTR,AACALLDLIMSINCROMOVA,R3JNBACC.OQUTRRAMOVR3,AAJMPAGAINOUT:POP03HPOPOOHPOPACCRETDDEG:DB0EE,3EH,9EH,7AHDB0E6H,0E0H,66H,0B6HDLIMS:MOVR7,#01HDL():MOVR6,#0FFHDL1:DJNZR6,DL1DJNZR7,DL0RETPUTBUF:PUSHOOHMOVR7,AMOVA,51HMOV50H,AMOVA,52HMOV51H,AMOVA,53HMOV52H,AMOVA,R7MOVR3,APOPOOHRET
7、END(3)程序?qū)崿F(xiàn)單片機(jī)售票機(jī),以下要求:a)當(dāng)k()=l時(shí),鍵入地址、價(jià)錢、SET,設(shè)置某個(gè)地址的票價(jià),該機(jī)至少可連續(xù)設(shè)置三個(gè)不同地址的價(jià)錢:上海864元、北京756元、廣州819元。b)當(dāng)k0=0時(shí),鍵入一個(gè)地址,購買的張數(shù),按SET得到總價(jià),再鍵入另一個(gè)地址、購買的張數(shù),按SET即得總價(jià),可計(jì)得至少三個(gè)地址的合總價(jià)。程序如下:#include#include#defineucharunsignedchar#dcfincpeonXBYTE[0X7F00]#definepaXBYTE[0X7F01]#definepbXB
8、YTEL0X7F02J#