//定义管脚
sbit pause= P1^0;
unsigned char t1_cnt;
void main(void)
{
TMOD|=0X11;
TH0=(65536-500)/256; //定时500微秒
TL0=(65536-500)%256;
TR0=1;
ET0=1;
TH1=(65536-50000)/256; //定时50000微秒
TL1=(65536-50000)%256;
TR1=1;
ET1=1;
EA=1;
t1_cnt=0;
while(1);
}
void int_t0(void) interrupt 1//定时器0中断
{
TH0=(65536-500)/256; //定时500微秒
TL0=(65536-500)%256;
pause=~pause;
}
void int_t1(void) interrupt 3 //定时器1中断
{
TH1=(65536-50000)/256; //定时50000微秒
TL1=(65536-50000)%256;
t1_cnt++;
if(t1_cnt >=4)
{
t1_cnt=0;
ET0=~ET0;
}
}