Maximum value of ADCIN


Closed Thread
Results 1 to 21 of 21

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    So, if eeprom it's like in picture :
    75 (hex) = 117 (dec)
    v_cal = 117 * 4,8875 = 572 mVolts ?
    Yes, if you saved the MAX A/D value instead of the converted value.

    In that case, be sure to use the previous formula to convert it to voltage.
    Code:
    v_cal=v_cal * 5000            ' I use VDD as Vref
    v_cal=div32 1023.
    DT

  2. #2
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    582


    Did you find this post helpful? Yes | No

    Default

    I use this code :
    Code:
        vmax = 0
        for cnt =1 to 70       			
            adcin 3, v_cal
            vmax =vmax max v_cal
            pause 100
        next cnt
    
        v_cal=vmax * 5000            ' I use VDD as Vref
        v_cal=div32 1023
    
    write 0, v_cal.LowByte
    pause 10
    write 1, v_cal.HighByte
    pause 10

  3. #3
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Then you have saved the value as a Voltage.
    And 117 means 117mV.

    Since I = E / R ... with a 0.02 ohm resistor ...

    0.117 / 0.02 = 5.85 Amps

    Dividing by 0.02 is the same as multiplying times 50.

    117 * 50 = 5850 or 5.850 Amps.
    DT

  4. #4
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    582


    Did you find this post helpful? Yes | No

    Default

    One truck with e-beer for Mr.Darrel ! With thanks for fratello !
    Now another worm walk to my convolutions ! If at start of colecting samples, my motor give me one peek (or "n" peeks) of voltage , but the real v_cal ( from the end of route) it's smaller than peek(s) , it's possible to reject them ? Something like here : http://www.picbasic.co.uk/forum/showthread.php?t=12183
    It's possible to use :
    Code:
    AvgCount	CON  70		' Number of samples to average
    FAspread	CON  50 	' Fast Average threshold +/-
    Reject          CON  2          ' Spurious Rejection level
    ...etc - see post
    Attached Images Attached Images  
    Last edited by fratello; - 15th November 2010 at 17:07.

  5. #5
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    582


    Did you find this post helpful? Yes | No

    Default

    Since the whole code don't fit into 12F675, I give up...till hw upgrade...
    So, I put in my code one little delay (pause 500) before starting ADC reading...I hope it's enough.

  6. #6
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    582


    Did you find this post helpful? Yes | No

    Default

    It's ok with "pause'... I have though just one question...
    If I use this code:
    Code:
    DEFINE OSC  4
    DEFINE ADC_BITS 10
    DEFINE ADC_CLOCK 3
    DEFINE ADC_SAMPLEUS 50
    ....
    Code:
     for cnt = 1 to 3
     	adcin 3, adval
     	vt=adval * 5000
     	vt=div32 1023
     	grup=vt+grup
     	pause 20
     next cnt
     vs=grup / 3
    how small can be "pause' for correct reading of ADC ?
    Thanks in advance !

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


    Did you find this post helpful? Yes | No

    Default

    It can be zero.
    Dave
    Always wear safety glasses while programming.

  8. #8
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    You will still get correct A/D readings without any pause at all in there.

    I guess it depends on how much the signal is changing, as to whether the average will be accurate or not.
    DT

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