#include
#include
#include
#include
#define uint long int
#define uchar unsigned char
#define PA8155 XBYTE[0x7101]
#define PB8155 XBYTE[0x7102]
#define COM8155 XBYTE[0x7100]
uchar code table[10]={0xfc,0x60,0xda,0xf2,0x66,0xb6,0xbe,0xe0,0xfe,0xf6};
uchar Dis_BUF[4]={0,0,0,0};
uchar red=30;//红灯
uchar green=25;//绿灯
uchar yellow=5;//黄灯
uint key=16;//读取按键的值
uchar disp=0;//显示用数值
uint temp1=0,temp2=0;
uint keyscan (void);
void dividecount();
void display (uchar *Bufptr);
void delay (uint itime);
void keymain(void);
void main(void)
{
COM8155=0x03;
while(1)
{
keymain();
}
}
//键盘赋值主程序
void keymain(void)
{
key=keyscan();//读取键值到key
delay(125);
display(Dis_BUF);
if(key=0&&key