预览加载中,请您耐心等待几秒...
1/10
2/10
3/10
4/10
5/10
6/10
7/10
8/10
9/10
10/10

在线预览结束,喜欢就下载吧,查找使用更方便

如果您无法下载资料,请参考说明:

1、部分资料下载需要金币,请确保您的账户上有足够的金币

2、已购买过的文档,再次下载不重复扣费

3、资料包下载后请先用软件解压,在使用对应软件打开

#include<reg51.h> #include<intrins.h> #defineucharunsignedchar #defineuintunsignedint sbits1=P2^6; sbits2=P2^7; sbitLCM_E=P0^2;//定义接口 sbitLCM_RW=P0^1; sbitLCM_RS=P0^0; #defineLCM_DataP1//数据接口 voidLCM_WriteData(ucharWDLCM); voidLCM_WriteCommand(ucharWCLCM,BuysC); voidLCM_WriteCommand0(ucharWCLCM,BuysC); ucharLCM_ReadStatus(void); voidLCM_Init(void); voidDisplayOneChar(ucharX,ucharY,ucharDData); voidDisplayListChar(ucharX,ucharY,ucharcode*DData); voidDelay5Ms(void); voidDelay400Ms(void); uintCount_a=0; //菜单翻页计数; uintCount_b; //比较值 uintCount_c=0;//子菜单计数 uinta_1=1; uintb_1=0; uintc_1=0; uintd_1=0; ucharcodenet0[]={"1.Writing"}; ucharcodenet1[]={"2.four-words"}; ucharcodenet2[]={"3.Re-display"}; ucharcodenet3[]={"4.Erase"}; ucharcodenet4[]={"5.Drag"}; ucharcodenet5[]={"Return"}; ucharcodenet6[]={"Frist_word"}; ucharcodenet7[]={"Second_word"}; ucharcodenet8[]={"Third_word"}; ucharcodenet9[]={"Fourth_word"}; ucharcodenet10[]={">"}; voiddelay(uinti) { while(i--); } voidoutside_int()interrupt0 { EX0=0; if((s1==0)&&(s2==1)) {delay(5000); if((s1==0)&&(s2==1)) {Count_b=(P2&0xc0); if(Count_b==0x80){Count_a++;} if(Count_a==5)Count_a=0; while(s1!=1); } } if((s2==0)&&(s1==1)) {delay(5000); if((s2==0)&&(s1==1)) {Count_b=(P2&0xc0); if(Count_b==0x40){ a_1=0; b_1++; if(Count_a==1&&(b_1<6)){Count_c=1;d_1++;} else{Count_c=0;d_1=0; } if(b_1==6)b_1=2; if((a_1==0&&b_1==2)&&(d_1==0)){a_1=1;b_1=0;} } while(s2!=1); } }EX0=1; } voidmain(void) { IT0=1; EX0=1; EA=1; Delay400Ms();//启动等待,等LCM讲入工作状态 LCM_Init();//LCM初始化 Delay5Ms();//延时片刻(可不要) while(1) { if(a_1==1) { switch(Count_a) { case0: LCM_WriteCommand(0x80,0); delay(30); DisplayListChar(0,0,net10); delay(30); DisplayListChar(1,0,net0); delay(30); DisplayListChar(0,1,net1); Delay400Ms(); Delay400Ms(); LCM_WriteCommand(0x01,1);