#include
#define uchar unsigned char
#define uint unsigned int
void scan_k1();
unsigned char set;
void delay(uint z);
void delay1(uint z);
unsigned int i;
sbit led0=P1^0;
sbit led1=P1^1;
sbit sw1=P3^4;
void main()
{
while(1)
{
if(sw1==0) scan_k1();
{
switch(set)
{
case 1: led0=0x00;
delay(15);
led0=0xff;
delay(3);
break;
////////////////////////////////
case 2: led1=0x00;
delay1(20);
led1=0xff ;
delay1(10);
break;
default:P1=0Xfc;
break;
////////////////////////////////
/* case 3:led0=0x00;
break;
default:led0=0X00;
break;
case 4:P1=0x00;
break;
default: P1=0Xff;
break;*/
}
}
}
}
//////////////////////////////
void scan_k1()
{
if(sw1==0) set++;
if(set>=4)set=0;
F0:if(sw1==0)goto F0;
for(i=0;i<30000;i++);
}
////////////////////////////////////
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=45;y>0;y--);
}
void delay1(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=26;y>0;y--);
}