网站公告列表

  没有公告

加入收藏
设为首页
联系站长
您现在的位置: 61IC中国电子在线 >> DSP >> 代码示例 >> TI DSP代码示例 >> C5000 >> 文章正文
  汇编代码:C54x的自适应滤波器(LMS)的实现         ★★★ 【字体:
汇编代码:C54x的自适应滤波器(LMS)的实现
作者:61IC    文章来源:本站原创    点击数:    更新时间:2007-1-17    

;************************************************************************
daptive filter using the LMS instruction                     *
*
;************************************************************************
        .mmregs
 .def begin, N, Beta

N .set 16  ; the LMS adaptive filter will have N taps
REF .set 300h  ; Reference chanel port address
IN .set 100h  ; Input chanel port address
OUT .set 200h  ; Output chanel port address

COUNT .set 2000  ; process .250 seconds of data


REFERENCE    .usect "REF", N        ; allocate space for ref buffer
COEFFICIENTS .usect "FILTER", N     ; allocate space for adaptive filter

 .bss ERROR, 3, 1 ; make sure that these vars on same page
Beta .set ERROR + 1 ; beta is a variable so it can be changed
    ; during processing
INPUT .set ERROR + 2


 .sect  "vectors"        ; set up a reset vector
  B     begin

        .text
        NOP
begin   SSBX    SXM             ; sign extention is on
 SSBX FRCT  ; We are performing Q15*Q15 mult.
    ; Need left shift of one so
    ; Q31 is in accumulator. Turn FRCT on.
 RSBX OVM  ; let the accumulator over flow

 LD #ERROR, DP ; set up data page
 STM #INPUT, AR5 ;
 STM #REFERENCE, AR4 ;
 STM #COUNT, AR6 ; loop counter

 ST #300, Beta ; Beta can be changed during processing
    ; Beta is initialized to .009
 STM #N, BK  ; set the circular buffer size register
 STM #1, AR0  ; load index increment value

LOOP
 STM #COEFFICIENTS, AR3
ADAPT
 LD #0, B  ; clear B
 STM #N-2, BRC ; We will do one tap before start of rptb
 LD ERROR, T ; error(0) = Beta*error(-1)
 RPTBD LMS_END-1
  MPY *AR4, A  ; A = error(-1)*x(-n)
    ; note: past error is used for update
  LMS *AR3, *AR4+0% ; A = A + *AR3<<16 + 2^15
    ; B = B + *AR3 x *AR4

   ST A, *AR3+ ; save filter coefficient
   ||MPY *AR4, A  ; error(-1) * x(-(n-1))
    ; note: past error is used for update
   LMS *AR3, *AR4+0% ; A = A + *AR3<<16 + 2^15
    ; B = B + *AR3 x *AR4

LMS_END
 ST A, *AR3  ; finish up last coefficient update
 ||SUB *AR5, A  ; A = (*AR5)<<16 - B,  the new error
 STH A, ERROR ; save the new error

 PORTW ERROR, OUT ; output the error signal

 LD Beta, T  ; Update the error
 MPY ERROR, A ; A = ERROR(0)*Beta
 STH A, ERROR

 PORTR IN, *AR5 ; EC on this input signal

 BANZD LOOP, *AR6- ;
  PORTR REF, *AR4+0% ; reference signal read

; BANZ takes effect here


DONE B DONE  ; processing complete

        .end

               欢迎点击进入:TI德州中文网   (国内唯一针对TI应用的中文技术网站)    文章录入:admin    责任编辑:admin 
  • 上一篇文章:

  • 下一篇文章:
  • 发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
    最新热点 最新推荐 相关文章
    关于TMS320VC5509笔记文件
    C54X的自适应滤波器(LMS)的汇…
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
    站长:61IC 湘ICP备05002478号