51单片机这个程序为什么没执行中断
#include<reg51.h>
#define uint unsigned int
#define uchar unsigned char
sbit dula=P2^6;
sbit wela=P2^7;
uchar code table[]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F};
uchar a=0,num=0;
void main()
{
TMOD=0x01;
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
EA=1;
ET0=1;
TR0=1;
dula=1;
P0=table[num];
dula=0;
wela=1;
P0=0xc0;
wela=0;
}
void timer0() interrupt 1
{
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
a++;
if(a==40)
{
a=0;
num++;
if(num==9)
num=0;
dula=1;
P0=table[num];
dula=0;
}
}
[解决办法]
看不懂哦 亲
[解决办法]
亲,要有个无线循环啊,不然执行一次就玩完了,当然没中断了
[解决办法]
#include<reg51.h>
#define uint unsigned int
#define uchar unsigned char
sbit dula=P2^6;
sbit wela=P2^7;
uchar code table[]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F};
uchar a=0,num=0;
void main()
{
TMOD=0x01;
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
EA=1;
ET0=1;
TR0=1;
dula=1;
P0=table[num];
dula=0;
wela=1;
P0=0xc0;
wela=0;
while(1);//!!!
}
void timer0() interrupt 1
{
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
a++;
if(a==40)
{
a=0;
num++;
if(num==9)
num=0;
dula=1;
P0=table[num];
dula=0;
}
}