Location - is an optional constant which specifies where to begin storing the data in the program memory table. If no location is specified, storage continues from where it last left off. If no location was initially specified, storage begins at 0.
Data - are byte constants (0-255) which will be stored in the table.
Specify values to be loaded to the internal lookup table when the program is downloaded.
M2 parts have 512 locations (0-511). These are separate to the 2048 bytes of program memory, so do not affect program length.
X1 and X2 parts have 256 locations (0-255). When table is used these reduce the overall program memory capacity of these parts (4096 - 256)
This is not an instruction, but a method of pre-loading the microcontroller's program memory lookup table. The data can then be read via the readtable command (the data is fixed, cannot be altered apart from at program download). The tablecopy command may be used to copy the table data to RAM in sections.
When used in a program the data table is accessible only to the program within the slot the table is defined within; the table data cannot be accessed from other slots using readtable or tablecopy commands. Each program slot using readtable or tablecopy commands should have its own 'table' defined.
Please note the 'table' command is only supported for 18M2 firmware D.x (PICAXE chips labelled 18M2+) and is not available for use with 18M2 firmware 2.x (PICAXE chips labelled 18M2).
The PICAXE compiler will syntax check code for an 18M2 as correct when using the 'table' command but will generate an error when an attempt is made to download into an older 18M2 with firmware 2.x.
Define table data
Define table data values then read the table and show those table data values read
Submit Your Own Code!
You must be logged in to submit code examples. Login now.