用T0定时器可以正常显示,中断用T0定时器可以,T1就不行了,数码管停在0不动,只是把定时器T0换成T1就不行额,到底为什么?
#include <reg52.h>
#define uchar unsigned char
#define uint unsigned int
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 };
uchar num,a;
void main()
{
wela=1;
P0=0xc0;
wela=0;
dula=1;
P0=table[num];
dula=0;
EA=1;
ET1=1;
TH1=(65536-45872)/256;
TL1=(65536-45872)%256;
TMOD=0x10;
TR1=1;
while(1);
}
void T1_time() interrupt 1
{
TH1=(65536-45872)/256;
TL1=(65536-45872)%256;
a++;
if(a==20)
{
a=0;
num++;
P0=table[num];
if(num==15)
num=0;
}
} |