show on LCD decimal numbers


Closed Thread
Results 1 to 9 of 9
  1. #1
    Join Date
    Jun 2006
    Location
    Greece
    Posts
    302

    Default show on LCD decimal numbers

    It's possible to show on LCD decimal numbers;
    value = SQR 10 ' give 3,16
    i use this:
    Lcdout $fe,1, DEC (value DIG 2), "." ,DEC (value DIG 1) ,DEC (value DIG 0)
    but not show correct.

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by savnik View Post
    It's possible to show on LCD decimal numbers;
    value = SQR 10 ' give 3,16
    i use this:
    Lcdout $fe,1, DEC (value DIG 2), "." ,DEC (value DIG 1) ,DEC (value DIG 0)
    but not show correct.
    Let me guess....you're expecting 3.16 right?
    Do a search in the PBP manual for floating point math and tell me what you come up with (hint: we've already been through this in January, see post #8 of the "16f877 with LM335 problem" thread ).
    Last edited by skimask; - 30th March 2007 at 21:25.

  3. #3
    Join Date
    Apr 2006
    Location
    New Hampshire USA
    Posts
    298


    Did you find this post helpful? Yes | No

    Smile A similar question (with answer)

    Hi savnik,

    This is a very common problem.
    A similar question is asked here.
    Be sure to see Darrel's great explanation:
    http://www.picbasic.co.uk/forum/showthread.php?t=5545

    -Adam-
    Ohm it's not just a good idea... it's the LAW !

  4. #4
    Join Date
    Jun 2006
    Location
    Greece
    Posts
    302


    Did you find this post helpful? Yes | No

    Default math problem

    i have two variables:
    x var word
    y var word
    and x < y.

    How to show on lcd the result of x/y , or the value = SQR x/y
    Last edited by savnik; - 31st March 2007 at 10:11.

  5. #5
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    This has worked for me. Play with it.
    Code:
    RESULT	VAR	WORD
    
    LCDOUT $FE,1,DEC RESULT/100,".",DEC2 RESULT//100
    Note DEC2 and // after the dummy “.”

    The DEC2 gives the last two digits and // gives the remainder or MOD of a number.

    I use this to monitor battery voltage to the hundredths place.
    Dave
    Always wear safety glasses while programming.

  6. #6
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by savnik View Post
    i have two variables:
    x var word
    y var word
    and x < y.

    How to show on lcd the result of x/y , or the value = SQR x/y
    Right...I understand that. I'm still trying to make you understand.
    Again, I ask you to do a search in the PBP manual for floating point math and tell me what you come up with (same hint: we've already been through this in January, see post #8 of the "16f877 with LM335 problem" thread ).

  7. #7
    Join Date
    Jun 2006
    Location
    Greece
    Posts
    302


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    Right...I understand that. I'm still trying to make you understand.
    Again, I ask you to do a search in the PBP manual for floating point math and tell me what you come up with (same hint: we've already been through this in January, see post #8 of the "16f877 with LM335 problem" thread ).
    I have read the manual for floating point very well and i have see post #8 of the "16f877 with LM335 problem" thread.
    i use this:

    Code:
                                            ' forwardpower  = 400 
                                            ' reflectedpower = 20
        B0 = forwardpower/reflectedpower    ' = 400/20 = 20    
        B1 = 10000/B0                       ' = 10000*1/20 = 500                    
        B2 = SQR B1                         ' = 22,360679    
        B3 = (10000+B2*100)/(100-B2)        ' = (10000+22*100)/(100-22) = 12200/78 = 156,4
        Lcdout $fe,$90, "SWR  : ",DEC (B3 DIG 2),".", DEC (B3 DIG 1),DEC (B3 DIG 0)

  8. #8
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by savnik View Post
    I have read the manual for floating point very well and i have see post #8 of the "16f877 with LM335 problem" thread.
    So what's the problem? What did you find about floating point in the manual?

  9. #9
    Join Date
    Jun 2006
    Location
    Greece
    Posts
    302


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    So what's the problem? What did you find about floating point in the manual?
    now i don't have problem.
    I spent many hours , how to solve my problem.
    with floating point i solve my problem

Similar Threads

  1. Is this code not initialising the LCD properly?
    By Platypus in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 30th January 2010, 20:14
  2. 16f688 LCD what have I done wrong
    By spitfiredriver in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 8th August 2009, 20:54
  3. Play with LCD on PICDEM
    By The IceMan in forum mel PIC BASIC
    Replies: 5
    Last Post: - 22nd August 2008, 17:56
  4. Need help with LCD number display.
    By Steve Matson in forum mel PIC BASIC
    Replies: 8
    Last Post: - 27th June 2007, 00:07
  5. LCD will not start
    By btaylor in forum mel PIC BASIC Pro
    Replies: 49
    Last Post: - 24th May 2007, 03:30

Members who have read this thread : 1

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