我这个是想实现6个数码管都从0变化为F循环变化,利用时钟的方法,时间间隔位1秒,我对照过郭天祥的教程啊,为什么还是不对,6个数码管根本不亮,真是醉了,求大神解释
#include <reg52.h>
#define uchar unsigned char
#define uint unsigned int
sbit dula=P2^6;
sbit wela=P2^7;
uchar num,tt;
uchar code table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};
void main()
{
tt=0;
num=0;
TMOD=0x01;
TH0=(65536-10000)/256;
TL0=(65536-10000)%256;
EA=1;
ET0=1;
TR0=1;
wela=1;
P0=0x3F;
wela=0;
while(1)
{
if(tt==20)
{
tt=0;
num++;
if(num==16)
num=0;
dula=1;
P0=table[num];
dula=0;
}
}
}
void duan1() interrupt 1
{
TH0=(65536-10000)/256;
TL0=(65536-10000)%256;
tt++;
#include <reg52.h>
#define uchar unsigned char
#define uint unsigned int
sbit dula=P2^6;
sbit wela=P2^7;
uchar num,tt;
uchar code table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};
void main()
{
tt=0;
num=0;
TMOD=0x01;
TH0=(65536-10000)/256;
TL0=(65536-10000)%256;
EA=1;
ET0=1;
TR0=1;
wela=1;
P0=0x3F;
wela=0;
while(1)
{
if(tt==20)
{
tt=0;
num++;
if(num==16)
num=0;
dula=1;
P0=table[num];
dula=0;
}
}
}
void duan1() interrupt 1
{
TH0=(65536-10000)/256;
TL0=(65536-10000)%256;
tt++;