#include
#include
/*#define LED7 XBYTE[0x8000]
#define LED6 XBYTE[0x8001]
#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[0xa001]
#define KEY2 XBYTE[0xa002]
#define LED7 XBYTE[0X8000]
#define LED6 XBYTE[0X8001]
#define LED5 XBYTE[0X8002]
#define LED4 XBYTE[0X8003]
#define LED3 XBYTE[0X8004]
#define LED2 XBYTE[0X8005]
#define LED1 XBYTE[0X8006]
#define LED0 XBYTE[0X8007]
unsigned char code t[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71,0xff};
#define uint unsigned int
#define uchar unsigned char
uint aa,sec,min,hour;
unsigned int cnt=20;
/*uint t[]= //数码显示表(89c52)
{
0x3f,0x06,0x5b,0x4f,
0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x40
}; */
void delay(uint z) ;
///////////初始化、、、、、、、、、、、、,,,,,,,,,,。。。。。
void initial()
{
LED0=t[0];
LED1=t[0];
LED2=t[0];
LED3=t[0];
LED4=t[0];
LED5=t[0];
LED7=t[0];
LED6=t[1];
}
void main()
{
// TMOD=0x01;//选定时器0,工作方式1
// TH0=(65535-50000)/255;//设置初始值
// TL0=(65535-50000)%255;
//EA=1;//打开总中断
// ET0=1;//打开定时器0中断
// TR0=1;//定时器开始计数
while(1)
{
initial();
if(KEY1==0xfe)
{
delay(1);
if(KEY1=0xfe)
LED7=t[2];
}
else
LED7=t[0];
if(KEY2==0xfd)
{ delay(1);
if(KEY2==0xfd)
LED6=t[3];
}
else
LED6=t[1];
}
}
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
/*
void timer0() interrupt 1 //定时器0
{
TH0=(65535-50000)/255;//设置初始值
TL0=(65535-50000)%255;
if(KEY0==0)
LED7=t[0];
delay(500);
if(KEY1==0)
LED6=t[1];
delay(500);
}
*/
阅读(652) | 评论(0) | 转发(0) |