STC89C52RC定时器:方法1
#include"reg52.h"
unsigned int count=0;
sbit fm=P2^3;
sbit led = P1^0;
void main()
{
led = 1;
TMOD = 0X20;
TH1 = 256-200;
TL1 = 256-200;
//中断
EA = 1;
ET1=1;
//定时器启动
TR1 = 1;
while(1)
{
if(--count == 2500)
{
count=0;
led = ~led;
}
}
}
void timer0() interrupt 3
{
//delay(500);
count++;
}
STC89C52RC定时器:方法二
#include"reg52.h"
unsigned int count=0;
sbit fm=P2^3;
sbit led = P1^0;
//————————————————————————————————————
//void delay(unsigned