Want to display less decimal places on LCD from 16bit ADC


Closed Thread
Results 1 to 3 of 3

Hybrid View

  1. #1
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: Want to display less decimal places on LCD from 16bit ADC

    Ryan, just take the modulo part and send it to another variable. Then display with as many digits as you like. Something like this:
    myADCvariable_fraction = myADCvariable // 100000000
    LCDOUT $FE, 1 DEC myADCvariable / 100000000, "." , myADCvariable_fraction / 10000
    That should give you 4 decimal places.
    Dave Purola,
    N8NTA
    EN82fn

  2. #2
    Join Date
    Sep 2006
    Location
    Indiana, USA
    Posts
    72


    Did you find this post helpful? Yes | No

    Default Re: Want to display less decimal places on LCD from 16bit ADC

    Thanks so much, Dave!

    Works great!

    This is what I ended up with just in case someone else ever needs to know:

    Code:
         DataIn VAR WORD
         DataInLong VAR LONG
         DataInLong_fraction VAR LONG
    
         DataIn = %1111111111111111
         
         LCDOUT $FE, 2, "VOLTAGE IN BINARY:"
         LCDOUT $FE, $C0, BIN16 DataIn
         DataInLong = (DataIn * 15259)
         DataInLong_fraction = DataInLong // 100000000
         LCDOUT $FE, $94, "VOLTAGE IN DECIMAL:"
         LCDOUT $FE, $D4, DEC DataInLong / 100000000, ".", DEC4 DataInLong_fraction / 10000
    On my LCD if DataIn is full %1111111111111111 - I now get:

    VOLTAGE IN BINARY:
    1111111111111111
    VOLTAGE IN DECIMAL:
    9.9999


    Like I expect

    Thanks again!

Similar Threads

  1. ADC lcd display help
    By kevlar129bp in forum mel PIC BASIC Pro
    Replies: 18
    Last Post: - 19th May 2015, 14:13
  2. Replies: 2
    Last Post: - 8th April 2012, 16:11
  3. 10 bit ADC display on LCD using 16f873
    By pr2don in forum mel PIC BASIC
    Replies: 3
    Last Post: - 6th March 2010, 19:29
  4. AD7705 is 15bit or 16bit ADC
    By ravindrajoga in forum Off Topic
    Replies: 1
    Last Post: - 13th July 2007, 15:09
  5. 2 decimal display on LCD
    By pt3rg in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 7th January 2004, 15:28

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