Strange ADC behaviour


Results 1 to 29 of 29

Threaded View

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


    Did you find this post helpful? Yes | No

    Default

    Mine did some averaging, not much. Read the sensor couple of time (10-16 times) then calculate the average of it, go to next channel, do the same, show the results.

    I did it the 'bad' way
    Code:
            for loopw = 0 to 15
                ADCIN 0, TEMPW
                VA1=VA1 + (TEMPW>>4)
                NEXT
                
            pause 500
            
            FOR LOOPW=0 TO 15
                ADCIN 1, TEMPW
                VA2=VA2 + (TEMPW>>4)
                NEXT
    lost of precision and so on, now for something better, have a look at Darrel's routine.

    Averaging 16 bit values without using 32 bit math?
    http://www.pbpgroup.com/modules/wfse...hp?articleid=7
    Last edited by mister_e; - 9th December 2007 at 17:29.
    Steve

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

Similar Threads

  1. Strange Behaviour - Simple code+DT_INT+16F676
    By financecatalyst in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 17th February 2010, 18:53
  2. Strange behaviour of my PBP code.
    By Fredrick in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 24th August 2009, 20:20
  3. Strange Serout Behaviour
    By bluesmoke in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 12th August 2009, 04:12
  4. Strange behaviour from PIC16F877 on TMR0
    By mikebar in forum mel PIC BASIC Pro
    Replies: 18
    Last Post: - 19th August 2006, 01:31
  5. strange int behaviour
    By tom in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 17th November 2005, 15:41

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