久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 7663|回復: 4
打印 上一主題 下一主題
收起左側

單片機MP3(PCB+原理圖+代碼)

  [復制鏈接]
跳轉到指定樓層
樓主
練手項目,完整資料
Altium Designer畫的原理圖和PCB圖如下:(51hei附件中可下載工程文件)

單片機源程序如下:
  1. #include <string.h>
  2. #include <STC12C5A.H>
  3. #include "VS1003.h"
  4. #include "debug.h"
  5. #include "SPI.h"
  6. #include "SD.h"
  7. #include "myfun.h"
  8. #include "PFatFS/pff.h"
  9. #include "12864.h"
  10. #include "menu_UI.c"

  11. FATFS fatfs;   ///定義一個文件系統對象
  12. FRESULT res;

  13. UINT8 Music_Vol=200;        //音量大小
  14. UINT16 code bitrate[2][16]={{0,8,16,24,32,40,48,56,64,80,96,112,128,144,160,0},{0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,0}}; //用于MP3比特率的判斷
  15. UINT8 Time[6]={0,1,':',2,0,'\0'};
  16. UINT8 DispBitRate[]={0,0,0,'k','b','p','\/','s','\0'};
  17. UINT8 TxtBuffer[49]={0};
  18. UINT8 MusicVol[]={'0','0','0','\0'};//音量整形轉為字符串類型
  19. UINT8 Doc_pos=0;                //文檔菜單索引
  20. UINT8 old_Doc_pos=-1;        //按鍵之前文檔菜單索引
  21. UINT8 mpos=0;                         //主菜單播索引值
  22. UINT8 oldmpos = 2;                //按鍵之前主菜單索引值
  23. UINT8 key=0;                        //當前按鍵值
  24. UINT8 MusicMax=0;                //讀取音樂文件的個數
  25. UINT8 TxtMax=0;                        //讀取文檔文件的個數
  26. UINT8 flag_music=0;               
  27. LONG pMusic=0;
  28. WORD br,rc;
  29. FILINFO filinfo;//文件信息
  30. DIR dir;  

  31. //初始化所有設備
  32. void all_init()
  33. {
  34.         {P1M1 = 0X40; P1M0 = 0xbF;}   //硬件SPI必須!!。。。。。。。。/O口1模式控制器1
  35. //        P0M1 = 0Xff; P0M0 = 0xff;          //有上拉電阻的話就要該行  使其IO為弱  要是板子沒有上拉電阻就可注釋該句
  36.         SPI_Init();         //SPI初始化,默認最低速
  37.         UartInit();        //UART初始化
  38.         DB_SendString("\nSPI and uart init  ok............\n");
  39.         LCD_Init();

  40.         DB_SendString("LCD12864 init  ok............\n");
  41.        
  42. //         SD_Init();
  43. //         DB_SendString("SD init  ok............\n");          //下面的掛載其實已經初始化SD卡了,可不必重復

  44.         res = pf_mount(&fatfs);                                        //掛在文件系統
  45.     if(res == FR_OK)     DB_SendString("掛載成功!\n"); //如果返回1,則掛載失敗,否則成功
  46.         else                 DB_SendString("掛載失敗\n");
  47.                
  48.         VS1003_Reset();
  49.         //Change_SineTest(1);                //正弦測試       
  50.         DB_SendString("vs1003 init  ok............\n");
  51.        
  52.         SPI_SetSpeed(0);   //最高速
  53.         VS_XDCS=0;                    //打開數據片選,注意此時XCS(片選)為高電平,SDI有效
  54.         VS_XCS = 1;                    //關閉片選

  55. }



  56. void main()
  57. {
  58.         all_init();
  59.         Main_Menu();
  60.         DB_SendString("所有初始化成功............\r\n");

  61.         DB_SendInfo("VS_MODE = ",VS1003_ReadReg(VS_MODE));         //通過打印寄存器數值看VS1003是否初始化成功
  62.         DB_SendInfo("VS_CLOCKF = ",VS1003_ReadReg(VS_CLOCKF));
  63.        
  64.         Main_Oper();   //死循環
  65. }
復制代碼

所有資料51hei提供下載:
MP3.zip (11.19 MB, 下載次數: 163)


分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏7 分享淘帖 頂1 踩
回復

使用道具 舉報

沙發
ID:105206 發表于 2018-1-22 06:39 | 只看該作者
看看,學習下。
回復

使用道具 舉報

