I'm running out of code space example.


Closed Thread
Results 1 to 3 of 3
  1. #1

    Default I'm running out of code space example.

    In this link Melanie gives an example of how to save code space by forcing variables into bank0.

    http://www.picbasic.co.uk/forum/cont...-What-Can-I-Do

    Some questions.

    1) Why are only some of the variables in the example prefaced with bank0?

    2) Why doesnt everyone just do this as a matter of course for all variables?

    3) I tried doing this with my large 16F886 program and it's 50 or so variables which uses 5555 words as reported by MCS. It made no difference and MCS still reportrs 5555 words used?

  2. #2
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    637


    Did you find this post helpful? Yes | No

    Default

    I think that newer versions of PBP already handle this variables and memory bank issue. That is why you didn't see any difference.

    Robert
    Last edited by rsocor01; - 21st June 2010 at 20:03.

  3. #3
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    > 1) Why are only some of the variables in the example prefaced with bank0?
    Placing the most frequently used variables in BANK0 will give the most benefit.

    > 2) Why doesnt everyone just do this as a matter of course for all variables?
    BANK 0 is only a portion of the available RAM.
    They can't all fit in BANK0, and it takes some careful thought to figure out which ones should be there.

    > 3) I tried doing this with my large 16F886 program and it's 50 or so variables which uses 5555 words as reported by MCS. It made no difference and MCS still reportrs 5555 words used?
    On a 16F886, BANK0 has 96 bytes.
    PBP will use ~24 of them for system variables.
    If you have another 50 BYTE sized variables, they will all end up in BANK0 anyhow.
    So specifying BANK0 won't make any difference.

    If you have 200 variables some words and arrays, then placing the most frequently used variables in BANK0 can save quite a bit of space.

    Grouping variables in other banks that are used within a single subroutine can also save some since there is less bank switching to do between those particular vars.

    hth,
    DT

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