Searching \ for '[PIC] Proportional (of PID) vs. hardware filtering' in subject line. ()
Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/math/filter.htm?key=filter
Search entire site for: 'Proportional (of PID) vs. hardware filtering'.

Exact match. Not showing close matches.
'[PIC] Proportional (of PID) vs. hardware filtering'
2005\05\12@132412 by

On 5/12/05, PicDude <picdude2narwani.org> wrote:
> Finally got around to implementing/trying some proportional filtering [
> N=N+(N-L)*K ] in one of my pieces of PIC code (which is essentially a
> frequency counter).  This thing is sweet!  I've experimented with K=1/4, 1/2,
> and 3/4.  For my app, 3/4 works well (but I still have a bit of averaging in
> there still, since I'm experimenting with combinations of averaging and
> proportional filtering).
>

What is 'L'?

I've done simple IIR low-pass filtering like this:

N1=N*(K-1)+N0*K

Where N1 is output, N is input, and N0 is last input.

Regards,
Mark
markrages@gmail

--
You think that it is a secret, but it never has been one.

On 5/12/05, Mark Rages <markragesgmail.com> wrote:
> I've done simple IIR low-pass filtering like this:
>
> N1=N*(K-1)+N0*K
>

Oops, should be 1-K, so:

N1=N*(1-K)+N0*K

Regards,
Mark
markrages@gmail
--
You think that it is a secret, but it never has been one.

L = Last result (Which is N0 in your formula below).

I was pushing this off fearing a nightmare of assembly code, but it was
actually quite easy once I plotted out my calcs on paper while waiting on an
oil change.

Cheers,
-Neil.

On Thursday 12 May 2005 12:24 pm, Mark Rages scribbled:
{Quote hidden}

Mark Rages wrote:
> N1=N*(K-1)+N0*K

Huh again?  This looks more like a ring generator with exponential decay.
C'mon folks.  The correct algorithm really isn't that hard:

FILT <-- FILT + FF(NEW - FILT)

This can be evolved into something like the form above, but you'd have to
change K-1 to 1-K to make it right.

*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com
On 5/12/05, Olin Lathrop <olin_piclistembedinc.com> wrote:
> > Curious about one thing though -- anyone have a correlation or
> > calculation to compare software proportional filtering to an RC filter?
>
> I use my FILTBITS program followed by CSVPLOT to show the step response of a
> filter.  You type in the bit shift amount for each filter pole, and it makes
> a plot.  For example, the attached plot is of a 3 pole filter with 4 bits of
> shift (FF = 1/16 in my filter equation, FF may be what you intended K to be)
> per pole.

When you say poles here, do you actually cascade the simple IIR under
discussion or do you use an "unrolled" equation?  I hadn't realized
that it would be useful to cascade this filter.  Do you have your
FILTBITS program available somewhere?  I couldn't find it on Embedinc.

Also what is your mnemonic for FF?  I would normally use K and can
only think of feed-forward or fast Fourier for FF...

> My MPASM preprocessor also has built in functions for computing filter
> fraction values given the iteration frequency and either the -3dB rolloff
> frequency or the 1/2 step response time.  See the FFTC2 and FFFREQ built in
> functions.  The preprocessor, PREPIC, is described at
> http://www.embedinc.com/pic.

You have a man page, but do you release the source code for PREPIC?

Thanks

part 1 1032 bytes content-type:text/plain; (decoded 7bit)

> When you say poles here, do you actually cascade the simple IIR under
> discussion or do you use an "unrolled" equation?

I don't think there is a clever way to combine two poles to save operations
when all you want the the output of the second filter stage.

> that it would be useful to cascade this filter.  Do you have your
> FILTBITS program available somewhere?  I couldn't find it on Embedinc.

I thought it was in the PIC development environment, but I just checked and
it isn't.  Maybe I'll add it this weekend if I remember.

> Also what is your mnemonic for FF?

Filter Fraction.

> You have a man page, but do you release the source code for PREPIC?

The current release of the PIC development environment contains the
documentation file and the executable only.  I have attached a ZIP file
containint the source that evaluates the inline functions, which include the
two that compute the filter fractions.

part 2 4565 bytes content-type:application/x-zip-compressed; (decode)

part 3 35 bytes content-type:text/plain; charset="us-ascii"
(decoded 7bit)

More... (looser matching)
- Last day of these posts
- In 2005 , 2006 only
- Today
- New search...