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

problem with store the int32 variable in memory...

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



Joined: 09 Aug 2007
Posts: 82
Location: TN, India

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

problem with store the int32 variable in memory...
PostPosted: Wed Mar 18, 2009 11:16 pm     Reply with quote

hi friends,

I have problem with store the int32 variable in memory...I use below function to read and write int32 variable in memory...

Code:

int32 READ_INT32_EEPROM(int32 n)
{
   int i;
   int32 data;
   restart_wdt();
   for (i = 0; i < 4; i++)
   {
        *(&data + i) = read_eeprom(i + n);//i
   }
    return(data);
}
///////////////////////////////////////////////////////////////////////////////
void WRITE_INT32_EEPROM(int32 n, int32 data)
{
    int32 i;
    restart_wdt();   
    for (i = 0; i < 4; i++)
    {
        write_eeprom(i + n, *(&data + i) ) ;
    }
}




pls check the fuction and give solution for problem..... Crying or Very sad
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Mar 18, 2009 11:52 pm     Reply with quote

Look at this CCS FAQ article:
http://www.ccsinfo.com/faq.php?page=write_eeprom_not_byte
Also, read some other forum posts, because a similar topic
was answered only a few hours ago.

In the write routine (in the link above) make these changes:
Quote:

Change 'WRITE_FLOAT_EXT_EEPROM' to 'Write_int32_eeprom'
Change 'float data' to 'int32 data'
Change 'write_ext_eeprom' to 'write_eeprom'


In the read routine (in the link above) make these changes:
Quote:

Change 'float READ_FLOAT_EXT_EEPROM' to 'int32 read_int32_eeprom'
Change 'float data' to 'int32 data'
Change 'read_ext_eeprom' to 'read_eeprom'


The eeprom address must be increased by 4 bytes, each time you
write a new int32 value.
karthickiw



Joined: 09 Aug 2007
Posts: 82
Location: TN, India

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

thank you...
PostPosted: Thu Mar 19, 2009 7:29 am     Reply with quote

thank you... its work Laughing
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