|
仿真圖
單片機(jī)源程序如下:
- #include "led.h"
- #include "beep.h"
- void Delay(unsigned int count); //延時函數(shù)
- int main(void)
- {
- LED_Init(); //初始化與LED連接的硬件接口
- BEEP_Init();//喇叭初始化
- while(1)
- {
- LED0=0;//LED0亮
- BEEP=0;//蜂鳴器產(chǎn)生聲音
- Delay(500);
- LED0=1;
- BEEP=1;
- Delay(500);
-
- }
- }
- void Delay(unsigned int count) //延時函數(shù)
- {
- unsigned int i;
- for(;count!=0;count--)
- {
- i=5000;
- while(i--);
- }
- }
復(fù)制代碼
本人初學(xué),僅供參考,存在錯誤和不足之處,請大家回帖多多指教,切勿照搬,文件下載:
音頻產(chǎn)生器.7z
(121.29 KB, 下載次數(shù): 46)
2020-6-16 21:30 上傳
點(diǎn)擊文件名下載附件
|
|