Convert float to char in 89C51

Status
Not open for further replies.

zeby

Newbie level 1
Joined
Feb 10, 2006
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,288
hey

i would like to convert a float number (ie: 0.0433) into a IEEE char[32]
i need this function in order to save a float number in an eeprom of 8bits words

can u help me?

Zeb
 

You could try sprintf?

char buffer[SIZE_OF_FLOAT];

float myFloat = 0.0433;

sprintf(buffer, "%f", myFloat);
 

I think the article "Output Real Numbers", Circuit Cellar #187, February 2006 can help you. The article implements a float to ASCII function.

Regards,
 

#define byte unsigned char

byte *app_float;
float var = 1.232;

app_float = &var;

write_eeprom(*app_float++);
write_eeprom(*app_float++);
write_eeprom(*app_float++);
write_eeprom(*app_float);

it is correct?
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…