新手:怎样让数码管显示2个不同的数字啊
#include<reg52.h>
sbit dula = P2^6;
sbit wela = P2^7;
unsigned char code table[] = {
0x3f,0x06,0x5b,0x4f,//0,1,2,3
0x66,0x6d,0x7d,0x07,//4,5,6,7
0x7f,0x6f,0x77,0x7c,//8,9,0,A
0x39,0x5e,0x79,0x71//b,C,d,E
};
void delay(unsigned int i)
{ unsigned int j,k;
for(j=i;j>0;j--)
for(k=125;k>0;k--);
}
unsigned int h,m,s;
void main()
{
/*所有的数码管设置成0*/
wela = 1;
P0 = 0x80;
wela = 0;
dula = 1;
P0 = 0x3f;
dula = 0;
delay(5);
//小时
wela = 1;
P0 = 0xfd;
wela = 0;
dula = 1;
P0 = 0x07;
dula = 0;
delay(5);
while(1);
}