|
keybord () //按鍵檢測(cè)
{ uchar shu1;
P1=0x00;
shu1=P1;
if(shu1!=0x00)
{
switch(shu1)
{
case 0x01:key=1;break;
case 0x02:key=2;break;
case 0xfb:key=3;break;
case 0xf7:key=4;break;
case 0xef:key=5;break;
case 0xdf:key=6;break;
case 0xbf:key=7;break;
case 0x7f:key=8;break;
default:break;
}
while(shu1!=0xff)
shu1=P1;
return key;
}}
void date_c() //數(shù)據(jù)選擇
{
if(key==1)
{
uchar c;
wr_com(0x80);
for(c=0;c<11;c++)
{wr_dat(str1[c]);}
while(1);
}
if(key==2)
{
uchar d;
wr_com(0x80);
for(d=0;d<5;d++)
{wr_dat(str2[d]);}
while(1);
}
}
void main()
{
lcd_init(); //LCD初始
date_c(); //數(shù)據(jù)選擇顯示
} |
|