#include
#include
#define LED7 XBYTE[0x9f00]
#define LED6 XBYTE[0x9f01]
#define LED5 XBYTE[0x9f02]
#define LED4 XBYTE[0x9f03]
#define LED3 XBYTE[0x9f04]
#define LED2 XBYTE[0x9f05]
#define LED1 XBYTE[0x9f06]
#define LED0 XBYTE[0x9f07]
#define key1 XBYTE[0xa07f]
#define uint unsigned int
#define uchar unsigned char
int z=10;
uint t[]= //数码显示表(89c52)
{
0x3f,0x06,0x5b,0x4f,
0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x40
};
void delay(int z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
void initial()
{
LED0=0;
LED1=0;
LED2=0;
LED3=0;
LED4=0;
LED5=0;
LED6=0;
LED7=0;
}
void main()
{
initial();
while(1)
{
P1=0x01;
delay(z);
P1=0x02;
delay(z);
P1=0x04;
delay(z);
P1=0x08;
delay(z);
if(z>=500)
z=10;
if(key1==0)
{
delay(5);
if(key1==0)
{
LED7=t[0];
z+=20;
delay(500);
}
/*
if(key1==1)
{
z-=10;
LED7=t[0];
delay(500);
}
*/
}
}
}
阅读(418) | 评论(0) | 转发(0) |