标题: 单片机实验程序:蜂鸣器 [打印本页]

作者: 凯旋小飞    时间: 2017-6-4 13:11
标题: 单片机实验程序:蜂鸣器
实验4:蜂鸣器
  1. #include<reg51.h>                         
  2. #include"beep.h"

  3. typedef unsigned int u16;        //对数据类型进行声明定义

  4. /*******************************************************************************
  5. * 函 数 名         : delay
  6. * 函数功能                   : 延时函数,i=1时,大约延时10us
  7. *******************************************************************************/
  8. void delayy(u16 i)
  9. {
  10.         while(i--);       
  11. }
  12. void beep()
  13. {
  14.         BEEP=~BEEP;
  15.         delayy(10);
  16. }

复制代码



全部资料下载地址:
实验4:蜂鸣器.rar (23.67 KB, 下载次数: 7)







欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1