标题: 51单片机电子琴源程序 [打印本页]

作者: 咔哇伊惜兮    时间: 2018-10-23 17:52
标题: 51单片机电子琴源程序
51单片机电子琴源程序
  1. #include<reg51 h>
  2. #define uint unsigned int
  3. #define uchar unsigned char
  4. void?Init(void);//初始化
  5. void?Key_Scan(void);//键值扫描
  6. void?Delayms(uint?z);//延时
  7. void?LED_Display(void);//数码显示
  8. void?Sound_Player(void);//音频处理
  9. uint?Keycode;//键值
  10. uint?Time?=?0;
  11. uint?Flag?=?0;?
  12. uint?TH0code,TL0code;
  13. sbit?Speaker?=?P3^0;?//扬声器控制引脚
  14. uint?Num?=?0;?
  15. uchar?code?table[]={?//数码管共阴码表
  16. 0x3f,0x06,0x5b,0x4f,
  17. 0x66,0x6d,0x7d,0x07,
  18. 0x7f,0x6f,0x77,0x7c,
  19. 0x39,0x5e,0x79,0x71};

  20. uchar code Music1_Tab[]={  //曲谱1码表
  21. 0xc0,0xf9,0xa4,0xb0,
  22. 0x99,0x92,0x82,0xf8,
  23. 0x80,0x90,0x88,0x83,
  24. 0xc6,0xa1,0x86,0x8e};

  25. uint code Music2_Tab[]={ //曲谱2码表
  26. 64021,64103,64260,64400,
  27. 64524,64580,64684,64777,
  28. 64820,64898,64968,65030,
  29. 65058,65110,65157,65178};  

复制代码


51单片机电子琴代码.zip

667 Bytes, 下载次数: 5, 下载积分: 黑币 -5






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