Shop OBEX P1 Docs P2 Docs Learn Events
"Variable Exceed Available Ram" — Parallax Forums

"Variable Exceed Available Ram"

Russ61Russ61 Posts: 11
edited 2005-01-16 16:40 in General Discussion
Greetings,
·
I'm new to the SX and am having trouble getting my mind around the SX's memory.· I have the "SX Tech Tool Kit Lite" with an SX28AC.· I have figured out how to get my program spread out into different pages and call subroutines across pages, although at this point I'm sure I could be much more efficient.· What I need to know right now is how to spread my variables out.· I am working on a project that currently has 20 byte-sized variables and works fine, but I need to add a few more variables.·· If I add another variable to my current list I get the message "Variable Exceed Available Ram" when I try to assemble my program.· I should be able to access 128 bytes of SRAM correct?· SRAM is where my variables should be stored isn't it?·
I've read the SX-Key Development Manual, Beginning Assembly Language for the SX Microcontroller, and Ubicom's data sheet for the SX20AC/SX28AC.· I can't seem to find a document that spells it out to where I can understand it.·
I would greatly appreciate some help to get me past my current obstacle, and if someone could point me to documentation that would help me understand SX memory navigation (SX Memory for Dummies) that would be great also.
·
Thanks,

RWC

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Russell Crow

Project Manager
Cohesive Automation Inc.
·

Comments

  • pjvpjv Posts: 1,903
    edited 2005-01-15 18:24
    Hi Russel,

    You have tripped accross the same issue I found when first using SX/B. A thread on this was started on Nov 11 04 named "SX/B variable limits", (sorry, I don't know how to create a link to it) and has lots of good suggestions from Bean.

    Unfortunately, the documentation on SX/B does not state that 20 variables is the maximum. (Jon, perhaps you could include that fact in the otherwise very good HELP file?)

    The alias method Bean suggested is not a bad work-around.

    Clearly, programming the SX in assembler does not have this limitation, and hence no reference in the Parallax documentation nor in Ubicom datasheets. This is strictly an SX/B compiler limitation.

    Have fun,

    Peter
  • Russ61Russ61 Posts: 11
    edited 2005-01-15 22:32
    Peter,

    Thanks for the information. I will do a search for the link you mentioned.

    RWC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Russell Crow

    Project Manager
    Cohesive Automation Inc.
    ·
  • BeanBean Posts: 8,129
    edited 2005-01-16 03:27
    SX/B is geared towards a learning tool to get people started with the SX chips without having to learn full-blown assembly language. To use the rest of ram requires "bank switching" where blocks of RAM are moved in and out of the SX's limited 32 byte address space.

    SX/B only uses bank0 for it's normal variables. All of the rest of RAM is used for ARRAYS.

    The alias method is basically this:

    MoreVars VAR BYTE(16) ' 16 is the max size of any single array

    Z1 VAR MoreVars(0)
    Z2 VAR MoreVars(1)
    Z3 VAR MoreVars(2)

    Z1 = Z2 + Z3

    ect...

    Note that not all commands will accept an array element (or it's alias) as a parameter.

    Bean.

    Post Edited (Bean) : 1/16/2005 3:31:45 AM GMT
  • Russ61Russ61 Posts: 11
    edited 2005-01-16 16:40
    Bean,

    Thanks for the explanation. Peter pointed me to some of your earlier posts that helped him, but before that, I was able to eliminate 7 variables by working smarter. I used your example this morning and found that “lookup” is one of the commands that don’t support array elements. Anyway, armed with this information, I’m back to programming!

    Thanks again,

    RWC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Russell Crow

    Project Manager
    Cohesive Automation Inc.
    ·
Sign In or Register to comment.