板凳
ID:251061 發表于 2019-7-11 22:32 | 只看該作者
好像編譯不能通過,
SD.C(254): error C141: syntax error near '}', expected ';'
compiling main.c...
MENU_UI.C(24): error C202: 'dir': undefined identifier
MENU_UI.C(28): error C202: 'dir': undefined identifier
MENU_UI.C(45): error C202: 'dir': undefined identifier
MENU_UI.C(49): error C202: 'dir': undefined identifier
MENU_UI.C(60): error C202: 'dir': undefined identifier
MENU_UI.C(70): error C202: 'MusicMax': undefined identifier
MENU_UI.C(93): error C202: 'bitrate': undefined identifier
MENU_UI.C(94): error C202: 'bitrate': undefined identifier
MENU_UI.C(105): error C202: 'Time': undefined identifier
MENU_UI.C(106): error C202: 'Time': undefined identifier
MENU_UI.C(107): error C202: 'Time': undefined identifier
MENU_UI.C(108): error C202: 'Time': undefined identifier
MENU_UI.C(109): error C202: 'Time': undefined identifier
MENU_UI.C(115): error C202: 'DispBitRate': undefined identifier
MENU_UI.C(116): error C202: 'DispBitRate': undefined identifier
MENU_UI.C(117): error C202: 'DispBitRate': undefined identifier
MENU_UI.C(119): error C202: 'DispBitRate': undefined identifier
MENU_UI.C(148): error C202: 'pMusic': undefined identifier
MENU_UI.C(151): error C202: 'key': undefined identifier
MENU_UI.C(152): error C202: 'key': undefined identifier
MENU_UI.C(154): error C202: 'flag_music': undefined identifier
MENU_UI.C(159): error C202: 'rc': undefined identifier
MENU_UI.C(160): error C202: 'rc': undefined identifier
MENU_UI.C(161): error C202: 'pMusic': undefined identifier
MENU_UI.C(176): error C202: 'key': undefined identifier
MENU_UI.C(178): error C202: 'pMusic': undefined identifier
MENU_UI.C(180): error C202: 'pMusic': undefined identifier
MENU_UI.C(181): error C202: 'pMusic': undefined identifier
MENU_UI.C(184): error C202: 'key': undefined identifier
MENU_UI.C(184): error C202: 'flag_music': undefined identifier
MENU_UI.C(185): error C202: 'key': undefined identifier
MENU_UI.C(190): error C202: 'key': undefined identifier
MENU_UI.C(192): error C202: 'Music_Vol': undefined identifier
MENU_UI.C(195): error C202: 'Music_Vol': undefined identifier
MENU_UI.C(197): error C202: 'MusicVol': undefined identifier
MENU_UI.C(198): error C202: 'MusicVol': undefined identifier
MENU_UI.C(199): error C202: 'MusicVol': undefined identifier
MENU_UI.C(200): error C202: 'MusicVol': undefined identifier
MENU_UI.C(201): error C202: 'Music_Vol': undefined identifier
MENU_UI.C(209): error C202: 'key': undefined identifier
MENU_UI.C(211): error C202: 'Music_Vol': undefined identifier
MENU_UI.C(214): error C202: 'Music_Vol': undefined identifier
MENU_UI.C(216): error C202: 'MusicVol': undefined identifier
MENU_UI.C(217): error C202: 'MusicVol': undefined identifier
MENU_UI.C(218): error C202: 'MusicVol': undefined identifier
MENU_UI.C(219): error C202: 'MusicVol': undefined identifier
MENU_UI.C(220): error C202: 'Music_Vol': undefined identifier
MENU_UI.C(242): error C202: 'MusicMax': undefined identifier
MENU_UI.C(246): error C202: 'dir': undefined identifier
MENU_UI.C(248): error C202: 'dir': undefined identifier
MENU_UI.C(252): error C202: 'MusicMax': undefined identifier
MENU_UI.C(257): error C202: 'MusicMax': undefined identifier
MENU_UI.C(261): error C202: 'MusicMax': undefined identifier
MENU_UI.C(262): error C202: 'MusicMax': undefined identifier
MENU_UI.C(264): error C202: 'MusicMax': undefined identifier
MENU_UI.C(279): error C202: 'key': undefined identifier
MENU_UI.C(285): error C202: 'key': undefined identifier
MENU_UI.C(290): error C202: 'key': undefined identifier
MENU_UI.C(298): error C202: 'MusicMax': undefined identifier
MENU_UI.C(304): error C202: 'MusicMax': undefined identifier
MENU_UI.C(304): error C202: 'MusicMax': undefined identifier
MENU_UI.C(322): error C202: 'key': undefined identifier
MENU_UI.C(340): error C202: 'key': undefined identifier
MENU_UI.C(355): error C202: 'TxtMax': undefined identifier
MENU_UI.C(359): error C202: 'dir': undefined identifier
MENU_UI.C(361): error C202: 'dir': undefined identifier
MENU_UI.C(363): error C202: 'TxtMax': undefined identifier
MENU_UI.C(368): error C202: 'TxtMax': undefined identifier
MENU_UI.C(370): error C202: 'dir': undefined identifier
MENU_UI.C(372): error C202: 'TxtMax': undefined identifier
MENU_UI.C(374): error C202: 'dir': undefined identifier
MENU_UI.C(387): error C202: 'key': undefined identifier
MENU_UI.C(388): error C202: 'key': undefined identifier
MENU_UI.C(389): error C202: 'key': undefined identifier
MENU_UI.C(389): error C202: 'old_Doc_pos': undefined identifier
MENU_UI.C(389): error C202: 'Doc_pos': undefined identifier
MENU_UI.C(390): error C202: 'key': undefined identifier
MENU_UI.C(390): error C202: 'old_Doc_pos': undefined identifier
MENU_UI.C(390): error C202: 'Doc_pos': undefined identifier
MENU_UI.C(391): error C202: 'key': undefined identifier
MENU_UI.C(401): error C202: 'key': undefined identifier
MENU_UI.C(405): error C202: 'old_Doc_pos': undefined identifier
MENU_UI.C(407): error C202: 'old_Doc_pos': undefined identifier
MENU_UI.C(408): error C202: 'Doc_pos': undefined identifier
MENU_UI.C(422): error C202: 'key': undefined identifier
MENU_UI.C(423): error C202: 'key': undefined identifier
MENU_UI.C(424): error C202: 'key': undefined identifier
MENU_UI.C(426): error C202: 'Music_Vol': undefined identifier
MENU_UI.C(429): error C202: 'Music_Vol': undefined identifier
MENU_UI.C(431): error C202: 'MusicVol': undefined identifier
MENU_UI.C(432): error C202: 'MusicVol': undefined identifier
MENU_UI.C(433): error C202: 'MusicVol': undefined identifier
MENU_UI.C(434): error C202: 'MusicVol': undefined identifier
MENU_UI.C(435): error C202: 'Music_Vol': undefined identifier
MENU_UI.C(443): error C202: 'key': undefined identifier
MENU_UI.C(445): error C202: 'Music_Vol': undefined identifier
MENU_UI.C(448): error C202: 'Music_Vol': undefined identifier
MENU_UI.C(450): error C202: 'MusicVol': undefined identifier
MENU_UI.C(451): error C202: 'MusicVol': undefined identifier
MENU_UI.C(452): error C202: 'MusicVol': undefined identifier
MENU_UI.C(453): error C202: 'MusicVol': undefined identifier
MENU_UI.C(454): error C202: 'Music_Vol': undefined identifier
MENU_UI.C(462): error C202: 'key': undefined identifier
MENU_UI.C(466): error C202: 'key': undefined identifier
MENU_UI.C(490): error C202: 'key': undefined identifier
MENU_UI.C(491): error C202: 'key': undefined identifier
MENU_UI.C(492): error C202: 'key': undefined identifier
MENU_UI.C(492): error C202: 'oldmpos': undefined identifier
MENU_UI.C(492): error C202: 'mpos': undefined identifier
MENU_UI.C(493): error C202: 'key': undefined identifier
MENU_UI.C(493): error C202: 'oldmpos': undefined identifier
MENU_UI.C(493): error C202: 'mpos': undefined identifier
MENU_UI.C(494): error C202: 'key': undefined identifier
MENU_UI.C(496): error C202: 'mpos': undefined identifier
MENU_UI.C(533): error C202: 'key': undefined identifier
MENU_UI.C(535): error C202: 'oldmpos': undefined identifier
MENU_UI.C(537): error C202: 'oldmpos': undefined identifier
MENU_UI.C(538): error C202: 'mpos': undefined identifier
MENU_UI.C(542): error C202: 'mpos': undefined identifier
compiling myfun.c...
MYFUN.C(55): warning C291: not every exit path returns a value
compiling 12864.c...
compiling pff.c...
compiling diskio.c...
Target not created
回復

