beep.c
来自「用KEILC写的单片机典型C51编程」· C语言 代码 · 共 30 行
C
30 行
#include<reg51.h>
#include<define.h>
#include<global.h>
#include<initial.h>
#include<delay.h>
#include<led.h>
#include<input.h>
#include<beep.h>
#include<key.h>
#include<music.h>
void Beep(word count , byte soundlong , byte tone )
{ word i,j,k,SpFreq;
SpFreq = (1000/tone)/2;
for(i=0;i<count;i++)
{
for (j=0;j<soundlong;j++)
{
for (k=0;k<SpFreq;k++)
P1_6 = 0;
for (k=0;k<SpFreq;k++)
P1_6 = 1;
}
DelayX10ms(20);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?