#include<reg51.h>
#include<intrins.h>
void main()
{
unsigned char f;
unsigned char code Tab[]={0x40,0x79,0x24,0x30,0x19,0x12,0x02,0x78};
unsigned char code wei[]={0xf1,0xf3,0xf5,0xf7,0xf9,0xfb,0xfd,0xff};
TMOD=0x01;
TH0=(65536-3000)/256;
TL0=(65536-3000)%256;
TR0=1;
ET0=1;
EA=1;
while(1)
{
P0=0x40;
P2=0xf1;
while(TF0)
{
P2=wei[f];
P0=Tab[f];
TF0=0;
f=f+1;
}
}
}
void time0_int(void) interrupt 0
{
TH0=(65536-3000)/256;
TL0=(65536-3000)%256;
}
为什么数码管不动呢。。。 |