资源描述:
《单片机与HD7279的子程序.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、1单片机与HD7279的子程序ORG0100HSTART:MOVSP,#2FHMOVP1,#BLCALLDELAY25MMOVDATA_OUT,#0A4HLCALLSENDSETBCSMAIN:JBKEY,MAINMOVDATA_OUT,#15HLCALLSENDLCALLRECEIVSETBCSMOVA,DATA_INANIA,#0F0HSWAPAMOVTEN,AMOVA,DATA_INANLA,#0FHMOVDIGTT,AMOVDATA_OUT,#0A1HLCALLSENDMOVDATA_OUT,#81HLCALLSE
2、NDLCALLDELAY100MOVDATA_OUT,TENLCALLSENDMOVDATA_OUT,#80HLCALLSENDLCALLDELAY100MOVDATA_OUT,TENLCALLSENDMOVDATA_OUT,#80HLCALLSENDLCALLDELAY100MOVDATA-OUT,DIGITLCALLSENDSETBCSWAIT:INBKEY,WAITLJMPMAINSEND:MOVBIT_COUNT,#8CLRCSSEN_LOOP:LCALLDELAY100MOVC,DATA_OUT,7MOVDAT,
3、CSETBCLK:CLKMOVA,DATA_OUTBLAMOVDATA_OUT,ALCALLDELAY100CLRCLKDJNZBIT_COUNT,SEND_LOOPCLRDATLCALLDELAY100RETEND2键盘子程序#include#defineuintunsignedint#defineucharunsignedchar#defineulongunsignedlongvoiddelay10ms();//按键去抖。voidkeyboard(){P3.3=0;P3.0=0;P3.1=1;P3.6
4、=0;P3.7=1;ucharkey;while(1){P2=0xff;P2_4=0;key=P2&0x0f;if(key!=0x0f){delay10ms();key=P2&0x0f;if(key!=0x0f){switch(key){case0x0e:display();break;case0x0d:dispbulai();break;case0x0b:shiftup();break;case0x07:shiftdown();break;}key=key&0x0f;while(key!=0x0f){key=P2key=
5、key&0x0f;}}}P2=0xff;P2_5=0;key=P2;key=key&0x0f;if(key!=0x0f){delay10ms();key=P2&0x0f;if(key!=0x0f){switch(key){case0x0e:p1=1;break;case0x0d:p1=2;break;case0x0b:p1=3;break;case0x07:p1=0;break;}key=key&0x0f;while(key!=0x0f){key=P2;key=key&0x0f;}}}P2=0xff;P2_6=0;key=
6、P2;key=key&0x0f;if(key!=0x0f){delay10ms();key=P2&0x0f;if(key!=0x0f){switch(key){case0x0e:p1=4;break;case0x0d:p1=5;break;case0x0b:p1=6;break;case0x07:send();break;}key=key&0x0f;while(key!=0x0f){key=P2;key=key&0x0f;}}}P2=0xff;P2_7=0;key=P2;key=key&0x0f;if(key!=0x0f)
7、{delay10ms();key=P2&0x0f;if(key!=0x0f){switch(key){case0x0e:p1=7;break;case0x0d:p1=8;break;case0x0b:p1=9;break;case0x07:;break;}key=key&0x0f;while(key!=0x0f){key=P2key=key&0x0f;}}}}}voiddelay10ms(){uchari,j;for(i=50;i>0;i--)for(j=200;j>0;j--);}3LCD液晶显示子程序#include<
8、reg51.h>#includesbitbz=P3^5;sbitrq=P3^4;delay()//延时{unsignedchari,j;for(i=0;i<2;i++){for(j=0;j<5;j++);}}longdelay(){unsignedinti,j;for(i=0;i<