Stable ADC readings


Closed Thread
Results 1 to 40 of 91

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default Re: Stable ADC readings

    3902 is actually 39K, so the other resistor are also bad... ok then. So be it.

    modify what's in red
    Code:
    '
    '       Software Variable
    '       =================
            ADRes       VAR WORD    ' ADC Reading
            BTN         var byte    ' Data to be sent to PORTB
            i           VAR BYTE    '
            ADCChannel  VAR BIT     '
            ADCButton   VAR WORD [3]'
    '
    '       Software constant
    '       =================
            ADCSafety   CON 10              ' min/max range for ADC Reading
                                            '
            ADCNone     CON 814 - ADCSafety ' 
            ADCButton[0]  = 90              ' button 1 or 4 
            ADCButton[1]  = 164             ' button 2 or 5 
            ADCButton[2]  = 270             ' button 3 or 6
    should work

    This is Why I asked to measure with your ohmmeter a couple of post back... and nope I'm not going to decipher a PCB

    You have everything on hand....
    Last edited by mister_e; - 28th August 2011 at 23:17.
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default Re: Stable ADC readings

    I don't understand : TRISB = ((DCD i) << (ADCChannel*3)) ^255
    Check your manual about DCD, logical and bitwise operators. It's all there

    Anyone wants to explain it?

    Yes I've put some black magic in
    Steve

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

  3. #3
    Join Date
    Aug 2011
    Posts
    40


    Did you find this post helpful? Yes | No

    Default Re: Stable ADC readings

    Hello Steve ,

    i have some erratic values on BTN result ( BTN = TRISB ) under pic smulator ide 6.91 .
    like 1 . 2 . 4 .255 and cycle infinite .

    But i will try this evening on led test or resistors.

    I note in 16f877x datasheet that with "1" TRISB , we have High Impedance so we can choose whose resistor to be put off .
    But with other state bit of TRISB , i don't understand how tie to common +5V of car radio (TIP) to the RB0,RB1,RBx..... ???
    We have agree that it is a result of a resistor between common ground (sleeve) and +5V (tip) on jack "grip" .

    Hervé.

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


    Did you find this post helpful? Yes | No

    Default Re: Stable ADC readings

    Never trust a sim... as simple as that. They're on the market for laziness and to make good money out of it. Good enough to replace any xBox, Nintendo... or some porn.

    You tie the resistor like the guy in that previous thread. One side on the PIC the other side are tied together and sent to the Radio.
    Steve

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

  5. #5
    Join Date
    Aug 2011
    Posts
    40


    Did you find this post helpful? Yes | No

    Default Re: Stable ADC readings

    Hi Steeve,

    i test intensity value with some résistors tie together to one led.

    But with your program , trisb stay at 255 , i put some select case for test but no trisbx.0 work (255 always)
    I will try to my test platine .
    I understand your "voodoo formule" , it is for have only one button put on , no action with 2,3 .. together .

    Regards.
    Hervé

  6. #6
    Join Date
    Aug 2011
    Posts
    40


    Did you find this post helpful? Yes | No

    Default Re: Stable ADC readings

    i repeat my question :
    how tie the resistors on the side of PIC together to have a resultant resistor in parallele ?
    i agree that the other side is tie together to the radio , but on the ground ,yes
    but the +5V for PIC RBx ?

    Regards.

    Hervé

  7. #7
    Join Date
    Aug 2011
    Posts
    40


    Did you find this post helpful? Yes | No

    Default Re: Stable ADC readings

    in fact , the simulator isn't reactif with adc , i must go slowly with an0/an1 choice .
    But step by step around button(i) , it works.

    I must add six other buttons in programm and .

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