28 bits --> DEC output on LCD


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    343

    Question 28 bits --> DEC output on LCD

    Anybody have a tidy way to display a 28 bit number on an LCD in decimal? I’m multiplying two 16 bit words, but based on the max values for each, the total should result in 28 bits or less.

    Here is the way I am doing it now:
    Check the high word. If it’s >0 then divide the 32 bit product (using DIV32) by a multiple of 10 (based on the value of in the high word). Then print out the result with appropriate number of trailing 0s. This has the effect of rounding off the last digits (up to 4 if the number is large).

    This works well enough, but I am guessing somebody else has a better way of doing this.

    Steve

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Steve,

    A slight variation of this might work.

    32-bit Variables and DIV32, Hourmeter 99999.9
    http://www.picbasic.co.uk/forum/showthread.php?t=1942

    The key is getting the remainder from DIV32.
    <br>
    DT

  3. #3
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    343


    Did you find this post helpful? Yes | No

    Default

    Perfect!

    Quote Originally Posted by Darrel Taylor
    The key is getting the remainder from DIV32.
    Yep, this is exactly the key I need to crack this problem. I had the "Result = DIV32 1000" part figured out, just didn't know how to get at the "bottom half" of the double word.

    I really wish the search function for this forum worked a little better and accepted small terms. It might have helped me find your previous post. But I was right in my guess that someone had figured this out already. Not suprised at all that someone happend to be Darrel Taylor.

    Thanks Darrel,
    Steve

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Why...Thank you Steve!

    And I seem to remember someone posting about using the google site: search instead of the forums search tool.

    But I searched for it, and couldn't find it

    DT

Similar Threads

  1. Play with LCD on PICDEM
    By The IceMan in forum mel PIC BASIC
    Replies: 5
    Last Post: - 22nd August 2008, 16:56
  2. PBPL 2.50 observations
    By BrianT in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 17th September 2007, 23:58
  3. Need help with LCD number display.
    By Steve Matson in forum mel PIC BASIC
    Replies: 8
    Last Post: - 26th June 2007, 23:07
  4. Serious Serial Situation Setbacks...
    By Dansdog in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 7th February 2007, 03:46
  5. error on compiling
    By parker in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 16th June 2005, 14:31

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