Low Pass Filter Question
I am porting this from Arduino. I have watched at least 20 You tube videos about the subject and I am still a little confused. I am not getting the correct data. I think that the coefficients are wrong for use with the propeller as it runs way faster than the Arduino. I don't have mathlab so I can't really figure out the coefficients.
On setting the return I have tried >> 15, SAR 15 and divide by 32768. None seem to work.
PUB lowPassFIRFilter(din): result | z, i cbuf[offset] := din z := mul16(FIRCoeffs, cbuf[(offset - 11) & $1F]) i:= 0 repeat while i < 11 z += mul16(FIRCoeffs[i], cbuf[(offset - i) & $1F] + cbuf[(offset - 22 + i) & $1F]) i++ offset++ offset //= 32 'Wrap condition return result := (z >> 15) ' Integer multiplier PUB mul16(x, y): result return result := (x * y) DAT FIRCoeffs long 172, 321, 579, 927, 1360, 1858, 2390, 2916, 3391, 3768, 4012, 4096