欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 6547|回復: 2
收起左側

基于51單片機的音樂播放器仿真程序設計

[復制鏈接]
ID:557684 發(fā)表于 2019-6-8 13:49 | 顯示全部樓層 |閱讀模式
仿真原理圖如下(proteus仿真工程文件可到本帖附件中下載)
51hei.png

仿真圖

仿真圖

文檔

文檔


單片機源程序如下:
  1. #include<reg52.h>
  2. #include<lcd.h>
  3. #include<1302.h>
  4. #include<music_code.h>
  5. #include<SoundPlay.h>
  6. #include<dds.h>
  7. uchar code time[]={'0','1','2','3','4','5','6','7','8','9'};
  8. uchar code get_up[]="Time to Get up!";
  9. uchar code str[]="Never frown,even when you are sad,because you never know who is falling in love with your smile! To the world you may be one person,but to one person you may be the world ";
  10. uchar code menu[4][10]={{"Time Set"},{"Music"},{"Books"},{"Ring Set"}};
  11. void main()
  12. {
  13.         ini();
  14.         open();
  15.         delay(255);
  16.         delay(255);
  17.         delay(255);
  18.         delay(255);
  19.         write_order(0x01);
  20.         init_ds1302();
  21.         set_ds1302(time_add,initial_time);
  22.         while(1)
  23.         {
  24.                 read_ring();
  25.                 if(ring_time[0]==now_time[0]&&ring_time[1]==now_time[1]&&ring_time[2]==now_time[2])
  26.                 {
  27.                         timeup();
  28.                 }
  29.                 detect();
  30.                 write_order(0x80+0x04);               
  31.                 for(i=0;menu[key][i]!=0;i++)
  32.                 {
  33.                         write_date(menu[key][i]);
  34.                 }
  35.                 get_ds1302();
  36.                 write_order(0x80+0x40);
  37.                 write_date(time[now_time[4]>>4]);
  38.                 write_date(time[now_time[4]&0x0f]);
  39.                 write_date(0x01);
  40.                 write_date(time[now_time[3]>>4]);
  41.                 write_date(time[now_time[3]&0x0f]);
  42.                 write_date(0x00);
  43.                 write_date(' ');
  44.                 write_date(' ');
  45.                 write_date(time[now_time[2]>>4]);
  46.                 write_date(time[now_time[2]&0x0f]);
  47.                 write_date(':');
  48.                 write_date(time[now_time[1]>>4]);
  49.                 write_date(time[now_time[1]&0x0f]);
  50.                 write_date(':');
  51.                 write_date(time[now_time[0]>>4]);
  52.                 write_date(time[now_time[0]&0x0f]);
  53.                 if(key==2)
  54.                 {
  55.                
  56.                         sum=0;
  57.                         book();

  58.                 }
  59.                 if(key==1)
  60.                 {
  61.                         music();

  62.                 }
  63.                 if(key==3)
  64.                 {               
  65.                         alamn();
  66.        
  67.                 }
  68.                 if(key==0)
  69.                 {       
  70.                         time_set();
  71.        
  72.                 }
  73.         }
  74. }
  75. void detect()
  76. {
  77.         uchar temp;
  78.         temp=P1;
  79.         temp=temp&0x0f;
  80.         if(temp!=0x0f)
  81.         {
  82.                 switch(temp)
  83.                 {
  84.                         case 0x0e:
  85.                                 while(temp!=0x0f)
  86.                         {
  87.                                 temp=P1;
  88.                                 temp=temp&0x0f;
  89.                         }
  90.                         if(key==0)
  91.                         {
  92.                                 key=4;
  93.                         }
  94.                         key--;
  95.                         flag=1;
  96.                         write_order(0x01);
  97.                         break;
  98.                         case 0x0d:
  99.                                 while(temp!=0x0f)
  100.                         {
  101.                                 temp=P1;
  102.                                 temp=temp&0x0f;
  103.                         }
  104.                         key++;
  105.                         flag=2;
  106.                         if(key==4)
  107.                         {
  108.                                 key=0;
  109.                         }
  110.                         write_order(0x01);
  111.                         break;
  112.                         case 0x0b:
  113.                                 while(temp!=0x0f)
  114.                         {
  115.                                 temp=P1;
  116.                                 temp=temp&0x0f;
  117.                         }
  118.                         flag=3;
  119.                         write_order(0x01);
  120.                         break;
  121.                         case 0x07:
  122.                                 while(temp!=0x0f)
  123.                         {
  124.                                 temp=P1;
  125.                                 temp=temp&0x0f;
  126.                         }
  127.                         flag=4;
  128.                         write_order(0x01);
  129.                         break;
  130.                 }
  131.         }

  132. }
  133. void page(uchar k)
  134. {
  135.         write_order(0x80);
  136.         for(i=k*32;i<k*32+16&&str[i]!='\0';i++)
  137.         {
  138.                 write_date(str[i]);
  139.         }
  140.         write_order(0x80+0x40);
  141.         for(i=k*32+16;i<k*32+32&&str[i]!='\0';i++)
  142.         {
  143.                 write_date(str[i]);
  144.         }
  145. }

  146. void book()
  147. {                       
  148.        
  149.                         flag=0;
  150.                         detect();
  151.                         if(flag==3)
  152.                         {
  153.                         flag=0;
  154.                         page(sum);
  155.                         while(flag!=4)
  156.                         {
  157.                                 detect();
  158.                                 if(flag==1)
  159.                                 {
  160.                                         flag=0;
  161.                                         if(sum!=0)
  162.                                         {
  163.                                         sum--;
  164.                                         }
  165.                                         page(sum);
  166.                                 }
  167.                                 if(flag==2)
  168.                                 {
  169.                                         flag=0;
  170.                                         if(sum<5)
  171.                                         {
  172.                                                 sum++;
  173.                                         }
  174.                                         page(sum);
  175.                                 }
  176.                         }
  177.                         key=2;
  178.                         }
  179. }

  180. void alamn()
  181. {
  182.                         flag=0;
  183.                         detect();
  184.                         if(flag==3)
  185.                         {
  186.                                 flag=0;
  187.                                 while(flag!=4)
  188.                                 {                                       
  189.                                         write_order(0x80+0x02);
  190. ……………………

  191. …………限于本文篇幅 余下代碼請從51黑下載附件…………
復制代碼

所有資料51hei提供下載:
多功能音樂播放器仿真程序.7z (46.71 KB, 下載次數(shù): 157)
網(wǎng)上找的文檔資料.7z (441.5 KB, 下載次數(shù): 5)

回復

使用道具 舉報

ID:670803 發(fā)表于 2019-12-22 23:09 | 顯示全部樓層
可以用I2C存儲器24C04芯片跟單片機做一個音樂播放器嗎?
回復

使用道具 舉報

ID:327029 發(fā)表于 2019-12-23 07:45 | 顯示全部樓層
你這是拿別人的功能音樂盒仿真資料混著一篇根本不對應的花樣流水燈音樂盒文檔 哈哈
回復

使用道具 舉報

無效樓層,該帖已經(jīng)被刪除
您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規(guī)則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術交流QQ群281945664

Powered by 單片機教程網(wǎng)

快速回復 返回頂部 返回列表