Average Values and digital filter ...


Closed Thread
Results 1 to 12 of 12

Hybrid View

  1. #1
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    For Temperature A2D (0-1023), a favorite of mine if T changes are gradual and code space is a premium...

    pseudo-recursive filter (similar to Darrel's except without the smarts)
    Code:
    A2D var word
    AVE var word
    
    Main:
    
    ' Get new A2D value
    A2D = new A2D Value 
    
    ' Smooth data
    Ave = ((((AVE<<1)+AVE)<<1)+AVE+A2D)>>3  'AVE = (7*AVE + A2D) /8
    
    ' More stuff here if you want
    
    Goto Main
    depending on the smoothing required, you can adjust and change the 7 & 8 in the AVE equation to 15 & 16, 3 & 4, etc., depending on what you need in the way of filtering
    Paul Borgmeier
    Salt Lake City, UT
    USA
    __________________

  2. #2
    Join Date
    Nov 2004
    Posts
    25


    Did you find this post helpful? Yes | No

    Default thanks to all...

    ...as always you have helped me in finding the path, thanks for your precious time and for your hints !
    Darrel´s solution (really good) and the this last one (Paul´s) are on the spot...
    Thanks again !
    regards, Jorge

  3. #3
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Hey jorge,

    Hope it works out for you.
    The only thing it's missing is hysterisis. No matter how much you average, there's always a point where the reading bounces back and forth between two digits.

    To illiminate that "wobble", I added some hysterisis to the averaging routine and posted them a couple times ...

    http://www.picbasic.co.uk/forum/showthread.php?p=13267

    Never did get a response, but I've used them myself since then so at least now I can say that they do work.

    HTH,
    DT

Similar Threads

  1. Funny PULSIN values: what is going on???
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 30th April 2008, 08:02
  2. 16F877A problem: "coupled" digital values
    By Lupo83 in forum General
    Replies: 16
    Last Post: - 4th December 2007, 12:46
  3. 2nd Order Digital Filter for 24-bit
    By sefayil in forum mel PIC BASIC
    Replies: 0
    Last Post: - 2nd December 2005, 21:55
  4. digital filter
    By yasser hassani in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 15th September 2004, 01:28
  5. implementig digital filter and my problems????????
    By yasser hassani in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 2nd June 2004, 18:06

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts