ADC lcd display help


Closed Thread
Results 1 to 19 of 19

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    At the risk of confusing you more...
    http://www.picbasic.co.uk/forum/cont...Sensor-Scaling
    Dave
    Always wear safety glasses while programming.

  2. #2
    Join Date
    Dec 2005
    Location
    Salt Lake City, Ut, USA
    Posts
    108


    Did you find this post helpful? Yes | No

    Default

    Thanks Mack,

    Funny you point out that thread... That's the one I've been racking my brain over.
    I'll take another look though.

    Chris

  3. #3
    Join Date
    Dec 2005
    Location
    Salt Lake City, Ut, USA
    Posts
    108


    Did you find this post helpful? Yes | No

    Default

    Hey Mack,

    Quick question. When we're talking about the ADC count based on the sampled voltage,
    what happens to the count when it's fractional?
    IE:
    count = 557.26 ... does this become 557 or 558?
    count = 952.76 ... does this become 952 or 953?

    I guess I'm just wondering what the "rounding" routine is, if any?

    Thanks again,
    Chris

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


    Did you find this post helpful? Yes | No

    Default

    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Dec 2005
    Location
    Salt Lake City, Ut, USA
    Posts
    108


    Did you find this post helpful? Yes | No

    Default

    Thanks for the heads up Mack,

    I guess I was a bit confused by this in your ADC scaling tutorial:
    Code:
    Convert this to an 10 bit PIC® resolution.
    
    10 bits ADC = 0 to 1023, 1024 steps.
    At 5.0 volts one volt of input will will read 205. (204.6 actually)
    Why would that read 205, instead of 204?
    Thanks Mack, for helping a newbie trying to understand.

    Chris

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by kevlar129bp View Post
    Why would that read 205, instead of 204?
    Thanks for catching that and I apologize for the confusion.

    I changed the article to

    10 bits ADC = 0 to 1023, 1024 steps.
    At 5.0 volts one volt of input will will read 204. (204.8 actually)
    But we will use 205 for accuracy.
    204 * 5 = 1020
    205 * 5 = 1025
    Hope that clears things up a bit..
    Dave
    Always wear safety glasses while programming.

  7. #7
    Join Date
    Dec 2005
    Location
    Salt Lake City, Ut, USA
    Posts
    108


    Did you find this post helpful? Yes | No

    Default

    Hey Mack,

    I sketched this code in notepad after reading some other posts...
    Does it look like I'm on the right track?
    Code:
    ADVal VAR WORD
    Quanta CON 489	'VREF/1024 = 5/1024 = .00488 = 489
    VoltageDivider CON 70
    ADCVolts VAR BYTE
    LCDVolts VAR WORD
    
    ADCIN 0,ADVal
    	ADCVolts=(ADVal/1000)*Quanta
    	LCDVolts=ADCVolts*VoltageDivider
    		LCDout $fe, 1
    		LCDout $fe, 2,   "CURRENT READINGS ARE"
    		Lcdout $fe, $C0, "A/D VDC = ",DEC1 ADCVolts/100,".",DEC2 ADCVolts//100
    		Lcdout $fe, $94, "--------------------"
    		Lcdout $fe, $D4, "ACTUAL VDC = ",DEC3 LCDVolts/100,".",DEC2 LCDVolts//100
    Thanks again for your assistance,
    Chris

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