#include
#include
#define uint unsigned int
#define uchar unsigned char
uchar temp,aa,numwe,numdu;
***it dula=P1^7;
***it wela=P1^7;
uchar code table[]={
0x3f,0x06,0x5b,0x4f,
0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,
0x39,0x5e,0x79,0x71};
uchar code tablewe[]={
0xfe,0xfd,0xfb,0xf7,0xef,0xdf};
//void delay(uint z);
void main()
{
numdu=0;
numwe=0;
aa=0;
TMOD=0x01;
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
EA=1;
ET0=1; //开启定时器中断
TR0=1;
while(1)
{
if(aa==20)
{
aa=0;
numdu++;
if(numdu==9)
numdu=1;
dula=1;
P1=table[numdu];
dula=0;
wela=1;
P0=tablewe[numwe];
wela=0;
numwe++;
if(numwe==8)
numwe=0;
}
}
}
void timer0() interrupt 1
{
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
aa++;
}
现在是显示就是在循环显示的时候在第七个数码管显示的时候出了问题。第八个数码管显示7就没有问题了。
锁存起我用的是74HC573
谢谢了
|