ADC value with 2 decimals on an LCD


Closed Thread
Results 1 to 4 of 4

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default

    I use:
    Code:
        DEFINE  ADC_BITS        10  ' Set resolution of conversion
        DEFINE  ADC_CLOCK       8   ' Set clock source (x/FOSC or FRC)
        DEFINE  ADC_SAMPLEUS    50  ' Set sampling time (in uS)
    However as I recall you have to switch the ADRESH/ADRESL to right justification for 10-bit and left justification for 8-bit.

  2. #2


    Did you find this post helpful? Yes | No

    Default

    You can use the formula:

    Code:
        volts = 50000 / 255 * A/D Value
        if volts DIG 1 => 5 then
            volts = volts + 100
        endif
        volts = volts / 100
        debug cmd,line3,dec1 volts/100,".",dec2 volts//100
    At say 2.5V the display will read 2.49 and the variable "volts" will hold 249.

Similar Threads

  1. RF Modules
    By tonyfelloni in forum mel PIC BASIC Pro
    Replies: 44
    Last Post: - 26th June 2010, 18:42
  2. More Servo Woes
    By chrisshortys in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 13th May 2009, 09:40
  3. Play with LCD on PICDEM
    By The IceMan in forum mel PIC BASIC
    Replies: 5
    Last Post: - 22nd August 2008, 17:56
  4. LCD will not start
    By btaylor in forum mel PIC BASIC Pro
    Replies: 49
    Last Post: - 24th May 2007, 03:30
  5. having problems with Hantronix 20x4 lcd
    By Rhatidbwoy in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 22nd December 2005, 13:22

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