How to convert ADC input for floating point display?


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2013
    Posts
    1,079

    Default How to convert ADC input for floating point display?

    Hello.

    I'm doing a simple ADC reading circuit, which works fine, and I read the value into variable, but want to display it as floating point voltage, not the decimal. Since floating point operations not supported, I'm getting output "4" where I should get "4.1". Is there a way to add some dots?

    Currently, I've configured it such way, that when voltage is 4.88v, the variable value is 488. So I need to somehow place point between 4 and 88, so it looks like "4.88"

  2. #2
    Join Date
    Sep 2009
    Posts
    738


    Did you find this post helpful? Yes | No

    Default Re: How to convert ADC input for floating point display?

    Voltage=488
    LCDOUT $FE, $1, #(Voltage DIG 2), ".", DEC2 Voltage

  3. #3
    Join Date
    Feb 2013
    Posts
    1,079


    Did you find this post helpful? Yes | No

    Default Re: How to convert ADC input for floating point display?

    Thank you very much, it works!

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,523


    Did you find this post helpful? Yes | No

    Default Re: How to convert ADC input for floating point display?

    Or possibly
    Code:
    LCDOUT $FE, $1, DEC (Voltage/100), ".", DEC (Voltage // 100)
    It produces slightly smaller code.

    /Henrik.

Similar Threads

  1. Replies: 4
    Last Post: - 14th June 2011, 22:03
  2. Getting out of floating point
    By jcb344 in forum General
    Replies: 3
    Last Post: - 5th August 2008, 21:18
  3. Floating Point Display Problem (serial string out)
    By Cash Olsen in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 20th December 2007, 02:03
  4. Floating Point
    By jrudd in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 15th May 2005, 14:19
  5. help floating Point!
    By Eric in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 7th December 2003, 21:18

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