# include <reg52.h>
# define uchar unsigned char
# define uint unsigned int
sbit L1 = P1^0;
sbit L8 = P1^7;
void Init_Timer0()
{
TMOD = 0x01;
TH0 = (65535 - 50000) / 256;
TL0 = (65535 - 50000) % 256;
EA = 1;
ET0 = 1;
TR0 = 1;
}
uchar cnt = 0;
uchar cnt1 = 0;
void ServerTimer0() interrupt 1
{
TH0 = (65535 - 50000) / 256;
TL0 = (65535 - 50000) % 256;
cnt ++;
cnt1 ++;
if(cnt == 10)
{
L1 = ~L1;
cnt = 0;
}
if(cnt1 == 100)
{
L8 = ~L8;
cnt1 = 0;
}
}
void mian()
{
Init_Timer0();
while(1)
{
}
} |
是不是电流不够?