想让P1口的灯亮一秒灭一秒,可是就是不行,求大神讲解!
#include<reg52.h>
unsigned int a,b;
void init()
{
TMOD = 0x01;
EA = 1;
ET0 = 1;
TH0 = 0x3c;
TL0 = 0xb0;
TR0 = 1;
}
void amin()
{
init();
while(1);
}
void dingshi()interrupt 1
{
TF0 = 0;
TH0 = 0x3c;
TL0 = 0xb0;
a++;
if(a == 20)
{
P1 = 0;
}
if(a == 40)
{
a = 0;
P1 = 0xff;
}
}
|