CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

18F4480 as a math student.Can it keep up to these equations?
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Ttelmah
Guest







PostPosted: Sun Jun 07, 2009 2:18 am     Reply with quote

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

View user's profile Send private message Visit poster's website

PostPosted: Sun Jun 07, 2009 6:29 am     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
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