Page 1 of 1

biquad filters from dsplib.h

Posted: Fri 2011-10-28 20:38
by Ord
Hi,

I have been having a hard time to use the DspIir2Lq function from dsplib.

I notice that the header definition shows it returns s_int32, but when I look at the dis-assembly of my program it seems to return only a 16 bit value in A0, so I cast it to a s_int16.

I am calling it like this:

Code: Select all

// declare variables
s_int16 mem[5];
__y struct DSP_IIR2COEFF16 cf;

// setup coefficients for unity gain, no filter
		cf.b0 = 8191;
		cf.b1 = 0;
		cf.b2 = 0;
		cf.a1 = 0;
		cf.a2 = 0;

// then in the loop for processing samples:
lr[0] = (s_int16)DspIir2Lq(lr[0],&cf,mem);
Do I miss something?

Thanks!

Re: biquad filters from dsplib.h

Posted: Fri 2020-02-21 12:36
by pasi
A very late reply: yes, the return type should be s_int16. Usually the return value is assigned to a s_int16 variable, so it doesn't matter.