Shop OBEX P1 Docs P2 Docs Learn Events
tables... — Parallax Forums

tables...

ArynockArynock Posts: 2
edited 2008-09-10 05:08 in BASIC Stamp
Can anyone point me in the right direction on how i can create tables with my basic stamp

i need to create a table that will contain 3 slots

each slot will consist of 4 characters..

also where can i learn how to go about accessing the table?

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-09-10 05:08
    It depends on whether this table needs to be variable or is mostly constant (rarely changing).

    For variable: You're talking about an array. PBasic has single dimension arrays of bytes or words. You'd need to have either two word entries for the 4 characters or four byte entries. You'd have to simulate two dimensions by using explicit multiplication like:
    array(slot*4+offsetWithinSlot)
    where slot is a slot # between 0 and 2 and offsetWithinSlot is a character number between 0 and 3.

    Refer to the section of the PBasic on memory allocation and variables

    For constant:
    You can create the table in part of the EEPROM using the DATA statement and access individual bytes using the READ statement.
    Refer to the sections of the PBasic on the DATA and READ statements for details and examples.
Sign In or Register to comment.