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 support@ccsinfo.com

Need help on int32 number storage to external memory

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



Joined: 13 Sep 2003
Posts: 87

View user's profile Send private message

Need help on int32 number storage to external memory
PostPosted: Wed Dec 17, 2003 8:24 pm     Reply with quote

Hello,

Anybody in the forum/community who can provide me any help on how to store an unsigned int32 variable to an external memory using I2C (e.g. FM24C256)?

A sample code snippet would help?

Thanx
fpgeh



Joined: 07 Sep 2003
Posts: 19
Location: Vancouver, BC

View user's profile Send private message

PostPosted: Wed Dec 17, 2003 8:49 pm     Reply with quote

Assuming you have the CCS compilier, look in the "drivers" directory for the file "24256.c" and in the "examples" directory for "ex_extee.c".

To break the 32 bit value into bytes you can use the "make8" built-in function.
ritchie



Joined: 13 Sep 2003
Posts: 87

View user's profile Send private message

PostPosted: Wed Dec 17, 2003 10:14 pm     Reply with quote

fpgeh wrote:
Assuming you have the CCS compilier, look in the "drivers" directory for the file "24256.c" and in the "examples" directory for "ex_extee.c".

To break the 32 bit value into bytes you can use the "make8" built-in function.


Thank u for the info in using the built-in make8() function of the CCS compiler.

Would it be possible using also the page write method in storing int32 numbers to external memory? Any ideas on how to do this? maybe a sample snippet will help...

Thanx
Guest








PostPosted: Thu Dec 18, 2003 1:28 am     Reply with quote

ritchie wrote:

Thank u for the info in using the built-in make8() function of the CCS compiler.

Would it be possible using also the page write method in storing int32 numbers to external memory? Any ideas on how to do this? maybe a sample snippet will help...

Thanx


I hope this would help......

Code:

//************************************************************************
void write_fram_int32(
   //unsigned int32 uAddress,   // memory address to write data
   unsigned int8 uAddress,
   unsigned int32 uData)      // put your data here
{
   //unsigned int32 dummy;
   unsigned int8 dummy;

   for (dummy=0; dummy<4; dummy++)
      write_fram_byte(dummy+uAddress,*(&uData+dummy));
}

//************************************************************************
unsigned int32 read_fram_int32(
   //unsigned int32 uAddress)   // specify memory address to read data
   unsigned int8 uAddress)
{
   //unsigned int32 dummy;
   unsigned int8 dummy;
   unsigned int32 uData;
   
   for (dummy=0; dummy<4; dummy++)
      *(&uData+dummy) = read_fram_byte(dummy+uAddress);
     
   return(uData);
}


happy coding >>>>>
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