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

Flash card read and write.
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
lucky



Joined: 12 Sep 2003
Posts: 46
Location: South Coast - England

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

CF Write code
PostPosted: Thu Mar 17, 2005 10:42 am     Reply with quote

Young,

Code:

   for(i=compactFlashPosition;i<offset;i++){
      compactFlashPosition++;
      CF_ReadData(0);
   }


is used to seek in to the sector by the required amount of bytes passed in offset.

To write 1536 byes to sector 15 put the first 512 bytes into buffer[0] - buffer[511] and call write_sector(15); then load the second 512 bytes of data into buffer[0] - buffer[511] and call compactFlashWriteBuffer(512,512); then load the third 512 bytes of data into buffer[0] - buffer[511] and call compactFlashWriteBuffer(1024,512);

... I think. Like I said, it has been a long time.

The best way to learn it to just try the code (over and over again) until YOU get it to work. It took me many hours learning to get this working.
_________________
Lucky
www.mpic3.com - MPIC3 player project, Forum, Downloads, Online Shop
young



Joined: 24 Jun 2004
Posts: 285

View user's profile Send private message

PostPosted: Thu Mar 17, 2005 11:54 am     Reply with quote

Thank you Lucky:

Does you imply that my code for write_sector(), and compactFlashWriteBuffer() function are correct, I would like to get your oppinion about my code, is that correct, do I need any other correction?
Guest








PostPosted: Thu Mar 17, 2005 2:48 pm     Reply with quote

I am debuging the program, however, the definition of buffer[512] is out of range, I checked the RAM of 16f877a, the maximum expand of each bank upto 128 byte. according to this the program has to be changed.
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Thu Mar 17, 2005 2:54 pm     Reply with quote

Use a PIC18! or you will have to add external RAM or FRAM
Guest








PostPosted: Thu Mar 17, 2005 2:57 pm     Reply with quote

Thank you mark:

Thank you for you suggestion, I will try on the 18f chips. by the way, you said about the add external ram, or fram, would you please add some clue how and what kinds of ram or fram on the market?
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Thu Mar 17, 2005 3:13 pm     Reply with quote

You will need to store at least 512 bytes to do the writes. If the micro does not have enough RAM, you will have to use external. FRAM memory is the same as a serial eeprom except the writes are instance and virtually unlimited write cycles. Another option would be to use an external SRAM chip. Search for the MP3 projects on the net and you will find some examples of SRAM usage.
lucky - not logged in
Guest







CF Writes
PostPosted: Fri Mar 18, 2005 10:34 am     Reply with quote

I use the 18F452, its a great chip with loads of space. Mark is correct, you will need 512 bytes to write.
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