A lookup table is a list of values stored in the microcontroller’s memory and accessed using ReadTable
.
Key Features
- Efficient memory usage
- Supports
byte
,word
,long
, andinteger
types - ASCII string definitions supported
- Constants and inline calculations permitted
- External data sources allowed
Note: Decimal values are not supported
Contents
Table TestDataSource 12 24 36 48 60 72 End Table
Table TestDataSource 12, 24, 36 48, 60, 72 End Table
#define calculation_constant 2 Table TestDataSource 1 * calculation_constant 2 * calculation_constant 3 * calculation_constant 8 * calculation_constant 4 * calculation_constant 5 * calculation_constant End Table
Table Test_1 "ABCDEFGHIJ" End Table
Table MnuTxt_1 " Display_1 Display_2 Display_3 " End Table Table MnuTxt_2 "1: Display" "2: System Setup" "3: Config 1" "4: Config 2" "5: Data Log" "6: Diagnostic" "7: Help+" End Table
"String1", "String2", "String3"
"String1String2String3"
"String1"
"String2"
"String3"
Escape | Meaning |
---|---|
\a |
Beep |
\b |
Backspace |
\f |
Formfeed |
\n or \l |
Newline |
\r |
Carriage Return |
\t |
Tab |
\0 |
Null value (ASCII 0) |
\&nnn |
ASCII character (decimal) |
\\ |
Backslash |
\" |
Double quote |
\' |
Single quote |
Dim TableCounter, Invalue as byte CLS For TableCounter = 1 to 6 ReadTable TestDataSource, TableCounter, Invalue Print InValue Print "," Next
Dim lengthoftable as word ReadTable TestDataSource, 0, lengthoftable Print lengthoftable
#chip 16f877a Table TestDataSource from "sourcefile.raw" For nn = 1 to 10 ReadTable TestDataSource, nn, inc Print inc Next
#chip 16F628 TableLoc = 2 ReadTable TestDataSource, TableLoc, SomeVar EPWrite 1, 45 'Optional write Table TestDataSource Store Data 12 24 36 48 60 72 End Table
- Only
BYTE
values are supported WORD
,INTEGER
, orLONG
are not compatible with EEPROM tables
See: ReadTable