满意答案
有点类似,你看看吧:
#include
#include //反转法控制按键
#define uint unsigned int
#define uchar unsigned char
sbit dula=P2^6;
sbit wela=P2^7;
uchar a,b,c,d,keya,keyb;
uint e;
uchar code table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};
void delay(uint x) //延时
{
uint i,j;
for(i=x;i>0;i--)
for(j=110;j>0;j--);
}
void shumaguan(uchar a) //数码管
{
wela=1;
P0=0xc0;
wela=0;
dula=1;
P0=table[a];//a在键盘函数引用
dula=0;
delay(10);
}
void liushuideng() //流水灯
{
b=0xc9;
while(e>=0&&e<=80)
{
P1=b;
delay(50);
b=_crol