show on LCD decimal numbers


Closed Thread
Results 1 to 9 of 9

Hybrid View

  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 20: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 09: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)

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, 19:14
  2. 16f688 LCD what have I done wrong
    By spitfiredriver in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 8th August 2009, 19:54
  3. Play with LCD on PICDEM
    By The IceMan in forum mel PIC BASIC
    Replies: 5
    Last Post: - 22nd August 2008, 16:56
  4. Need help with LCD number display.
    By Steve Matson in forum mel PIC BASIC
    Replies: 8
    Last Post: - 26th June 2007, 23:07
  5. LCD will not start
    By btaylor in forum mel PIC BASIC Pro
    Replies: 49
    Last Post: - 24th May 2007, 02:30

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