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

 找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開(kāi)始

搜索
查看: 7777|回復(fù): 4
收起左側(cè)

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

  [復(fù)制鏈接]
ID:278081 發(fā)表于 2018-1-20 17:22 | 顯示全部樓層 |閱讀模式
練手項(xiàng)目,完整資料
Altium Designer畫(huà)的原理圖和PCB圖如下:(51hei附件中可下載工程文件)
0.jpg 0.jpg
單片機(jī)源程序如下:
  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;   ///定義一個(gè)文件系統(tǒng)對(duì)象
  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'};//音量整形轉(zhuǎn)為字符串類(lèi)型
  19. UINT8 Doc_pos=0;                //文檔菜單索引
  20. UINT8 old_Doc_pos=-1;        //按鍵之前文檔菜單索引
  21. UINT8 mpos=0;                         //主菜單播索引值
  22. UINT8 oldmpos = 2;                //按鍵之前主菜單索引值
  23. UINT8 key=0;                        //當(dāng)前按鍵值
  24. UINT8 MusicMax=0;                //讀取音樂(lè)文件的個(gè)數(shù)
  25. UINT8 TxtMax=0;                        //讀取文檔文件的個(gè)數(shù)
  26. UINT8 flag_music=0;               
  27. LONG pMusic=0;
  28. WORD br,rc;
  29. FILINFO filinfo;//文件信息
  30. DIR dir;  

  31. //初始化所有設(shè)備
  32. void all_init()
  33. {
  34.         {P1M1 = 0X40; P1M0 = 0xbF;}   //硬件SPI必須!!!!!!!!!!!I/O口1模式控制器1
  35. //        P0M1 = 0Xff; P0M0 = 0xff;          //有上拉電阻的話就要該行  使其IO為弱  要是板子沒(méi)有上拉電阻就可注釋該句
  36.         SPI_Init();         //SPI初始化,默認(rèn)最低速
  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");          //下面的掛載其實(shí)已經(jīng)初始化SD卡了,可不必重復(fù)

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

  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));         //通過(guò)打印寄存器數(shù)值看VS1003是否初始化成功
  62.         DB_SendInfo("VS_CLOCKF = ",VS1003_ReadReg(VS_CLOCKF));
  63.        
  64.         Main_Oper();   //死循環(huán)
  65. }
復(fù)制代碼

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


回復(fù)

使用道具 舉報(bào)

ID:105206 發(fā)表于 2018-1-22 06:39 | 顯示全部樓層
看看,學(xué)習(xí)下。
回復(fù)

使用道具 舉報(bào)

ID:251061 發(fā)表于 2019-7-11 22:32 | 顯示全部樓層
好像編譯不能通過(guò),
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
回復(fù)

使用道具 舉報(bào)

ID:517224 發(fā)表于 2019-7-22 09:42 | 顯示全部樓層
看看,順便練習(xí)一下
回復(fù)

使用道具 舉報(bào)

ID:377382 發(fā)表于 2020-5-22 22:45 | 顯示全部樓層
感謝分享
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

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

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

快速回復(fù) 返回頂部 返回列表
主站蜘蛛池模板: 99热在这里只有精品 | 人人干人人玩 | 国产十日韩十欧美 | 免费观看的av毛片的网站 | 久久久久久亚洲 | 操到爽| 国产精品久久福利 | 日韩理论电影在线观看 | 久久久久久国产精品 | 午夜亚洲 | 精品一区二区三区在线视频 | 欧美福利网站 | 伊人网站 | 毛片1| 午夜爱爱毛片xxxx视频免费看 | 九九综合 | 午夜视频在线免费观看 | 亚洲成人一区二区三区 | 欧美成人一区二免费视频软件 | 国产精品一区二区av | 亚洲色图第一页 | 91视视频在线观看入口直接观看 | 日日操夜夜摸 | 国产精品久久久久久久7电影 | 亚洲视频在线免费观看 | 91精品国产高清久久久久久久久 | 午夜影院在线观看免费 | 人人鲁人人莫人人爱精品 | 成人亚洲综合 | 国产精品久久免费观看 | 99热精品在线 | 久久久久久高潮国产精品视 | 欧美激情区 | 日日摸日日碰夜夜爽2015电影 | 一级黄色片免费在线观看 | 夜夜爽99久久国产综合精品女不卡 | 日韩中文一区 | 国产精品久久久久久久久久久免费看 | 日韩精品在线观看视频 | 91在线观看免费 | 欧美视频福利 |