基于DSP的数字滤波系统源程序(汇编语言).doc_第1页
基于DSP的数字滤波系统源程序(汇编语言).doc_第2页
基于DSP的数字滤波系统源程序(汇编语言).doc_第3页
基于DSP的数字滤波系统源程序(汇编语言).doc_第4页
基于DSP的数字滤波系统源程序(汇编语言).doc_第5页
已阅读5页,还剩4页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

基于DSP的数字滤波系统源程序(汇编语言) .title test vc5402bootloader. .def _c_int00 .mmregsgpiocr .set 3chgpiosr .set 3dhdxr10 .set 23hdrr10 .set 21hspsa0 .set 38hspcr10 .set 39hspcr20 .set 39hxcr10 .set 39hpcr0 .set 39hdxr11 .set 43hspsa1 .set 48hspcr11 .set 49hspcr21 .set 49hxcr11 .set 49hpcr1 .set 49hsrgr1 .set 49hsrgr2 .set 49hswcr .set 2bhtimer_count .set 060hmcbsp_init .set 061hwave_ptr .set 062his_new_data .set 063hnew_ad .set 064hout_wave_ptr .set 065ht_ar2 .set 066ht_ar3 .set 067htemp .set 068hwave_buf .set 0900h out_wave_buf .set 01000hN .set 38 ; FIR tapsfir_coef_buf .set 100h ; FIR coef bufferfir_data .set 200h ; FIR windows data buffer ! .textrs b _c_int00 nop nopnmi b _ret nop nopsint17 b _ret nop nopsint18 b _ret nop nopsint19 b _ret nop nopsint20 b _ret .word 0,0sint21 b _ret .word 0,0sint22 .word 01000h .word 0,0,0sint23 .word 0ff80h .word 0,0,0sint24 .word 01000h .word 0,0,0sint25 .word 0ff80h .word 0,0,0sint26 .word 01000h .word 0,0,0sint27 .word 0ff80h .word 0,0,0sint28 .word 01000h .word 0,0,0sint29 .word 0ff80h .word 0,0,0sint30 .word 01000h .word 0,0,0int0 b _ret nop nopint1 b _ret nop nopint2 b _ret nop noptint b timer nop nopbrint0 b receive nop nopbxint0 bd transmit nop noptrint b _ret nop noptxint b _ret nop nopint3 b _ret nop nophpint b _ret nop nopq26 .word 0ff80h .word 0,0,0q27 .word 01000h .word 0,0,0q28 .word 0ff80h .word 0,0,0q29 .word 01000h .word 0,0,0q30 .word 0ff80h .word 0,0,0q31 .word 01000h .word 0,0,0_c_int00: stm #2020h,pmst ; vector table start: 0x2000 ssbx intm ; close all int ! (ssbx intm) ssbx sxm ; extend sign ! ssbx frct ; faction multiply stm #10h,26h ; stop TIMER0 ! stm #10h,36h ; stop TIMER1 ! stm #0ffh,sp ; sp= 0x0ff ld #0,dp ; dp=0 stm #0ffffh,ifr ; clear all int ! stm #20h,imr ; bit5-BXINT0, bit4-BRINT0, enable BXINT0 stm #02492h,swwsr ; all 2 waits ! stm #0,swcr stm #0,58hwait_pll: ldm 58h,a and #1,a bc wait_pll,aneq stm #87ffh,58h ; switch pll*9 - 90M clk rpt #1000 nop;*; initalize RAM, Variable.;* stm #wave_buf,ar6 stm #1,ar0 rpt #24 mvpd wave_data,*ar6+0 ; move wave data to wave_buf - 0x6000h stm #wave_buf,wave_ptr ; save wave bufferptr stm #out_wave_buf,out_wave_ptr ; save out wave bufferptr, because use ; circular address, so when save out_wave ; date,must + ! stm #fir_coef_buf,ar6 rpt #N-1 mvpd fir_coef,*ar6+ ; move fir coef to fir_coef_buf(in data mem) stm #fir_coef_buf,t_ar2 ; stm #fir_data,t_ar3 stm #0aa55h,mcbsp_init ; when mcbsp_init=0xaa55, transmit for init ac01 stm #5,timer_count ; init variable timer_count ! stm #0,is_new_data ; if is_new_data =1 , has new AD data by slave ac01 ! stm #1000h,ar0 stm #1800h,ar5 stm #400h,bk ld *ar0,t ld #0,b;*; The following codes are used to initalize McBSP0 !;* stm #0,spsa0 ; choose SPCR10 stm #2000h,spcr10 ; receive sign_extend in DRR stm #1,spsa0 ; choose SPCR20 stm #0c0h,spcr20 ; fs - int ! stm #2,spsa0 ; choose RCR10 stm #40h,39h stm #3,spsa0 ; choose RCR20 stm #0,39h stm #4,spsa0 ; choose XCR10 stm #40h,xcr10 stm #5,spsa0 ; choose XCR20 stm #0,39h stm #0eh,spsa0 ; choose PCR0 stm #0dh,pcr0 ; fs is low active, rise edge of clkx, falling edge ; of clkr stm #7h,spsa0 stm #8000h,39h rpt #0ffffh nop stm #00h,dxr10 ldm 22h,a stm #1,38h stm #0c1h,39h ; start McBSP0 send ! ld #603h,a rsbx intm ; enable all int !;-; The following codes are initalized AC01, ALL AC01 setup same !;- idle 1 idle 1 idle 1 idle 1 ; reset two AC01 by software ! ld #600h,a idle 1 ; wait for int . ld #3,a idle 1 ; send #3 ld #00105h,a ; fs=10M/2/A/B= 25k ; flp=10M/2/40/A= 25k (all pass) ; fhp=fs/200= 125Hz (not use !) ; A=05,B=40(0x28) idle 1 ; send 1th regs - 05h ld #3,a idle 1 ; send #3 ld #00228h,a idle 1 ; send 2th regs - 28h ld #3,a idle 1 ; send #3 ld #00300h,a idle 1 ; send 3th regs - 00h ld #3,a idle 1 ; send #3 ld #00405h,a idle 1 ; send 4th regs - 05h (AD & DA 0 dB) ld #3,a idle 1 ; send #3 ld #00505h,a idle 1 ; send 5th regs - 05h (highpass filter disable) ld #3,a idle 1 ; send #3 ld #00600h,a idle 1 ; send 6th regs - 00h ld #3,a idle 1 ; send #3 ld #00700h,a idle 1 ; send 7th regs - 0 ld #3,a idle 1 ; send #3 ld #800h,a idle 1 ; send 8th regs - 0 ld #0h,a stm #0,38h stm #2001h,39h ; start MCbsp0 receive ! stm #30h,imr ; bit5-BXINT0, bit4-BRINT0, enable BXINT0;*; The following codes are used to initalize TIMER !;* stm #10h,tcr ; stop TIMER ! stm #0ffffh,prd ; stm #0fh,tcr ; TIMER start, each about 100HZ . orm #8,imr ; enable TIMER INT !again: bitf is_new_data,#1 ; test is_new_data = 1 ? cc fir,tc ; =1, then call fir ! new AD data in new_ad(0x64) b again;*; The following codes are serived for McBSP0 transmit !;*transmit: pshm st1 pshm st0 pshm bk pshm ar7 pshm ah pshm al cmpm mcbsp_init,#0aa55h bc init,tc stm #25,bk ; each AC01 has 25 dots to D/A ! mvdm #wave_ptr,ar7 ; restore wave buffer ptr ! nop ld *ar7+%,a nop stlm a,dxr10 ; send wave data ! Master AC01 make source wave, ; Slave AC01 make filter result wave ! bd wave_make_end mvmd ar7,#wave_ptr ; save wave buffer ptr !init: stlm a,dxr10 bitf dxr10,#800h ; if setup last reg of AC01, set mcbsp_init=0 ! bc wave_make_end,ntc ; not equal ,jump ! stm #0,mcbsp_init ; when mcbsp=0 or 1, transmit for make wave !wave_make_end: popm al popm ah popm ar7 popm bk popm st0 popm st1_ret: rete;*; The following codes are serived for McBSP0 receive ! use AR5,BK!;*receive: pshm st1 pshm st0 ld #0,dp mvkd drr10,*ar5 ; save AD data pshd *ar5+% ; save AD data in AD_buffer(0x1800-0x1c00) popd new_ad stm #1,is_new_data ; has new AD data popm st0 popm st1 rete;*; The following codes are serived for vc5402 TIMER !;*timer: pshm ah pshm al ldm timer_count,a sub #1,a bc not_show_led,aneq ; if a != 0 ,jump ! bitf st1,#2000h ; test XF? bc show_led,tc ssbx xf ; set xf=1 b show_conshow_led: rsbx xf ; set xf=0show_con: ld #5,a ; not_show_led: stlm a,timer_count popm al popm ah rete;*; The following codes is used to FIR, new AD DATA in new_ad(0x64); FIR buffer coff- 0x100(ar2), FIR window buffer - 0x200(ar3);*fir: pshm st1 pshm st0 pshm bk pshm ar7 pshm ah pshm al pshm ar0 pshm ar2 pshm ar3 mvdm #t_ar2,ar2 ; restore ar2 mvdm #t_ar3,ar3 ; restore ar3 ld new_ad,-2,a ; new AD data - a, remove two LSBs stm #1,ar0 stm #N,bk ; set circular addressing size stl a,*ar3+% rptz a,#(N-1) ; 0 - a, then repeat 34 times mac *ar2+0%,*ar3+0%,a ; done FIR filter, result in ah mvmd ar3,#t_ar3 ; save ar3 mvmd ar2,#t_ar2 ; save ar2 stm #1,ar0 stm #100h,bk ; each AC01 has 25 dots to D/A ! mvdm #out_wave_ptr,ar7 ; restore wave buffer ptr ! sth a,-2,temp ; save FIR result in temp ld temp,2,a ; shift 2 bit for AC01 D/A ! stl a,*ar7+0% ; save FIR result to wave buffer ! stl a,temp mvmd ar7,#out_wave_ptr ; save wave buffer ptr ! stm #0,is_new_data ; new AD data has been processed ! ld #0,dp cmpm out_wave_ptr, 1000h bc con_fir,ntcccs_show: nop ; if out_wave_ptr = 0xc00, nop ; may show out_wave in CCS ! show 128 dots ! ; input buffer - 0x1800 ; output buffer - 0x1000 (show from 0x1020) con_fir: popm ar3 popm ar2 popm ar0 popm al popm ah popm ar7 popm bk popm st0 popm st1 ret;*; The following data is used by make wave ! when using, must copy to; wave buffer - 0x6000;*wave_data: ; freq about 1k Hz .word 03ffch ; +2 volt .word 03ffch .word 03ffch .word 03ffch .word 03ffch .word 03ffch .word 03ffch .word 03ffch .word 03ffch .word 03ffch .word 03ffch .word 03ffch .word 03ffch .word 0c000h ; -2 volt .word 0c000h .word 0c000h .word 0c000h .word 0c000h .word 0c000h .word 0c000h .word 0c000h .word 0c000h .word 0c000h .word 0c000h .word 0c000h;*; Filter Type Lowpass; Filter Length 38; Sampling Frequency 25.00000000; Upper Band Edge 1.20000005; Lower Band Edge 2.79999995;*fir_coef: .word 34 ;C037 .word 235 ;C036 .word 500 ;C035 .word

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论