音乐播放器单片机源程序如下:
- #include "led.h"
- #include "delay.h"
- #include "key.h"
- #include "sys.h"
- #include "lcd.h"
- #include "usart.h"
- #include "flash.h"
- #include "sram.h"
- #include "malloc.h"
- #include "string.h"
- #include "mmc_sd.h"
- #include "ff.h"
- #include "exfuns.h"
- #include "fontupd.h"
- #include "text.h"
- #include "piclib.h"
- #include "string.h"
- #include "fattester.h"
- #include "piclib.h"
- #include "vs10xx.h"
- #include "mp3player.h"
- #include "audiosel.h"
- #include "usmart.h"
-
- int main(void)
- {
- delay_init(); //延时函数初始化
- NVIC_Configuration(); //设置NVIC中断分组2:2位抢占优先级,2位响应优先级
- uart_init(9600); //串口初始化为9600
- LED_Init(); //LED端口初始化
- LCD_Init();
- KEY_Init();
- Audiosel_Init(); //初始化音源选择
- usmart_dev.init(72);//usmart初始化
- mem_init(SRAMIN); //初始化内部内存池
- VS_Init(); //初始化VS1053
- exfuns_init(); //为fatfs相关变量申请内存
- f_mount(0,fs[0]); //挂载SD卡
- f_mount(1,fs[1]); //挂载FLASH.
- POINT_COLOR=RED;
- while(font_init()) //检查字库
- {
- LCD_ShowString(60,50,200,16,16,"Font Error!");
- delay_ms(200);
- LCD_Fill(60,50,240,66,WHITE);//清除显示
- }
- Show_Str(60,50,200,16,"战舰 STM32开发板",16,0);
- Show_Str(60,70,200,16,"音乐播放器实验",16,0);
- Show_Str(60,90,200,16,"广州星翼电子",16,0);
- Show_Str(60,110,200,16,"2012年9月20日",16,0);
- Show_Str(60,130,200,16,"KEY0:NEXT KEY2:PREV",16,0);
- Show_Str(60,150,200,16,"KEY_UP:VOL+ KEY1:VOL-",16,0);
- while(1)
- {
- Audiosel_Set(0); //音频通道选择MP3音源
- LED1=0;
- Show_Str(60,170,200,16,"存储器测试...",16,0);
- printf("Ram Test:0X%04X\r\n",VS_Ram_Test());//打印RAM测试结果
- Show_Str(60,170,200,16,"正弦波测试...",16,0);
- VS_Sine_Test();
- Show_Str(60,170,200,16,"<<音乐播放器>>",16,0);
- LED1=1;
- mp3_play();
- }
- }
复制代码
所有资料51hei提供下载:
实验44 音乐播放器实验.rar
(1016.17 KB, 下载次数: 78)
|