floating point value into eeprom??????

Status
Not open for further replies.

veer

Newbie level 4
Joined
Apr 28, 2003
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
42
hi,

i am using ADuC812 which has 2k eeprom, single page containing 4bytes and each byte can be assigned independently .The problem is to write a floating point value into eeprom.i am using keil complier.shld i go for ieee754 format representation or is there any other wayout.

kindly reply,
veer.
 

Hi,

you could use an union like this

union
{
float value;
unsigned char bytevalue[4];
}variable;

When you want to write your float value to eeprom use a loop like this

for(i=0; i < 4; i++)
eeprom_write(variable.bytevalue);

hope this helps
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…