Implementing IIR/FIR Filters
Implementing IIR/FIR Filters
Implementing IIR/FIR Filters
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
1 COEFF ident 1,0<br />
2 include 'head2.asm'<br />
3<br />
4 page 132, 66, 0,10<br />
5 pt cex, mex<br />
6<br />
7 ; This program implements an <strong>IIR</strong> filter in cascaded canonic sections<br />
8 ; The coefficients of each section are scaled for cascaded canonic sections<br />
9<br />
10<br />
11 00FFFF datin equ $ffff ;location in Y memory of input file<br />
12 00FFFF datout equ $ffff ;location in Y memory of output file<br />
13 00FFF0 m_scr equ $fff0 ;sci control register<br />
14 00FFF1 m_ssr equ $fff1 ;sci status register<br />
15 00FFF2 m_sccr equ $fff2 ;sci clock control register<br />
16 00FFE1 m_pcc equ $ffe1 ;port c control register<br />
17 00FFFF m_ipr equ $ffff ;interrupt priority register<br />
18 000140 xx equ @cvi(20480/64*1.000)) ;timer interrupt value<br />
19 FFD8F1 m_tim equ -9999 ;board timer interrupt value<br />
20 000003 nsec equ 3 ;number of second order sectiona<br />
21 include 'cascade2.asm'<br />
22 ;<br />
23 ; This code segment implements cascaded biquad sections in canonic form<br />
24 ;<br />
25<br />
26 cascade2 macro nsec<br />
27 m ;<br />
28 m ;assumes each section's coefficients are divided by 2<br />
29 m<br />
30 m mpy y0,y1,a x:(r0)+,y0 y:(r4)+,y0 ;x0=1st section w(n-2),y0=a12/2<br />
31 m do #nsec,_ends ;do each section<br />
32 m mac x0,y0,a x:(r0)-,x1 y:(r4)+,y0 ;x1=w(n-1) ,y0=ai1/2<br />
33 m macr x1,y0,a x1,x:(r0)+ y:(r4)+,y0 ;push w(n-1) to w(n-2),y0=bi2/2<br />
34 m mac x0,y0,a a,x:(r0) y:(r4)+,y0 ;push w(n) to w(n-1),y0=bi1/2<br />
35 m mac x1,y0,a x:(r0)+,x0 y:(r4)+,y0 ;get this iter w(n),y0=bi0/2<br />
36 m mac x0,y0,a x:(r0)+,x0 y:(r4)+,y0 ;next iter:x0=w(n-2),y0=ai2/2<br />
37 m _ends<br />
38 m endm<br />
Figure 6-7 COEFF.ASM File Generated by MGEN for Example Design andCascaded Canonic<br />
Implementation (Sheet 1 of 4)<br />
6-10 MOTOROLA