how to display division on lcd


Closed Thread
Results 1 to 5 of 5
  1. #1

    Default how to display division on lcd

    Very stuepied queastation ,but (((.
    for pic16F84A

    for example if we have :
    dc var word
    dc=1/5
    how to display on lcd
    i have tried
    lcdout $FE,1 , dec4 dc....

    the result is "0"

    P.S I am in the beginning of pic basic pro...

  2. #2
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    Since PBP cannot deal with decimal you have to overcome the limitation in this way:

    dc = 100/5 (dc=20)

    LCDOUT $FE,1 ,"0.0",#dc

    display 0.020

    Al.
    Last edited by aratti; - 2nd August 2009 at 15:30.
    All progress began with an idea

  3. #3


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by aratti View Post
    Since PBP cannot deal with decimal you have to overcome the limitation in this way:

    dc = 100/5 (dc=20)

    LCDOUT $FE,1 ,"0.0",#dc

    display 0.020

    Al.
    ok ,thanks a lot
    Please give me one example : 1/8 =0,125

  4. #4
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by aratti View Post
    Since PBP cannot deal with decimal you have to overcome the limitation in this way:

    dc = 100/5 (dc=20)

    LCDOUT $FE,1 ,"0.0",#dc

    display 0.020

    Al.
    Must be that "new math" , .20, you can display that as a string by putting it in quotes, LCDOUT $FE, 2, "1/5" , or as Al pointed out LCDOUT $FE,1 ,"0.",#dc , where the STRING "0." are just symbols for you humans to get your mind around and the real data follows from #dc
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  5. #5
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by alexandro34 View Post
    ok ,thanks a lot
    Please give me one example : 1/8 =0,125
    Just as before, 1/8 *1000 = 125, do this because PBP only does integer math, this gives you the answer 125. Display as before LCDOUT $FE, 2, "0."#dc , Or as a European display LCDOUT $FE,2,"0,"#dc .
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

Similar Threads

  1. LCD Display
    By lambert in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 16th January 2010, 22:18
  2. LCD display not working properly
    By dilpkan in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 2nd February 2008, 07:43
  3. Replies: 14
    Last Post: - 26th September 2007, 05:41
  4. LCD Display not working - PIC heating...
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 32
    Last Post: - 24th September 2006, 07:35
  5. A/D display result on LCD
    By winsthon in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 10th January 2004, 10:09

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