how much space it takes up


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    838

    Default how much space it takes up

    Hi guys , I am fighting a space problem with program memory of the chip at 128k.

    several part of the program require GLCD to show strings menus which are currently formed as multi lookup tables
    I have an external sd card setup , for other uses.

    I also have fonts but as they need to be shown as digits they are loaded and need to be displayed very quickly else it slow the display or jumps

    am thinking i can write a hex file of the strings with some form of lookup to load them it would be nice to know how much space i am likly to save off the chip

    currently the menus " lookup list has 40chrs x 5 lines
    There are currently 45 menu groups of this nature

    would it only be about 9k ?? or would it be more

    regards

    Sheldon



    Code:
    for gl_k = 0 to 4 
         for gl_i = 0 to 39
     
           if Menu_Select =  1  then gosub Menu_1          ' Main Menu  
           if Menu_Select =  2  then gosub Menu_2          ' ANOTHER  Menu ETC 
           gosub put_char
              gl_x = gl_x + 6
           next gl_i 
         gl_i = 0
       next gl_k  
        gl_k = 0
          
      gosub Menu_lines
      
    return 
    
    ' =============== Main System Menu  - Menu_1_0 =============================== 
                 
    Menu_1:
                                           '  |------- max 36 chrs wide ---------| 
            if gl_k = 0  then lookup gl_i,["        MAIN SYSTEM MENU                "],g_char ' Menu header gl_y 8
                                           '    ==============================
            if gl_k = 1  then 
               gl_y = 16                 
                                  lookup gl_i,["  1.        SELECT NEW EVENT           "],g_char ' option 1    gl_y 24
              endif
            if gl_k = 2  then lookup gl_i,["  2.         SYSTEM SETUP                "],g_char ' option 2    gl_y 32
            if gl_k = 3  then lookup gl_i,["  3.       System Information             "],g_char ' option 3    gl_y 40
            if gl_k = 4  then lookup gl_i,["         (press SETUP to exit)             "],g_char ' option 4    gl_y 56
          
           gl_x1 = 40   ' underline the Menu Header 
           gl_x2 = 195 
    return

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,521


    Did you find this post helpful? Yes | No

    Default Re: how much space it takes up

    Hi Sheldon,

    Why not just try it and find out?

    Compile the program, note the size. Add or remove a single character from one of your LOOKUP statements and compile it again, note the difference. That's how much space each character takes.

    As far as I can see each character, when used in a LOOKUP statment, "occupies" two bytes when compiled for a 18F device and one word when compiled for a 10,12 and 16F devices. Each occurrence of LOOKUP seems to add ~44 bytes for 18F parts and 17 words for 10, 12 and 16F parts (plus the characters of course).

    So, if you have 45 menu groups, each consisting of 5 LOOKUP statements with 40 characters each I count to (45*5*44) + (45*5*40*2) = 27900 bytes.

    /Henrik.

  3. #3
    Join Date
    Sep 2009
    Posts
    737


    Did you find this post helpful? Yes | No

  4. #4
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    838


    Did you find this post helpful? Yes | No

    Default Re: how much space it takes up

    cheers guys , that helps , ill try removing as well , truth is ill have to do it , i have so much further to go , and 128k is getting to be a small space. good thing i only have 240x64 glcd , so far , i have plans to go for 240 x128 later , but 18F is not going to get me there i dont think

  5. #5
    Join Date
    Sep 2009
    Posts
    737


    Did you find this post helpful? Yes | No

    Default Re: how much space it takes up

    What about FT800?
    You also can try to create menus dynamically. Create routine, that will draw menu based on number of items etc...
    Remove space's, create routine to set X address of LCD based on does your text left aligned or center. Print row number only once, or create sub that print option numbers and title.
    Then you need just to store strings few numbers and strings in flash.

  6. #6
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    838


    Did you find this post helpful? Yes | No

    Default Re: how much space it takes up

    since i have a small 2gig sd card available of which i use about 100mb , i was looking to rewrite the menu routines i have just to store the lookup table data as the first step , since the menus are not as time sensitive as the large / medium fonts for the digits , some other chrs can be moved to SD as they dont need the speed as much in my app , i am hoping that it will free up about 40- 50k if i can write it well ,
    this seem like the easy road to take.

    changing chips is not the option i want to go to as the pcb is made , also since i have done all this code in PBP3 i prefer a chip that it supports , than redoing it using another language unless i really need to .

    But i am finding the more i do and want to achieve PBP limited to 18f chips which at best is 128k.

    i have looked at the ARM chips , for thier pricing,speed, RAm & program size space , and predone boards for prototyping

    i have found that MIkrobasic supports the the ARM processors , so although i would need to learn the scripting of Mikrobasic , i would be as bad as having to relearn C and i could likly use a lot of the routines already done in pbp with only a small amount of changes MIkrobasic also supports PIC32 as well ???

    i do like PBP , but its very limiting on larger project it seems

    see how i go making a hex file of the menu items and see
    knowing what i have , is there a some routines anyone has found that can be used for an example

    the sd card is setup using the fat 16 with SDFS.bas code

    cheers

    sheldon

Similar Threads

  1. Need more space, please...
    By fratello in forum mel PIC BASIC Pro
    Replies: 26
    Last Post: - 23rd January 2012, 15:21
  2. 18F4550 USB takes over
    By milosch in forum USB
    Replies: 1
    Last Post: - 27th March 2011, 14:17
  3. PBPL Math...new math takes more cycles...Always?
    By skimask in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 10th February 2008, 10:22
  4. SEROUT2 takes 1400ms to execute?
    By droptail in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 16th March 2006, 17:08
  5. Need more code space
    By Sphere in forum General
    Replies: 2
    Last Post: - 19th September 2005, 20:49

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