Help me save some spacecode...


Closed Thread
Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762


    Did you find this post helpful? Yes | No

    Default

    nikos,

    with some changes to your code you can still save sereral hundred words of codespace.
    (Less than 1200 words should be possible)

    Store the "static" strings in EEPROM

    Do a search for "STRINGS EEPROM" and you'll find many examples.

    Reduce the number of I2CWRITE statements by writing a subroutine "I2COUT"
    Stet the required parameters and call that sub.
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



  2. #2
    Join Date
    Feb 2005
    Location
    GREECE
    Posts
    120


    Did you find this post helpful? Yes | No

    Default

    Raiph,

    Thanks.I make a subroutine which save my some more code.But I have a problem.
    Have a look:

    Code:
    DISPLAYADDRESSBYTE = $05
    ;GR Γ = RAM15 MAX6953
    I2CWRITE SDA0, SCL0, DISPLAYCONTROLBYTE1, DISPLAYADDRESSBYTE, [$CB,%01111111,%00000001,%00000001,%00000001,%00000001]     
    I2CWRITE SDA0, SCL0, DISPLAYCONTROLBYTE2, DISPLAYADDRESSBYTE, [$CB,%01111111,%00000001,%00000001,%00000001,%00000001] 
    ;GR Δ = RAM16
    I2CWRITE SDA0, SCL0, DISPLAYCONTROLBYTE1, DISPLAYADDRESSBYTE, [$D0,%01111100,%01000010,%01000001,%01000010,%01111100]     
    I2CWRITE SDA0, SCL0, DISPLAYCONTROLBYTE2, DISPLAYADDRESSBYTE, [$D0,%01111100,%01000010,%01000001,%01000010,%01111100] 
    ;GR Θ = RAM17
    I2CWRITE SDA0, SCL0, DISPLAYCONTROLBYTE1, DISPLAYADDRESSBYTE, [$D5,%00111110,%01001001,%01001001,%01001001,%00111110]     
    I2CWRITE SDA0, SCL0, DISPLAYCONTROLBYTE2, DISPLAYADDRESSBYTE, [$D5,%00111110,%01001001,%01001001,%01001001,%00111110]
    I would like to make a subroutine like that:
    Code:
    DISPLAYADDRESSBYTE = $05
    X = $CB,%01111111,%00000001,%00000001,%00000001,%00000001 
    GOSUB I2COUT
    X = $D0,%01111100,%01000010,%01000001,%01000010,%01111100
    GOSUB I2COUT
    X = $D5,%00111110,%01001001,%01001001,%01001001,%00111110
    GOSUB I2COUT
    ....
    I2COUT:
              I2CWRITE SDA0, SCL0, DISPLAYCONTROLBYTE1, DISPLAYADDRESSBYTE, [X]
              I2CWRITE SDA0, SCL0, DISPLAYCONTROLBYTE2, DISPLAYADDRESSBYTE, [X]
    RETURN
    ....
    Now what variable is X?Word?
    That is my problem.

    Regards
    Nikos

  3. #3
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762


    Did you find this post helpful? Yes | No

    Default

    nikos,

    the attached example is based on your inital code with IOANNIS's modifications.

    All I have done was some "cut & paste" and some modding.

    It is supposed to work, but not tested.
    (compiles to 1246 words)

    There is still plenty of room for improvement,
    the example is just ment to give you an idea.
    Attached Files Attached Files
    Last edited by NavMicroSystems; - 10th August 2005 at 23:55.
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



Similar Threads

  1. Newbe how to save srtrings
    By MR2010 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 24th January 2010, 01:16
  2. long countdown timer, how to save power?
    By Kamikaze47 in forum mel PIC BASIC Pro
    Replies: 29
    Last Post: - 15th November 2008, 05:15
  3. Using serial eeprom to save data ?
    By iugmoh in forum General
    Replies: 4
    Last Post: - 8th February 2008, 08:36
  4. Replies: 5
    Last Post: - 29th January 2008, 09:19
  5. save data in pic
    By PoTeToJB in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 17th May 2006, 21:17

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