Searching \ for 'Digital filtering on PIC's ?' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/math/filter.htm?key=filter
Search entire site for: 'Digital filtering on PIC's ?'.

Truncated match.
PICList Thread
'Digital filtering on PIC's ?'
2000\05\11@230352 by Kbek Tony

flavicon
face
Hi,
I have an recursive moving average filter,
52 points with 3 bytes each, which works ok.
However the ram usage is 'a bit' high :-)
( almost the entire two top ram banks on my 16f876, )

Are there any other, more space conservatory, techniques
one could use to accomplish the same filtering ?

I do have 24 bit's of data for each sample, ofcource
not all bit's will change from one sample to next. But
was thinking of implementing an variable window ( 8 - 56 samples )
moving average filter to have an faster step-responce.
( big step = small window, little step = big window,
adjust automaticlly )

This however will not affect the ram usage, but also
was thinking about only saving the difference in successive
samples ( maybe 1.5 - 2 bytes ) and if difference is more
'reset' filter ( make the window very small ) until once
again the samples are in range. But think that this might
require quite abit of code to accomplish.

Good vs. bad ?

Anyone have any ideas ? or expirience with this ?


Thanks in advance,


/Tony










Tony KŸbek, Flintab AB            
ÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓ
E-mail: spam_OUTtony.kubekTakeThisOuTspamflintab.com
ÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓ

2000\05\11@235440 by Plunkett, Dennis

flavicon
face
12/5/2000


       This depends on what the actual data is to represent and the
procesing time that you have for each sample. If you have time, then you
could look at each sample as a delta function on change from the last. This
could means that if the data is converted to 4 bits (this can even be done
by breaking up the sample into nybbles), and then apply the filter function
to each with the required weighting. Of course this will make the filter run
three times longer but save 2/3s the RAM.


Dennis



> {Original Message removed}

2000\05\12@004749 by Andrew Warren

face
flavicon
face
KŸbek Tony <.....PICLISTKILLspamspam@spam@MITVMA.MIT.EDU> wrote:

> I have an recursive moving average filter, 52 points with 3 bytes
> each, which works ok. However the ram usage is 'a bit' high :-) (
> almost the entire two top ram banks on my 16f876, )
>
> Are there any other, more space conservatory, techniques one could
> use to accomplish the same filtering ?

Tony:

The usual way to solve this problem is this:

   TEMP = AVERAGE * WIDTH
   TEMP = TEMP - AVERAGE
   TEMP = TEMP + NEW_SAMPLE
   AVERAGE = TEMP/WIDTH

If you do it that way, you need only enough storage for TEMP,
AVERAGE, and your NEW_SAMPLE.  If you set WIDTH to a power of 2, the
multiplication and division become trivial; if you pick a value of
256, the multiplications and divisions don't even require any code.

-Andy


=== Andrew Warren - fastfwdspamKILLspamix.netcom.com
=== Fast Forward Engineering - San Diego, California
=== http://www.geocities.com/SiliconValley/2499

2000\05\12@012229 by Erik Reikes

flavicon
face
At 09:28 PM 5/11/00 -0700, you wrote:
>KŸbek Tony <.....PICLISTKILLspamspam.....MITVMA.MIT.EDU> wrote:
>
>> I have an recursive moving average filter, 52 points with 3 bytes
>> each, which works ok. However the ram usage is 'a bit' high :-) (
>> almost the entire two top ram banks on my 16f876, )
>>
>> Are there any other, more space conservatory, techniques one could
>> use to accomplish the same filtering ?

It sounds like you have implemented an FIR filter with 52 taps.

What Andy has suggested is an IIR.  You can plug both of these into matlab
and compare the filter responses to see if the IIR is adequate.  

I forget the exact transfer functions for both, but any introductory DSP or
linear systems book will have them in there.



{Quote hidden}

Erik Reikes
Senior Software Engineer
Xsilogy, Inc.

ereikesspamspam_OUTxsilogy.com
ph : (858) 535-5113
fax : (858) 535-5163
cell : (858) 663-1206

2000\05\12@042827 by Kbek Tony
flavicon
face
Thanks to all who responded, I will whip up Matlab
and se what effect will come of the FIR vs. IIR filters.
If it has the filtering/freq responce(damping) I need
then one could not comlain about ram usage :-) .


Dennis wrote:
>This depends on what the actual data is to represent and the
>procesing time that you have for each sample. If you have time, then
you

Data is from an AD7730 ( Transducer ADC ) measuring on strain gauges
in 2mV/V range. 5V AC to feed the brigde, will give me at most
10mV->24Bits
input signal. Aiming for, at least, 1uV verifiable resolution.
I want to cater for both high filtering application
where data output should be very stable but also applications where
a fast step-responce is crucial ( thats why the variable window idea ).
And yes I have quite a bit of 'free' time, I dont think data processing
time would pose as a problem.
( I'm more concerned over ram usage :-) )

All in all fun stuff...


/Tony






Tony KŸbek, Flintab AB            
ÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓ
E-mail: @spam@tony.kubekKILLspamspamflintab.com
ÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓ

2000\05\12@080546 by Morgan Olsson

picon face
KŸbek Tony wrote:
>measuring on strain gauges
>in 2mV/V range. 5V AC to feed the brigde

Curious: Why AC to the bridge?

/Morgan

2000\05\12@092329 by Bennett, Matt

flavicon
face
> From: KŸbek Tony
>
> Thanks to all who responded, I will whip up Matlab
> and se what effect will come of the FIR vs. IIR filters.
> If it has the filtering/freq responce(damping) I need
> then one could not comlain about ram usage :-) .

A couple of things to take into account with digital filters:  While FIR
filters are more memory and computationally intensive, they do have one
great advantage, they are universally stable- no matter what, if you have a
filter that is N taps long, no input more than N+1 delays ago will affect
the output.  IIR (*Infinite* Impulse Response) filters have no such bound.
IIR filters can have stability problems (meaning that it may oscillate after
an input, possibly out of control).  In a system like a PIC where you are
most likely to use fixed point math, you must be much more careful in
implementing the filter and studying the effects of quantization, sampling
rate, and a limited dynamic range on your filter.  Doing your analysis in
Matlab can give you a false sense of security, unless you build these things
into your model.

Bang for the byte- IIR is best, but sometimes, an IIR will misfire.

Matt Bennett

2000\05\12@203322 by picxpert

picon face
Ooh! Ooh! There's one available online for free:

http://www.dspguide.com/

-Randy Glenn
KILLspamPICxpertANTISPAMKILLspamspamtechie.com (remove ANTISPAM)
http://i.am/PICxpert

"My Finder has died of fits, chokin',
My Finder has quite ceased to be.
OS X's new Finder looks broken,
Please bring back my Finder to me!" - A concerned Mac user

===========
To unsubscribe, send a message containing the text "unsubscribe PICLIST" to
RemoveMELISTSERVTakeThisOuTspamMITVMA.MIT.EDU

Any questions about the list? http://www.piclist.com/

{Original Message removed}

2000\05\13@111046 by Kbek Tony

flavicon
face
>Curious: Why AC to the bridge?
>/Morgan

:-) , why not ?

Just kidding, the AD7730 can drive an brigde in AC-mode
where the excitation ( DC ) for the bridge is reversed
on alternate cycles hence the term 'AC'. This will 'elliminate'
thermocouple, offset and drift effects that one has in DC mode.
I.e. illiminate most DC errors.
Just a tad more complex system but much better performance.
( the only drawback is the settling time for the input after
the swithing, but even that is easily handled, for example
the AD7730 has an delay register to cater for this )
Optionally I will also drive the bridge with 10V ( +7.5 - -2.5 ) to get
more input.



/Tony



Tony KŸbek, Flintab AB            
ÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓ
E-mail: spamBeGonetony.kubekspamBeGonespamflintab.com
ÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓ

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