#include <reg51.h>void InitTimer1(void)
{
TMOD = 0x10;//定时器1 方式1
TH1 = 0x3C;//12Mhz
晶振,定时50ms
TL1 = 0x0B0;
EA = 1;
ET1 = 1;
TR1 = 1;
}void main(void)
{
P1=0xff;
InitTimer1();
while(1);
}void Timer1Interrupt(void) interrupt 3
{
TH1 = 0x3C;
TL1 = 0x0B0;
P1=~P1;
}
本回答被网友采纳