Atod Digital Filter


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2006
    Location
    Arvada Colorado
    Posts
    31

    Default Atod Digital Filter

    Hi all,
    I'm trying to digitally filter a noisy adcin value.
    Here is what I've tried.
    adcin 4, current ' INITIALIZE CURRENT MEASUREMENT FILTER
    CURRENT1 = CURRENT1 - CURRENT1 >> 6
    CURRENT1 = CURRENT1 + CURRENT
    CURRENT = CURRENT1 + CURRENT

    I expect this to give me an RC filter equivalent measurement with a time constant based on the clock and measurement frequency. I already have RC filter hardware in the circuit that works pretty good, but the measurement is still not very stable. I am measuring an amplified current sense ic output for a buck converter. The current measured with a current probe on a o-scope shows about 1 amp ripple.

    Without the filter code the reading jumps about +/- 25 points (Decimal ATOD value displayed on an LCD.) With the filter and no current running to measure at all the value is decimal 400!


    Any suggestions on a better filter algorythm?

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Have you tried putting a capacitor from the ADC in pin to ground? 22uf or larger. Might be easier than doing it in software.

    Then after that do an average routine.

    ADC_AVG = ADC_AVG + ADCIN
    maybe five times in a for/next loop. Then divide ADC_AVG by five.
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Schematic and the WHOLE code would help.

    and this one...
    Code:
    CURRENT1 = CURRENT1 - CURRENT1 >> 6
    not sure how it will be processed...
    Code:
    CURRENT1 = CURRENT1 - (CURRENT1 >> 6)
    could be better.

    What's the initial value of CURRENT1?

    Darrel did some nice average routine, maybe you want to have a look at it?
    http://www.pbpgroup.com/modules/wfse...hp?articleid=7
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4
    Join Date
    Feb 2006
    Location
    Arvada Colorado
    Posts
    31


    Did you find this post helpful? Yes | No

    Default Thanks

    CURRENT1 = CURRENT1 - CURRENT1 >> 6
    Works great. Seems so clear now.

Similar Threads

  1. Average Values and digital filter ...
    By jorge in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 24th April 2010, 12:29
  2. 2nd Order Digital Filter for 24-bit
    By sefayil in forum mel PIC BASIC
    Replies: 0
    Last Post: - 2nd December 2005, 21:55
  3. digital filter
    By yasser hassani in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 15th September 2004, 01:28
  4. implementig digital filter and my problems????????
    By yasser hassani in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 2nd June 2004, 18:06
  5. digital filter with pic16f877
    By yasser hassani in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 30th April 2004, 03:51

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