求高手帮忙写下DSP程序:设计一个FIR低通滤波器...

2024年11月16日 14:21
有1个网友回答
网友(1):

HIGHPASS .set 0 ;if you want to use ,please set the value to 1
BANDPASS .set 0
LOWPASS .set 1
.global start,fir
.mmregs
COFF_FIR_START: .sect "coff_fir"
; .if LOWPASS
.include "haim2750.inc"
; .elseif BANDPASS
; .include "bandpass\bandpass.inc"
; .else
; .include "highpass\highpass.inc"
; .endif

K_FIR_BFFR .set 127
d_data_buffer .usect "fir_bfr",128
FIR_DP .usect "fir_vars",0
d_filin .usect "fir_vars",1
d_filout .usect "fir_vars",100h
output .usect "fir_vars",1

.asg AR4,FIR_DATA_P
.asg AR6,INBUF_P
.asg AR7,OUTBUF_P
.asg AR3,OUTBUF
.sect "fir_prog"
nop
start:
LD #FIR_DP,DP
STM #d_data_buffer,FIR_DATA_P
; STM #d_data_buffer+K_FIR_BFFR-1,FIR_DATA_P
RPTZ A,#K_FIR_BFFR-1
STL A,*FIR_DATA_P+
; STM #d_data_buffer+K_FIR_BFFR-1,FIR_DATA_P
STM #d_filin,INBUF_P
STM #d_filout,OUTBUF_P
STM #output,OUTBUF
STM #100h,BK
fir_loop:
NOP ;Add Breakpoint & porbe point
NOP
LD *INBUF_P,A
CALL fir
STH A,*OUTBUF_P+%
STH A,*OUTBUF
main_end:
b fir_loop

fir:
; SSBX SXM
; SSBX FRCT
STM #d_data_buffer,FIR_DATA_P
STL A,*FIR_DATA_P
STM #d_data_buffer+K_FIR_BFFR-1,FIR_DATA_P

fir_task:
RPTZ A,#K_FIR_BFFR-1
MACD *FIR_DATA_P-,COFF_FIR_START,A
RET
.end

CMD文件
MEMORY
{
PAGE 0:
PROG: o= 100h,l= 2000h
PAGE 1:
DATA1: o= 2600h, l= 1000h
DATA2: o= 2100h, l= 100h
DATA3: o= 2200h, l= 100h
DATA4: o= 2300h, l= 100h
DATA5: o= 2400h, l= 100h
DATA6: o= 2500h, l= 100h
}
SECTIONS
{
coff_fir : {}> PROG PAGE 0
fir_prog : {}> PROG PAGE 0
fir_vars : {}> DATA1 PAGE 1
fir_coff : {}> DATA2 PAGE 1
fir_bfr : {}> DATA3 PAGE 1
}