标题: 音乐播放器使用STC89C52实现 [打印本页]

作者: pfucbn    时间: 2018-1-8 09:48
标题: 音乐播放器使用STC89C52实现
使用STC89C52来实现
播放挥着翅膀的女孩和同一首歌还有两只蝴蝶
其中包含两个.h和一个.c文件
.c内容如下
两个.h分别是SoundPlay函数,以及歌曲16进制数组


  1. #include "reg52.h"                         //此文件中定义了单片机的一些特殊功能寄存器
  2. #include "SoundPlay.h"
  3. #include"music.h"

  4. typedef unsigned int u16;          //对数据类型进行声明定义
  5. typedef unsigned char u8;



  6. void Delay1ms(unsigned int count)
  7. {
  8.         unsigned int i,j;
  9.         for(i=0;i<count;i++)
  10.         for(j=0;j<120;j++);
  11. }

  12. void main()
  13. {
  14.         InitialSound();
  15.         while(1)
  16.         {
  17.                 Play(Music_Girl,0,3,360);
  18.                
  19.                 Delay1ms(500);
  20.                 Play(Music_Same,0,3,360);
  21.                 Delay1ms(500);
  22.                 Play(Music_Two,0,3,360);
  23.                 Delay1ms(500);
  24.         }
  25. }
复制代码


音乐播放器.rar

32.91 KB, 下载次数: 57, 下载积分: 黑币 -5






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