ADCIN signal conditioning?


Closed Thread
Results 1 to 12 of 12

Hybrid View

  1. #1
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    You could try Darrel's averaging include file.

    http://sites.picbasic.net/index.php?...d=70&pageid=25

  2. #2
    Join Date
    Nov 2004
    Location
    Calabasas, CA
    Posts
    84


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by scalerobotics View Post
    You could try Darrel's averaging include file.

    http://sites.picbasic.net/index.php?...d=70&pageid=25
    Thanks,
    I'll have a look see.
    James

  3. #3
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    If your value goes to zero, there is something more wrong than a little noise. I have found some chips that don't work properly with ADCIN (18F2221 for example).

    Try the following:

    Code:
    Result = 0
    Channel = 1                     ; Whichever 
    Channel = Channel << 3   ; offset the bits
    
    ADCON0 = %11000001 | Channel  ; OR the channel into the reg.
    
    For X = 0 to 9
    
    PAUSEUS 10
    ADCON0.2 = 1     ; Start conversion
    PAUSEUS 2         ; Guarantee min time
    WHILE ADCON0.2:WEND   ; Wait until done
    Result = Result + ADRES
    Next X
    
    Result = Result/10
    Result is, of course, a WORD var
    Charles Linquist

  4. #4
    Join Date
    Nov 2004
    Location
    Calabasas, CA
    Posts
    84


    Did you find this post helpful? Yes | No

    Default

    Charles,

    This sensor pulses hi to low. I suspect some of my sampling is reading on the low part of the cycle. Thats why I slowed way down the sampling time to 20ms.

    ADC has worked well for me on this PIC.

    I will look at your subr.

    Thanks
    James

  5. #5
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by droptail View Post
    Charles,

    This sensor pulses hi to low. I suspect some of my sampling is reading on the low part of the cycle. Thats why I slowed way down the sampling time to 20ms.
    An analog sensor that pulses high to low? I don't understand. What sensor are you using.
    Charles Linquist

  6. #6
    Join Date
    Nov 2004
    Location
    Calabasas, CA
    Posts
    84


    Did you find this post helpful? Yes | No

    Default changing to PULSIN

    I am getting better results using PULSIN since the sensor is pulsing as stated before.
    I still need to condition the results, however.
    James

  7. #7
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    You mean that you weren't concerned with the analog level of the signal at all? Only its duration?
    Charles Linquist

Members who have read this thread : 0

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

Tags for this Thread

Posting Permissions

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