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

internal eeprom management

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
altra22



Joined: 14 May 2007
Posts: 11

View user's profile Send private message

internal eeprom management
PostPosted: Sat Jan 01, 2011 1:39 pm     Reply with quote

Hi All
Can I implement ex_malloc.c example to internal eeprom ? My PIC is 16F876A which has 256 byte of EEPROM. I want to store users and delete users (Rarely).
So I cannot do it while run-time via Serial interface. In other memories
when the PIC Power fail/down all variables are gone so I am going to store about 100 bytes ->10 users 9 char +null character in EEPROM.
But should I store also the pointers and structures to EEPROM
Code:

   write_eeprom(i,num);
   write_eeprom(i,key);
   write_eeprom(i,count);
   write_eeprom(i,* beginCell);
   write_eeprom(i,* endCell);
   write_eeprom(i,* pCell);
   write_eeprom(i,* pCell2);

No simulators here but real hardware. My version 4.105.

Thanks in Advance
Ttelmah



Joined: 11 Mar 2010
Posts: 19535

View user's profile Send private message

PostPosted: Sat Jan 01, 2011 2:37 pm     Reply with quote

Realistically, just do it yourself.
Malloc is too complex for what you describe.
Just treat the entries as 'records' Add a flag to say that the record is active (why would you want a null, this is part of string management....). Store this as a separate array at the start of the EEPROM. Then on boot up, just read these flags. If it is non zero (active), read the nine byte record and transfer to your RAM array (and add the termination). If it is zero, advance to the next record. When you need to add a record, just look for the first zero flag. Effectively you are implementing a very crude 'FAT' system.

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
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