使用道具 舉報

地板
ID:517224 發表于 2019-7-22 09:42 | 只看該作者
看看,順便練習一下
回復

使用道具 舉報

5#
ID:377382 發表于 2020-5-22 22:45 | 只看該作者
感謝分享
回復

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規則

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

Powered by 單片機教程網

快速回復 返回頂部 返回列表
主站蜘蛛池模板: av黄在线观看 | 久热精品在线播放 | 日韩www| 麻豆国产一区二区三区四区 | 欧美日韩国产一区 | 成人片免费看 | 欧美一区2区三区4区公司二百 | 国产乱码精品一区二区三区五月婷 | 夜色www国产精品资源站 | 亚洲成人一区二区 | 在线欧美| 国产精品久久国产精品久久 | 中文字幕av一区二区三区 | 国产传媒 | 国产精品国产三级国产aⅴ中文 | 日韩欧美中文字幕在线视频 | 国产高清视频在线观看 | 婷婷丁香在线视频 | 天天天堂| 在线第一页 | 午夜一区二区三区在线观看 | 欧美久久久久久久久 | 欧美一区视频在线 | 中文字幕第二十页 | 在线视频一区二区 | 国产精品美女www | 久久久久亚洲视频 | 亚洲精久久久 | 亚洲日本成人 | 亚洲综合无码一区二区 | 国产精品不卡一区 | 日日综合 | 免费观看成人鲁鲁鲁鲁鲁视频 | 337p日韩 | 天天爱天天操 | 天天操夜夜操免费视频 | 精品国产乱码久久久久久丨区2区 | 亚洲精品1区| 曰韩一二三区 | 男人天堂99 | 国产免费一区二区 |