Joining variables and displaying on an LCD


Closed Thread
Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    Sorry, the above code should be:

    Code:
    LCDOUT $fe, ($c0 + 4)    'moves cursor to 4th character position on bottom line
    gosub printtemp
    
    
    printtemp:
         LCDOUT #TempTens, #TempUnits,".",#TempDecimals  'remove line/cursor info 
    return
    Last edited by ScaleRobotics; - 28th April 2009 at 20:54.

  2. #2
    Join Date
    Aug 2007
    Location
    Mississauga, Ontario, Canada
    Posts
    29


    Did you find this post helpful? Yes | No

    Default

    You know... you might have something going here. I'll explore this option as well.

    Now that I think of it, the original way might work as well. I'm just worried about the size of the program (trying to fit everything on a F628) but now that I think about it, just because a variable looks long and messy on the Microcode screen, doesn't mean it will take that much space on a chip, right?


  3. #3
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    That's right, looks can be deceiving.

    I did a couple tests with Darrel's "How much code could a code hog ...." thread at
    http://www.picbasic.co.uk/forum/showthread.php?t=2418
    This was done with a 18F chip:

    it turns out that both lines use the same amount of space:
    Code:
    Lcdout $fe, ($c0 +4),"98.7"
    
    LCDOUT $fe, ($c0 +4), #TempTens, #TempUnits,".",#TempDecimals
    And, if you use the gosub (in post #5) 3 times, rather than use the above line (three times), you will use about 2/3 the code space. And that's not considering forming the data into a string.
    Last edited by ScaleRobotics; - 29th April 2009 at 00:51.

  4. #4
    Join Date
    Aug 2007
    Location
    Mississauga, Ontario, Canada
    Posts
    29


    Did you find this post helpful? Yes | No

    Default

    Good stuff. Thank you for running the tests for me.
    Looks like I'll have to go with the original plan as you have suggested.
    No worries... I simply thought there would be a different way of doing it but I'll just have to get creative here and make efficient use of code space.

    Thank you very much for all your help.

Similar Threads

  1. WRITECODE stores wrong 14-bit word values in FlashMEM
    By BobPigford in forum mel PIC BASIC Pro
    Replies: 18
    Last Post: - 26th June 2009, 04:35
  2. SLOW Serin2 and Serout2
    By dragons_fire in forum General
    Replies: 3
    Last Post: - 26th June 2009, 02:38
  3. Displaying messages with only 7 (or 4) LEDs on a stick...
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 20th May 2007, 08:35
  4. Gps with 16f628
    By dragons_fire in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 8th June 2006, 03:38
  5. reading, writing, and displaying from eeprom
    By Rhatidbwoy in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 12th January 2006, 22:05

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