#include <reg51.h>
unsigned int t02s;
bit flag;
sbit P1_5=P1^5;
void main(void)
{
TMOD=0x01;
TH0=(65536-500)/256;
TL0=(65536-500)%6;
TR0=1;
ET0=1;
EA=1;
while(1);
}
void t0(void) interrupt 1 using 0//0.5MS定时器中断子程序
{
TH0=(65536-500)/256;
TL0=(65536-500)%6;
t02s++;
if(t02s==400)//200MS定时
{
t02s=0;
flag=~flag;
}
if(flag==0)
P1_5=~P1_5;
}