数码管显示求助!!

2019-03-24 18:37发布

60秒内数码管计时演示,可是却得不到想要的结果,数码管总是在闪,不知到哪里出了问题,求高人指点!

#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
sbit dula=P2^6;
sbit wela=P2^7;
void deplasy(uchar,uchar);
void delayms(uint);
uint n,m,shi,ge;
uchar code table[]={0x3f,0X06,0X5B,0X4F,0X66,0X6D,0X7D,0X07,0X7F,0X6F,0X77,0X7C,0X39,0X5E,0X79,0X71};

void main()
{TMOD=0X01;
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
EA=1;
ET0=1;
TR0=1;
while(1)

{deplasy(shi,ge);
}}


void T0_time() interrupt 1
{ TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
m++;
if(m==20);
{
m=0;
n++;
if(n==60)
n=0;
shi=n/10;
ge=n%10;
}}
void delayms(uint s)
{uint i,j;
for(i=s;i>0;i--)
for(j=110;j>0;j--);
}

void deplasy(uchar shi,uchar ge)
{
dula=1;
P0=table[shi];
dula=0;
P0=0xff;
wela=1;
P0=0xfe;
wela=0;
delayms(10);

dula=1;
P0=table[ge];
dula=0;
P0=0xff;
wela=1;
P0=0xfd;
wela=0;
delayms(10);

}
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。