ADCin and floating point values


Closed Thread
Results 1 to 4 of 4
  1. #1
    niknaksbarbeque's Avatar
    niknaksbarbeque Guest

    Default ADCin and floating point values

    Hello,

    Firstly apologies if this is very thick question, pretty new to all this electronic malarkey, had a look on the forums and couldn't find an answer, any help really really really appreciated.

    I am wanting to read a voltage value on the RA0 pin on the pic 18f452 using ADCin. However the values I want to read go from 0.0 to 0.5 V.

    Am I correct in thinking that because the pic doesn't do floating point values, anything less than 0.5 will be scaled down to 0?

    If so, does this mean that your ADC converter can only supply a range of values from 0 to 5?

    Thanks very much
    Mark
    p.s. I come from a software background, embedded hardware programing so much harder than just pure software, don't know how you guys keep your patience

  2. #2
    Join Date
    Oct 2004
    Location
    Italy
    Posts
    695


    Did you find this post helpful? Yes | No

    Default

    Analog to Digital Converters (A/Ds)
    http://www.facstaff.bucknell.edu/mas...es/ConvAD.html

  3. #3
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Your ADC result will have NOTHING in common with floating point. Let me explain... assuming you have a 10-bit ADC, your minimum reading will be zero and your maximum reading will be 10-bits or 1024. This maximum reading is referenced to +VRef, and the minimum is referenced to -VRef.

    If -VRef is 0v, and +VRef is 5v, then 0v will equal zero on the ADC and 5v will equal a count of 1024. It goes to assume that 2.5v will be half of 1024 ie a count of 512, and 0.5v will have a count around 102...so you will have a resolution of about 5mV or 100 points on the scale.

    If you change your +VRef to 0.5v (keeping -VRef at 0v), then the scale will be between 0 and +VRef for your entire 10 bits... ie, a count of 0-1024 for a voltage range of 0-0.5v (here a resolution of 500uV).

    So to summarise, your ADC range is a count between -Vref and +Vref in the 10-bit (or 8-bit is you set it that way) resolution of your ADC. Thereafter you can perform some math on your ADC reading and thrrow in a decimal point to give you an answer in volts, amps, coulombs, whatever....

    Melanie

  4. #4
    niknaksbarbeque's Avatar
    niknaksbarbeque Guest


    Did you find this post helpful? Yes | No

    Default Thanks

    Yes I was being thick, thank's very much for the replies guys, you've let me keep my hair (was slowly being torn out in clumps).

Similar Threads

  1. Floating point math
    By Glenn in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th January 2009, 03:47

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