#include
#define uint unsigned int
sbit p27=P2^7;
sbit p26=P2^6;
sbit p25=P2^5;
sbit d0=P0^0;
sbit d1=P0^1;
sbit d2=P0^2;
sbit d3=P0^3;
sbit d4=P0^4;
sbit d5=P0^5;
sbit d6=P0^6;
sbit d7=P0^7;
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
void keyscan()
{
p27=1;
p26=0;
p25=1;
/////////////////////////////key2
if(d1==0)
{
while(1)
{
int z=10;
P1=0x01;
delay(z);
P1=0x02;
delay(z);
P1=0x04;
delay(z);
P1=0x08;
delay(z);
}
}
/////////////////////////////key3
if(d2==0)
{
while(1)
{
int z=10;
P1=0x08;
delay(z);
P1=0x04;
delay(z);
P1=0x02;
delay(z);
P1=0x01;
delay(z);
}
}
}
void main()
{
while(1)
{
keyscan();
}
}
阅读(473) | 评论(0) | 转发(0) |