大家帮忙看看这个程序哪里错了?感激不尽~~
#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
uchar code table1[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf};
uchar code table2[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};
sbit dula=P2^6;
sbit wela=P2^7;
uchar numwe,numdu,tt;
void main()
{
TMOD=0x01;
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
EA=1;
ET0=1;
TR0=1;
numwe=0;
numdu=0;
tt=0;
while(1)
{
if(tt==10)
{
tt=0;
numdu++;
if(numdu==7)
numdu=1;
dula=1;
P0=table2[numdu];
dula=0;
wela=1;
P0=table1[numwe];
wela=0;
numwe++;
if(numwe==6)
numwe=0;
}
}
}
void timer0() interrupt 1
{
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
tt++;
}
if(numdu==7)
numdu=1;
应该是numdu=0吧
#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
uchar code table1[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf};
uchar code table2[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};
sbit dula=P2^6;
sbit wela=P2^7;
uchar numwe,numdu,tt;
void main()
{
TMOD=0x01;
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
EA=1;
ET0=1;
TR0=1;
numwe=0;
numdu=0;
tt=0;
while(1)
{
}
}
void timer0() interrupt 1
{
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
tt++;
if(tt==10)
{
tt=0;
numdu++;
if(numdu==7)
numdu=1;
dula=1;
P0=table2[numdu];
dula=0;
wela=1;
P0=table1[numwe];
wela=0;
numwe++;
if(numwe==6)
numwe=0;
}
}