 |
 |
| View previous topic :: View next topic |
| Author |
Message |
Ttelmah Guest
|
|
Posted: Sun Jun 07, 2009 2:18 am |
|
|
All you do, is declare a normal array, that is empty.
int8 ECO_MODE[256];
Then perform the maths to fill the table, once, before you need to use it, based on the user input.
Best Wishes |
|
 |
andrewg
Joined: 17 Aug 2005 Posts: 316 Location: Perth, Western Australia
|
|
Posted: Sun Jun 07, 2009 6:29 am |
|
|
Oh, sorry. Look up read_program_eeprom(), write_program_eeprom() and label_address(). The manual doesn't explain label_address very well, but the CCS HTTP server uses it similar to:
| Code: | const char table[256];
...
int32 addr = label_address(table);
...
write_program_memory(addr, data, len); | Since program memory is flash and is paged, use #org to align the buffer with a page boundary and give it a length an exact multiple of the page size. Pages are usually something like 8, 16, or 32 bytes (see data sheet), so a 256 byte lookup table will be fine for any of those. If it's not page aligned it won't be erased properly by write_program_eprom(). If the end of the #org isn't page aligned, things allocated after it will be erased when the last page is written to.
Having said all that, why not just save the user input in data EEPROM and keep the current lookup table in RAM? _________________ Andrew |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|