📄 test1.c
字号:
#include<reg52.h>
sbit USOut=P1^0;
int Byturns=1,T0times=0,T1times=0;
void main()
{
EA=1;
IT0=1;
ET0=1;
ET1=1;
EX1=1;
TMOD=0x11;
TH1=0x3C;
TL1=0xB0;
TH0=0xFF;//13us
TL0=0xF3;
USOut=1;
//USIn=1;
TR1=1;
TR0=1;
for(;;);
}
void timer0(void) interrupt 1 //using 1
{
TH0=0xFF;
TL0=0xF3;
USOut=!USOut;
Byturns=!Byturns;
T0times++;
if(T0times>=10)
{
//T0times=0;
TR0=0;//关闭定时器0
ET0=0;
//USOut=!USOut;
}
}
void timer1(void) interrupt 3 //using 2
{
TH1=0x3C;
TL1=0xB0;
T1times++;
if(T1times>=20)
{
T0times=0;
T1times=0;
TR0=1;
ET0=1;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -