编辑: Mckel0ve | 2016-05-16 |
//显示7 break;
} while(temp!=0xf0) { temp=P3;
temp=temp&
0xf0;
} } } P3=0xfb;
temp=P3;
temp=temp&
0xf0;
while(temp!=0xf0) { delay(5);
temp=P3;
temp=temp&
0xf0;
while(temp!=0xf0) { temp=P3;
switch(temp) { case 0xeb:num=11;
//显示8 break;
case 0xdb:num=9;
//显示9 break;
case 0xbb:num=6;
//显示A break;
case 0x7b:num=3;
//显示B break;
} while(temp!=0xf0) { temp=P3;
temp=temp&
0xf0;
} } } P3=0xf7;
temp=P3;
temp=temp&
0xf0;
while(temp!=0xf0) { delay(5);
temp=P3;
temp=temp&
0xf0;
while(temp!=0xf0) { temp=P3;
switch(temp) { case 0xe7:num=12;
//显示C break;
case 0xd7:num=13;
//显示D break;
case 0xb7:num=14;
//显示E break;
case 0x77:num=15;
//显示F break;
} while(temp!=0xf0) { temp=P3;
temp=temp&
0xf0;
} } } return num;
} 数字随输入移动 #include #define uint unsigned int #define uchar unsigned char sbit dula=P2^6;
sbit wela=P2^7;
uchar code table[]={ 0x3f,0x06,0x5b,0x4f, 0x66,0x6d,0x7d,0x07, 0x7f,0x6f,0x77,0x7c, 0x39,0x5e,0x79,0x71,0};
uchar code table1[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
uchar d1[]={0,0,0,0,0,0,0};
uchar num,temp,key_num,input_num;
void delay(uint z) { uint x,y;
for(x=z;
x>
0;
x--) for(y=110;
y>
0;
y--);
} uchar keyscan();
void display();
void main() { num=16;
// 扫描函数没有返回值时,熄灭所有数码管 P0 = 0x00;
wela = 1;
wela = 0;
while(1) { keyscan();
display();
} } void display() { uchar i = 0,.
.......