Shop OBEX P1 Docs P2 Docs Learn Events
Maximum array size on a BS2 — Parallax Forums

Maximum array size on a BS2

ColinColin Posts: 1
edited 2006-09-12 13:56 in BASIC Stamp
I have read in the Parallax stamp manual that the largest value of an array can be ten elements (subscript value 0 thru 9), but when I compile a program in Basic Stamp Editor it accepts·up to 26 byte size elements before an 'out of variable space' error. Can I safely run a program with a·greater than 10 element array ? thanks.

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-09-09 12:28
    Colin -

    I know of no array size restriction, up to the limit of the unasigned memory available. Once you reach that point, an error messsage will be issued.

    PBASIC does not make any range checks and makes no presumptions about subscripts or array size. In fact, even if undeclared, any PBASIC variable can be treated like an array! Real nice feature when you need it.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-09-11 15:12
    Yes, you can have an array up to 26 bytes -- but if you do, you won't have any 'temp' memory locations to process data with. Still, it's possible.
  • Tom WalkerTom Walker Posts: 509
    edited 2006-09-12 13:56
    To re-word what the above have stated, the BS2 has 26 bytes available as RAM, or variable, space. If you have no need for any other variables in your program, then you can use that space as a 26 byte or 13 word array.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Truly Understand the Fundamentals and the Path will be so much easier...
Sign In or Register to comment.