View Full Version : tables...

09-10-2008, 11:42 AM
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?

Mike Green
09-10-2008, 12:08 PM
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:
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.