Need help on ADC : Software R/C filter


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    May 2007
    Location
    Area 71
    Posts
    52

    Default Need help on ADC : Software R/C filter

    Instead of hardware R/C filer to delay ACD input, is it possible to do it with PBP ?

  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,025


    Did you find this post helpful? Yes | No

    Default

    Depends on what you need.

    FFT, Sorting and Average, DSP are some ideas.

    What is your application?

    What is your PIC?

    What is your data to filter?

    Maybe also your current program?

    Ioannis

  3. #3
    Join Date
    May 2007
    Location
    Area 71
    Posts
    52


    Did you find this post helpful? Yes | No

    Default

    Hi Ioannis,
    My application is simple, it just read the potentiometer / analog pins and then output the pulse accordingly.
    Usually I put a hardware RC filter between the pots and the pins. It serves as delay



    Code:
    'PIC 12F683
    
    OSCCON = $60                    ' Internal oscillator frequency 4 Mhz
           
            
    TRISIO = %00000011              ' Set TRIS to all input
    ANSEL = %00000011               ' Analog channel RA0 & RA1
    ADCON0= %00000000               ' VDD as VREF
    CMCON0 = 7
    DEFINE ADC_BITS 8               ' ADC resolution 8 bit
    DEFINE ADC_CLOCK 1              ' Set clock source (rc = 1)
    DEFINE ADC_SAMPLEUS 11          ' Sampling time 11ms
    
    anpin0 CON 0                 ' Analog port pin RA.0
    anpin0val VAR byte            ' Value digital 0 - 255 
    
    
    anpin1 CON 1                 ' Analog port pin RA.1
    anpin1val VAR byte             ' Value digital 0- 255
    
    
    PAUSE 1000
    
    LOOP:
    
    adcin anpin0,anpin0val
    adcin anpin1,anpin1val
    
    pulsout porta.4,anpin0val
    pulsout porta.5,anpin1val
    
    
    pause 10
    
    
    goto loop
    Last edited by luminas; - 27th November 2010 at 15:02.

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,576


    Did you find this post helpful? Yes | No

    Default

    Hi,
    The great Tracey Allen has a couple of filter routines here. Make sure you read thry the explaination as it describes how to alter the timeconstant etc. Then there's Darrels averaging routine which might be interesting as well.

    /Henrik.

Members who have read this thread : 0

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