![DSP 5509音頻信號(hào)低通濾波_第1頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-3/12/252d7ed3-4b9a-4357-9fd0-5aa023069e9f/252d7ed3-4b9a-4357-9fd0-5aa023069e9f1.gif)
![DSP 5509音頻信號(hào)低通濾波_第2頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-3/12/252d7ed3-4b9a-4357-9fd0-5aa023069e9f/252d7ed3-4b9a-4357-9fd0-5aa023069e9f2.gif)
![DSP 5509音頻信號(hào)低通濾波_第3頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-3/12/252d7ed3-4b9a-4357-9fd0-5aa023069e9f/252d7ed3-4b9a-4357-9fd0-5aa023069e9f3.gif)
![DSP 5509音頻信號(hào)低通濾波_第4頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-3/12/252d7ed3-4b9a-4357-9fd0-5aa023069e9f/252d7ed3-4b9a-4357-9fd0-5aa023069e9f4.gif)
![DSP 5509音頻信號(hào)低通濾波_第5頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-3/12/252d7ed3-4b9a-4357-9fd0-5aa023069e9f/252d7ed3-4b9a-4357-9fd0-5aa023069e9f5.gif)
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、#include <math.h>#include <tms320.h>#include <stdio.h>#include <dsplib.h>#include <csl.h>#include <csl_i2c.h>#include <csl_pll.h>#include <csl_mcbsp.h>#include <csl_emif.h>#include <csl_chip.h>#include <csl_gpio.h>/#include "hamm
2、ing30fdacoefs.h"#include "hamming30hipsfdacoefs.h"/30 points hamming window high pass FIR#include "bandpass101fdacoefs.h"/101 points bandpass FIR, 300Hz-1.5kHz/ #include "eq110fdacoefs.h"/ #include "eq110hifdacoefs.h"/ #define PI 3.14159265358979323846 /
3、PI value/ #define CONV 32767.999999 / Q15-> float conversion value = 215- 21-15 #define CODEC_ADDR 0x1A/ AIC23 I2C address#define ST1_55 *(int *)0x03#define ST3_55 *(int *)0x04#define LBDS1 (*(unsigned int *)0x600400)#define keyboard (*(unsigned int *)0x600C00)#define GPIO_SEL (*(unsigned int *)0
4、x400000)#define hNX 1/ Fir input data length/ #define NH 31unsigned int uLED10=0x0db,0x50,0x6b,0x73,0xf0,0x0b3,0x0bb,0x51,0x0fb,0x0f3;DATA *aic23data,*voicedata;/ voice input & output data pointerDATA *dbptr /* = &db0 */;/ lopass fliter bufferDATA *dbptrhi;/ hipass fliter buffer/ void Delay(
5、unsigned int nDelay);/ 延時(shí)子程序void aic_init();/ init aic23unsigned int time=0;unsigned int temp_key,temp_key1,firflag;/ key buffer & fliter select flag/*/void delay(Uint32 k)/ true delay func while(k-);/*/void dealkey()/ key func temp_key=keyboard;/ read key data temp_key=temp_key & 0x00ff; if
6、(0xff!=temp_key)/ compare temp_key1=temp_key; delay(150); temp_key=keyboard; temp_key=temp_key & 0x00ff; if(temp_key = temp_key1) /time+; /keycodetime=temp_key; switch(temp_key) case 0x0fb:LBDS1=0x75;/ L/ recordflag=1;firflag = 0;/0: low passbreak;case 0x0f7:LBDS1=0x56;/ replayflag=1;break;case
7、0x0ef:LBDS1=0x07;/ H/ stopflag=1;firflag = 1;/1: high passbreak;case 0x0df:LBDS1=0;/ overflag=1;break;case 0x0bf:LBDS1=0x0ff-uLED5;/LED just for funbreak;case 0x07f:LBDS1=0x0ff-uLED6;break;case 0x0fd:LBDS1=0x0ff-uLED7;break;case 0x0fe:LBDS1=0x0ff-uLED8;break;default:break; /*/*/*/*鎖相環(huán)的設(shè)置*/PLL_Config
8、 myConfig = 0, /IAI: the PLL locks using the same process that was underway /before the idle mode was entered 1, /IOB: If the PLL indicates a break in the phase lock, /it switches to its bypass mode and restarts the PLL phase-locking /sequence 24, /PLL multiply value; multiply 24 times 1 /Divide by
9、2 PLL divide value; it can be either PLL divide value /(when PLL is enabled), or Bypass-mode divide value /(PLL in bypass mode, if PLL multiply value is set to 1);EMIF_Config emiffig = 0x221, /EGCR : the MEMFREQ = 00,the clock for the memory is equal to cpu frequence / the WPE = 0 ,forbiden the writ
10、ing posting when we debug the EMIF / the MEMCEN = 1,the memory clock is reflected on the CLKMEM pin / the NOHOLD = 1,HOLD requests are not recognized by the EMIF 0xFFFF,/EMI_RST: any write to this register resets the EMIF state machine 0x3FFF,/CE0_1: CE0 space control register 1 / MTYPE = 011,Synchr
11、onous DRAM(SDRAM),16-bit data bus width 0xFFFF, /CE0_2: CE0 space control register 2 0x00FF, /CE0_3: CE0 space control register 3 / TIMEOUT = 0xFF; 0x3FFF,/CE1_1: CE0 space control register 1 0xFFFF,/CE1_2: CE0 space control register 2 0x00FF,/CE1_3: CE0 space control register 3 0x1FFF,/CE2_1: CE0 s
12、pace control register 1 0xFFFF,/CE2_2: CE0 space control register 2 0x00FF,/CE2_3: CE0 space control register 3 0x1FFF,/CE3_1: CE0 space control register 1 0xFFFF,/CE3_2: CE0 space control register 2 0x00FF,/CE3_3: CE0 space control register 3 0x2911, /SDC1: SDRAM control register 1 / TRC = 8 / SDSI
13、ZE = 0;SDWID = 0 / RFEN = 1 / TRCD = 2 / TRP = 2 0x0410,/SDPER : SDRAM period register / 7ns *4096 0x07FF, /SDINIT: SDRAM initialization register / any write to this register to init the all CE spaces, / do it after hardware reset or power up the C55x device 0x0131/SDC2: SDRAM control register 2 / S
14、DACC = 0; / TMRD = 01; / TRAS = 0101; / TACTV2ACTV = 0001; ;MCBSP_Config Mcbsptest;/*McBSP set,we use mcbsp1 to send and recieve the data between DSP and AIC23*/MCBSP_Config Mcbsp1Config = MCBSP_SPCR1_RMK( MCBSP_SPCR1_DLB_OFF, /* DLB = 0,禁止自閉環(huán)方式 */ MCBSP_SPCR1_RJUST_LZF, /* RJUST = 2 */ MCBSP_SPCR1_
15、CLKSTP_DISABLE, /* CLKSTP = 0 */ MCBSP_SPCR1_DXENA_ON, /* DXENA = 1 */ 0, /* ABIS = 0 */ MCBSP_SPCR1_RINTM_RRDY, /* RINTM = 0 */ 0, /* RSYNCER = 0 */ MCBSP_SPCR1_RRST_DISABLE /* RRST = 0 */ ), MCBSP_SPCR2_RMK( MCBSP_SPCR2_FREE_NO, /* FREE = 0 */ MCBSP_SPCR2_SOFT_NO, /* SOFT = 0 */ MCBSP_SPCR2_FRST_F
16、SG, /* FRST = 0 */ MCBSP_SPCR2_GRST_CLKG, /* GRST = 0 */ MCBSP_SPCR2_XINTM_XRDY, /* XINTM = 0 */ 0, /* XSYNCER = N/A */ MCBSP_SPCR2_XRST_DISABLE /* XRST = 0 */ ), /*單數(shù)據(jù)相,接受數(shù)據(jù)長(zhǎng)度為16位,每相2個(gè)數(shù)據(jù)*/ MCBSP_RCR1_RMK( MCBSP_RCR1_RFRLEN1_OF(1), /* RFRLEN1 = 1 */ MCBSP_RCR1_RWDLEN1_16BIT /* RWDLEN1 = 2 */ ), MCBS
17、P_RCR2_RMK( MCBSP_RCR2_RPHASE_SINGLE, /* RPHASE = 0 */ MCBSP_RCR2_RFRLEN2_OF(0), /* RFRLEN2 = 0 */ MCBSP_RCR2_RWDLEN2_8BIT, /* RWDLEN2 = 0 */ MCBSP_RCR2_RCOMPAND_MSB, /* RCOMPAND = 0 */ MCBSP_RCR2_RFIG_YES, /* RFIG = 0 */ MCBSP_RCR2_RDATDLY_1BIT /* RDATDLY = 1 */ ), MCBSP_XCR1_RMK( MCBSP_XCR1_XFRLEN
18、1_OF(1), /* XFRLEN1 = 1 */ MCBSP_XCR1_XWDLEN1_16BIT /* XWDLEN1 = 2 */ ), MCBSP_XCR2_RMK( MCBSP_XCR2_XPHASE_SINGLE, /* XPHASE = 0 */ MCBSP_XCR2_XFRLEN2_OF(0), /* XFRLEN2 = 0 */ MCBSP_XCR2_XWDLEN2_8BIT, /* XWDLEN2 = 0 */ MCBSP_XCR2_XCOMPAND_MSB, /* XCOMPAND = 0 */ MCBSP_XCR2_XFIG_YES, /* XFIG = 0 */ M
19、CBSP_XCR2_XDATDLY_1BIT /* XDATDLY = 1 */ ), MCBSP_SRGR1_DEFAULT, MCBSP_SRGR2_DEFAULT, MCBSP_MCR1_DEFAULT, MCBSP_MCR2_DEFAULT, MCBSP_PCR_RMK( MCBSP_PCR_IDLEEN_RESET, /* IDLEEN = 0 */ MCBSP_PCR_XIOEN_SP, /* XIOEN = 0 */ MCBSP_PCR_RIOEN_SP, /* RIOEN = 0 */ MCBSP_PCR_FSXM_EXTERNAL, /* FSXM = 0 */ MCBSP_
20、PCR_FSRM_EXTERNAL, /* FSRM = 0 */ 0, /* DXSTAT = N/A */ MCBSP_PCR_CLKXM_INPUT, /* CLKXM = 0 */ MCBSP_PCR_CLKRM_INPUT, /* CLKRM = 0 */ MCBSP_PCR_SCLKME_NO, /* SCLKME = 0 */ MCBSP_PCR_FSXP_ACTIVEHIGH, /* FSXP = 0 */ MCBSP_PCR_FSRP_ACTIVEHIGH, /* FSRP = 1 */ MCBSP_PCR_CLKXP_FALLING, /* CLKXP = 1 */ MCB
21、SP_PCR_CLKRP_RISING /* CLKRP = 1 */ ), MCBSP_RCERA_DEFAULT, MCBSP_RCERB_DEFAULT, MCBSP_RCERC_DEFAULT, MCBSP_RCERD_DEFAULT, MCBSP_RCERE_DEFAULT, MCBSP_RCERF_DEFAULT, MCBSP_RCERG_DEFAULT, MCBSP_RCERH_DEFAULT, MCBSP_XCERA_DEFAULT, MCBSP_XCERB_DEFAULT, MCBSP_XCERC_DEFAULT, MCBSP_XCERD_DEFAULT, MCBSP_XCE
22、RE_DEFAULT, MCBSP_XCERF_DEFAULT, MCBSP_XCERG_DEFAULT, MCBSP_XCERH_DEFAULT; MCBSP_Handle hMcbsp;/* This next struct shows how to use the I2C API */* Create and initialize an I2C initialization structure */I2C_Setup I2Cinit = 0, /* 7 bit address mode */ 0, /* own address - don't care if master */
23、7, /* clkout value (Mhz) */ 400, /* a number between 10 and 400*/ 0, /* number of bits/byte to be received or transmitted (8)*/ 0, /* DLB mode on*/ 1 /* FREE mode of operation on*/;I2C_Config testI2C;/all config bit zero, it works/ I2C: addr 7bit + data 9bit/*數(shù)字音頻接口格式設(shè)置/ see tlv320a23b datasheetAIC2
24、3為主模式,數(shù)據(jù)為DSP模式,數(shù)據(jù)長(zhǎng)度16位*/ Uint16 digital_audio_inteface_format2=0x0e,0x53;/*AIC23的波特率設(shè)置,0x23采樣率為44.1K,0x0c采樣率為8K*/Uint16 sample_rate_control2 = 0x10,0x0c;/*AIC23寄存器復(fù)位*/Uint16 reset2 =0x1e,0x00;/*AIC23節(jié)電方式設(shè)置,所有部分均所與工作狀態(tài)*/Uint16 power_down_control2 =0x0c,0x01;/*AIC23模擬音頻的控制DAC使能,ADC輸入選擇為MIC*/Uint16 ana
25、log_aduio_path_control2 =0x08,0x14;/*AIC23數(shù)字音頻通路的控制*/Uint16 digital_audio_path_control2 =0x0a,0x05;/*AIC23數(shù)字接口的使能*/Uint16 digital_interface_activation2 =0x12,0x01;/*AIC23左通路音頻調(diào)節(jié)*/ Uint16 left_line_input_volume_control2 =0x00,0x17;/*AIC23右通路音頻調(diào)節(jié)*/ Uint16 right_line_input_volume_control2 =0x02,0x17;/*
26、AIC23耳機(jī)左通路音頻調(diào)節(jié)*/Uint16 left_headphone_volume_control2 =0x05,0x79;/*AIC23耳機(jī)右通路音頻調(diào)節(jié)*/Uint16 right_headphone_volume_control2 = 0x07,0x79;/*定義McBSP的句柄*/Uint16 i2c_status;/Uint16 temp;/Uint16 nin=0,bcount=0;/long dec_sour,dec_temp;void main(void)i2c_status = 1;/ i2c status CSL_init();/ init cslCHIP_RSET(
27、XBSR,0x0a01);GPIO_RSET(IODIR,0xFF);/*設(shè)置系統(tǒng)的運(yùn)行速度為144MHz*/ PLL_config(&myConfig);EMIF_config(&emiffig);/set sdram dbptr = (short *)0x021000;/point to sdramdbptrhi = (short *)0x022000;I2C_RSET(I2CMDR,0);/*設(shè)置預(yù)分頻寄存器,I2C的mode clock is 12MHz*/delay(100);I2C_RSET(I2CSAR,0x001A);I2C_RSET(I2CMDR,0x0620
28、); I2C_setup(&I2Cinit); /*設(shè)置的Mater clock*/I2C_RSET(I2CCLKL,100);I2C_RSET(I2CCLKH,100); I2C_getConfig(&testI2C);/*初始化McBSP1*/hMcbsp = MCBSP_open(MCBSP_PORT1,MCBSP_OPEN_RESET);/*設(shè)置McBSP0*/MCBSP_config(hMcbsp,&Mcbsp1Config);/*啟動(dòng)McBSP0*/MCBSP_start(hMcbsp, MCBSP_RCV_START | MCBSP_XMIT_START,
29、 0); MCBSP_getConfig(hMcbsp,&Mcbsptest); aic_init(); aic23data = (DATA *)0x023000;/point to sdramvoicedata = (DATA *)0x023100;while(1) dealkey();/MCBSP_write16(hMcbsp,aic23data); while(!MCBSP_rrdy(hMcbsp);/ check McBSP read stauts/if(MCBSP_rrdy(hMcbsp)*aic23data = (DATA)(MCBSP_read16(hMcbsp) - 6
30、3800);/ receive mic data/ if(firflag)/firflag :0:low pass, 1:high passfir(/ fir from DSP Libaic23data,/x, / input data arrayBhi,/h, / voicedata,/r, dbptrhi, hNX, BhiL/NH);elsefir(aic23data,/x, B,/h, voicedata,/r, dbptr, hNX, BL/NH);while(!MCBSP_xrdy(hMcbsp);/if(MCBSP_xrdy(hMcbsp)MCBSP_write16(hMcbsp
31、,(unsigned int)(*voicedata + 63800);/ send voice data/*/void aic_init() /*reset AIC23*/ i2c_status = I2C_write( reset, /pointer to data array 2,/length of data to be transmitted 1,/master or slaver CODEC_ADDR, /slave address to transmit to 1,/transfer mode of operation 30000/time out for bus busy );
32、 delay(1000); /*設(shè)置AIC23各部分均工作*/ i2c_status = I2C_write( power_down_control,/pointer to data array 2,/length of data to be transmitted 1,/master or slaver CODEC_ADDR, /slave address to transmit to 1,/transfer mode of operation 30000/time out for bus busy ); /*設(shè)置AIC23的數(shù)字接口*/i2c_status = I2C_write( dig
33、ital_audio_inteface_format,/pointer to data array 2,/length of data to be transmitted 1,/master or slaver CODEC_ADDR, /slave address to transmit to 1,/transfer mode of operation 30000/time out for bus busy ); /*設(shè)置AIC23模擬通路*/i2c_status = I2C_write( analog_aduio_path_control,/pointer to data array 2,/
34、length of data to be transmitted 1,/master or slaver CODEC_ADDR, /slave address to transmit to 1,/transfer mode of operation 30000/time out for bus busy );/*設(shè)置數(shù)字通路*/i2c_status = I2C_write( digital_audio_path_control,/pointer to data array 2,/length of data to be transmitted 1,/master or slaver CODEC
35、_ADDR, /slave address to transmit to 1,/transfer mode of operation 30000/time out for bus busy ); /*設(shè)置AIC23的采樣率*/i2c_status = I2C_write( sample_rate_control,/pointer to data array 2,/length of data to be transmitted 1,/master or slaver CODEC_ADDR, /slave address to transmit to 1,/transfer mode of operation 30000/time out for bus busy );/*設(shè)置耳機(jī)音量*/i2c_status = I2C_write( left_headp
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 二零二五年度錨具行業(yè)市場(chǎng)調(diào)研與分析合同
- 二零二五年度葡萄苗種植與生態(tài)旅游結(jié)合合同4篇
- 二零二五年度廣州市體育產(chǎn)業(yè)勞務(wù)派遣與賽事運(yùn)營(yíng)合同2篇
- 二零二五年度起訴離婚財(cái)產(chǎn)分配合同樣本
- 2025年度快艇購(gòu)置及水上救援培訓(xùn)合同2篇
- 2025-2030全球工業(yè)機(jī)器人減速馬達(dá)行業(yè)調(diào)研及趨勢(shì)分析報(bào)告
- 2025-2030全球精準(zhǔn)化放射免疫治療行業(yè)調(diào)研及趨勢(shì)分析報(bào)告
- 二零二五年度離婚房產(chǎn)分割與房貸債務(wù)解除合同3篇
- 環(huán)境保護(hù)科技項(xiàng)目研發(fā)合同
- 基于云計(jì)算的企業(yè)服務(wù)外包合同
- (二模)遵義市2025屆高三年級(jí)第二次適應(yīng)性考試試卷 地理試卷(含答案)
- 二零二五隱名股東合作協(xié)議書及公司股權(quán)代持及回購(gòu)協(xié)議
- 風(fēng)電設(shè)備安裝施工專項(xiàng)安全措施
- IQC培訓(xùn)課件教學(xué)課件
- 2025年計(jì)算機(jī)二級(jí)WPS考試題目
- 高管績(jī)效考核全案
- 2024年上海市中考英語(yǔ)試題和答案
- 長(zhǎng)沙醫(yī)學(xué)院《無機(jī)化學(xué)》2021-2022學(xué)年第一學(xué)期期末試卷
- eras婦科腫瘤圍手術(shù)期管理指南解讀
- GB/T 750-2024水泥壓蒸安定性試驗(yàn)方法
- 初一到初三英語(yǔ)單詞表2182個(gè)帶音標(biāo)打印版
評(píng)論
0/150
提交評(píng)論