On Thu, Aug 12, 2010 at 7:58 AM, Olin Lathrop w= rote: > To complete the analisys back to your original equation, remember that we > changed the definition of the arbitrary constant twice. =A0First K was > substituted for PARAM+1, then FF for 1/K. =A0Therefore > > =A0 =A0 =A0 =A0 =A0 1 > =A0FF =3D --------- > =A0 =A0 =A0 PARAM + 1 > > So if you insist on thinking in terms of PARAM, you can convert it to FF > at build time since it's a constant. > > In any case, you should now be able to easily implement a low pass filter > on a digital processor. =A0I do this routinely for most real world measur= ed > values. =A0It's usually useful to sample a analog data stream more quickl= y > than necessary, then apply a couple of poles or so of low pass filtering > as shown here. =A0Note that when FF =3D 1 / 2**N, that the multiply by FF= can > be accomplished by a right shift of N bits. =A0This makes low pass filter= ing > tractable even on small processors without multiply hardware, like a PIC > 16. Hm, as long as you are making an exhaustive post, you should mention the drawbacks of na=EFve implementation of this. When looking at the steady-state response, the output will never get closer than 2**N to the input., because when the difference is less than that, the result of the right shift is zero. The way around this is to scale up the input and accumulator values, so instead of FILT <-- FILT + FF(NEW - FILT) you define a multiplier M and a wider accumulator FILTW: FILTW <-- FILTW + FF(NEW*M - FILTW), FILT=3DFILTW/M M needs to be bigger than 2**N. Practically, M should also be a power of two. (in an 8-bit processor, M=3D256 and 16-bit wide FILTW makes a lot of sense, because the multiplies and divides are accomplished by choosing the appropriate byte from the result) Regards, Mark markrages@gmail --=20 Mark Rages, Engineer Midwest Telecine LLC markrages@midwesttelecine.com --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .