Shop OBEX P1 Docs P2 Docs Learn Events
Lost in Pages of Variables... — Parallax Forums

Lost in Pages of Variables...

SteelSteel Posts: 313
edited 2006-06-22 01:01 in General Discussion
So I am new to the SX and trying to understand everything.· I have added variable #21 to my program, and the error I get at compile is:

"Variable Exceed Available RAM".· Are there only 20 bytes of available RAM space?· I know my code isn't taking up much room, and I was under the impression that the ram was 2k.

I also know that there are 'pages' to the RAM.· I read "ExploringtheSX" and the DataSheet, but I am pretty lost on what to do.

Could somebody point me to information on getting some more variables in there?

I am hoping that there is a way, incase I want to send a UART message·"This message is more than 20 characters." to the chip.

Please help.

Shaun



Post Edited (Steel) : 6/21/2006 6:56:03 PM GMT

Comments

  • PJMontyPJMonty Posts: 983
    edited 2006-06-21 18:33
    Steel,

    Post your code so people can see what you're doing instead of guessing.

      Thanks, PeterM
  • BeanBean Posts: 8,129
    edited 2006-06-21 18:49
    Shaun,
    2K is the PROGRAM space. Variable space is much smaller.
    Due to RAM banking, SX/B has a limited number of "normal" variables.
    If you need more use arrays. Arrays use a different section of RAM.

    As Peter suggested, please post your code...

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com

    "I reject your reality, and substitute my own." Mythbusters
    ·
  • SteelSteel Posts: 313
    edited 2006-06-21 18:56
    Posted in original post.

    I Changed the actual names to just the initials...so that may be confusing. Im sorry, but it's just for code protection.

    and sorry about the messy code...· :S
  • BeanBean Posts: 8,129
    edited 2006-06-21 20:58
    Shaun,
    Change your PC_RECEIVED_BYTE_x variables to an Array.

    PC_RECEIVED_BYTE VAR BYTE (10)

    Then you can use PC_RECEIVED_BYTE(0) thru PC_RECEIVED_BYTE(9).

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com

    "I reject your reality, and substitute my own." Mythbusters
    ·
  • SteelSteel Posts: 313
    edited 2006-06-21 21:17
    Thanks, Bean!
  • BeanBean Posts: 8,129
    edited 2006-06-22 01:01
    Note that the SX28 has a limit of 16 element PER array (you can have more than one array that has 16 elements).
    The SX48 supports large arrays (up to the entire array space).
    Bean

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com

    "I reject your reality, and substitute my own." Mythbusters
    ·
Sign In or Register to comment.