#include
#define uchar unsigned char
sbit P2_2=P2^2;
void InitTimer1( )
{
TMOD = 0x10; //定时器1,工作方式1
TH1 = (65536-1000)/256;
TL1 = (65536-1000)%256; //1ms中断一次
EA = 1;
ET1= 1;
TR1 = 1;
}
void main(void)
{
InitTimer1();
while(1);
}
void Timer1Interrupt(void) interrupt 3
{
TH1 = (65536-1000)/256;
TL1= (65536-1000)%256;
P2_2=~P2_2;
}
声威大震
300可写。