{ main program for calling real IIR filter input, output from DM ports using Timer to create sampling interval follows example system described in ADSP-21020 Users Manual "iirirq.asm" (requires files "def21020.h", "iircoefs.dat") Analog Devices, Inc. DSP Applications P.O.Box 9106 Norwood, MA 02062 Christoph D. Cavigioli ... 25-Apr-1991 } #include "def21020.h" { bit placements in ADSP-21020 system registers } #define SAMPLES 300 #define SECTIONS 3 .EXTERN cascaded_biquad, cascaded_biquad_init; .GLOBAL coefs, dline; .PRECISION = 40; .ROUND_NEAREST; .SEGMENT /DM dm_bank0; { selected by DMS0~ } .VAR dline[SECTIONS*2]; { filter delay line thus: } .ENDSEG; { w``, w`, NEXT w``, NEXT w`, ... } .SEGMENT /DM dm_bank1; { selected by DMS1~ } .VAR in_channel; { memory-mapped I/O port } .ENDSEG; .SEGMENT /DM dm_bank2; { selected by DMS2~ } .VAR out_channel; { memory-mapped I/O port } .ENDSEG; .SEGMENT /PM pm_bank1; { selected by PMS1~ } .VAR coefs[SECTIONS*4]="iircoefs.dat"; { a12,a11,b12,b11,a22,a21,... } .ENDSEG; .SEGMENT /PM rst_svc; { processor RESET service } jump begin; .ENDSEG; .SEGMENT /PM tmzh_svc; { Interval Timer interrupt service } jump new_sample; .ENDSEG; .SEGMENT /PM pm_code; { selected by PMS0~ } {--- initial setup ---} begin: pmwait = 0x0021; { RAM = zero wait states } dmwait = 0xc401; { RAM = zero wait states in_channel = ext. hardware ACK out_channel = 5 automatic waits } pmbank1=0x000800; { first address of pm bank 1 (PMS1~) } dmbank1=0x00001000; { first address of dm bank 1 (DMS1~) } dmbank2=0x00002000; { first address of dm bank 2 (DMS2~) } l0=0; l1=0; l8=0; m1=1; m8=1; call cascaded_biquad_init (db); { zero the delay line } r0=SECTIONS; b0=dline; tperiod=199; { 100 kHz sampling when CLKIN=20.0 MHz} tcount=199; bit set imask TMZHI; { allow interval timer interrupts } bit set mode2 TIMEN; { turn on the interval timer } bit set irptl 0; { RESET doesn`t clear this, you do! } bit set mode1 IRPTEN; { allow interrupts } {--- main processing loop ---} wait: idle; { wait for interrupts indefinitely } jump wait; { after rti, go wait for more } {--- interrupt service routine which does the filtering ---} new_sample: f8=dm(in_channel); { simulate this channel with a file } call cascaded_biquad (db); { input=F8, output=F8 } b0=dline; b8=coefs; rti (db); dm(out_channel)=f8; { simulate this channel with a file } nop; .ENDSEG;