主频80MHZ,晶振20MHZ,定时125us,4阶滤波器,0.1,0.2,-0.1,-0.2,端口4进8出实现:
asm程序
.title "FIR.asm"
.mmregs
.def _c_int00
STACK .usect "stk",10H
.sect "vectors"
x .usect "x",4
h .usect "h",4
.bss y,1
PA4 .set 4
PA8 .set 8
.data
table .word 1*32768/10
.word 2*32768/10
.word -1*32768/10
.word -2*32768/10
.text
_c_int00: LD #0006h,DP
STM #STACK+10H,SP
SSBX INTM
RSBX SXM
STM #0825H,PMST
STM #0669H,TCR
STM #3007H,CLKMD
STM #999,PRD
STM #008H,IMR
STM #0FFFH,IFR
SSBX FRCT
STM #h,AR2
RPT #3
MVPD table,*AR2+
STM #y,AR5
STM #x+3,AR1
STM #h+3,AR2
STM #3,AR0
STM #x,AR4
FIR: PORTR PA4,*AR3
LD *AR1-,T
MPY *AR2-,A ;4
LTD *AR1-
MAC *AR2-,A ;3
LTD *AR1-
MAC *AR2-,A ;2
LTD *AR1+0
MAC *AR2+0,A ;1
STH A,*AR5
PORTW *AR5,PA8
RETE
loop: B loop
B _c_int00
nop
nop
NMT rete
nop
nop
nop
SINT17 .space 4*14*16
TIN0: rsbx intm
rete
NOP
NOP
.space 4*18*16
TINT: B FIR
nop
nop
.end
cmd文件
MEMORY
{PAGE 0: VECS: origin=0800H,length=0500H
PROG: origin=1600H,length=0500H
DATA: origin=2400H,length=0500H
PAGE 1: BSS: origin=0300H,length=0200H
XSPACE: origin=0500H,length=0010H
HSPACE: origin=0510H,length=0010H
STACK: origin=0600H,length=0500H
}
SECTIONS
{ .data :>DATA PAGE 0
.text :>PROG PAGE 0
vector :>VECS PAGE 0
.bss :>BSS PAGE 1
x :>XSPACE PAGE 1
h :>HSPACE PAGE 1
.stk :>STACK PAGE 1
}
实验现象:
波形:
评论 (1)