?? 18“嘀、嘀、……”報警聲.c
字號:
#include <reg51.h> //18. "嘀、嘀、……"報警聲
unsigned int t02s;
unsigned char t05ms;
bit flag;
void main(void)
{
TMOD=0x01;
TH0=(65536-500)/256;
TL0=(65536-500)%256;
TR0=1;
ET0=1;
EA=1;
while(1);
}
void t0(void) interrupt 1 using 0
{
TH0=(65536-500)/256;
TL0=(65536-500)%256;
t02s++;
if(t02s==400)
{
t02s=0;
flag=~flag;
}
if(flag==0)
{
P1_0=~P1_0;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -