View previous topic :: View next topic |
Author |
Message |
karthickiw
Joined: 09 Aug 2007 Posts: 82 Location: TN, India
|
problem with store the int32 variable in memory... |
Posted: Wed Mar 18, 2009 11:16 pm |
|
|
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..... |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Mar 18, 2009 11:52 pm |
|
|
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
|
thank you... |
Posted: Thu Mar 19, 2009 7:29 am |
|
|
thank you... its work |
|
|
|