?? 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 + -