stm32F103录音回放原理图:
基于STM32的语音存贮与回放PCB
\野火注\
1 液晶尺寸是3.2寸,控制器是 ILI9341
2 SD卡4位模式DMA ,支持长文件名及中文文件名
stm32单片机源程序:
- /******************** (C) COPYRIGHT 2012 WildFire Team **************************
- * 文件名 :main.c
- * 描述 :LCD显示实验,可中英混合显示,可显示BMP格式的图片,可截图,
- * 截图保存在MicroSD卡中,文件名存为myScreen.bmp,
- * 需显示的BMP图片和字库存放在MicroSD卡中。
- * 实验平台:野火STM32开发板
- * 库版本 :ST3.5.0
- *
- * 作者 :wildfire team
- **********************************************************************************/
- /* Includes ------------------------------------------------------------------*/
- #include "stm32f10x.h"
- #include "SysTick.h"
- #include "usart1.h"
- #include "lcd.h"
- #include "sd_fs_app.h"
- #include "Sd_bmp.h"
- #include "adc.h"
- #include "dac.h"
- #include "key.h"
- // ADC1转换的电压值通过MDA方式传到SRAM
- extern __IO uint16_t ADC_ConvertedValue;
- //#define SIZE 1000*1024
- #define WriteStartAddress ((uint32_t)0x0800B000) //在这里随着程序代码的增加,初试地址也要随着增加,否则不能写入a000
- #define WriteEndAddress ((uint32_t)0x0807F7FF)
- //#define FLASH_PAGE_SIZE ((u16)0x400) //1024
- #define FLASH_PAGE_SIZE ((u16)0x800) //2048
- uint32_t EraseCounter = 0x00, WriteAddress = 0x00,ReadAddress = 0x00;
- uint32_t NbrOfPage = 0x0000;
- volatile FLASH_Status FLASHStatus;//枚举变量的定义
- // 软件延时 自己加了个大延时
- void Delay(__IO uint32_t nCount)
- {
- for(; nCount != 0; nCount--);
- }
- void NDelay(uint32_t n)
- {
- uint32_t i;
- for(i=0;i<n;i++)
- Delay(0xFFF);
- }
- int main(void)
- {
- /* USART1 config */
- USART1_Config();
- /* enable adc1 and config adc1 to dma mode */
- ADC1_Init();
-
- DAC1_Init();
- SysTick_Init();
- LCD_Init(); /* LCD 初始化*/
- sd_fs_init();
- FLASHStatus = FLASH_COMPLETE;
-
- /*显示图像*/
- Lcd_show_bmp(80, 0,"/pic4.bmp");
- /*竖屏显示*/
- LCD_Str_ENCH_O_P(55,30,"请按录音键开始录音",0XF800);
- LCD_Str_CH_O_P(35,30,"制作人",0X0000);
- LCD_Str_ENCH_O_P(17,60,"武汉科技大学教十楼208室",0X0000);
- // while (1)
- // {
- // if( Key_Scan(GPIOE,GPIO_Pin_5) == KEY_ON )
- // {
- LCD_Str_CH_P(55,30,"正在录音请稍后片刻",0XF800,0xffff);
- FLASH_Unlock();
- /* Clear All pending flags */
- FLASH_ClearFlag(FLASH_FLAG_BSY | FLASH_FLAG_EOP | FLASH_FLAG_PGERR | FLASH_FLAG_WRPRTERR);
-
- /* Define the number of page to be erased */
- NbrOfPage = (WriteEndAddress - WriteStartAddress) / FLASH_PAGE_SIZE;
-
- /* Erase the FLASH pages */
- for(EraseCounter = 0; (EraseCounter <= NbrOfPage)&&(FLASHStatus == FLASH_COMPLETE); EraseCounter++)
- {
- FLASHStatus=FLASH_ErasePage(WriteStartAddress + (FLASH_PAGE_SIZE * EraseCounter));
- }
-
- //写数据
- WriteAddress = WriteStartAddress;
- while((WriteAddress < WriteEndAddress)&&(FLASHStatus == FLASH_COMPLETE))
- {
- printf("0x%04X ",ADC_ConvertedValue);
- FLASHStatus=FLASH_ProgramHalfWord(WriteAddress, ADC_ConvertedValue);
- WriteAddress = WriteAddress + 2;
- }
- FLASH_Lock();
-
- LCD_Str_CH_P(55,30,"录音完毕请按播放键",0XF800,0xffff);
- NDelay(10000);
- // }
- // if( Key_Scan(GPIOE,GPIO_Pin_6) == KEY_ON )
- // {
- LCD_Str_CH_P(55,30,"正在播放请慢慢倾听",0XF800,0xffff);
- //读数据
- …………限于本文篇幅 余下代码请从51黑下载附件…………
复制代码
完整内容下载:
基于STM32的语音存贮与回放系统.rar
(9.89 MB, 下载次数: 175)
|