electronics forum

Rules | Recent posts | topic RSS | Search | Register  | Log in

Convert float to char in 89C51


Post new topic  Reply to topic    EDAboard.com Forum Index -> Microcontrollers -> Convert float to char in 89C51
Author Message
zeby



Joined: 10 Feb 2006
Posts: 1


Post10 Feb 2006 16:00   

Convert float to char in 89C51


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
Back to top
btbass



Joined: 20 Jul 2001
Posts: 1187
Helped: 113
Location: Oberon


Post10 Feb 2006 19:27   

Convert float to char in 89C51


You could try sprintf?

char buffer[SIZE_OF_FLOAT];

float myFloat = 0.0433;

sprintf(buffer, "%f", myFloat);
Back to top
Google
AdSense
Google Adsense




Post10 Feb 2006 19:27   

Ads




Back to top
svicent



Joined: 11 Jul 2001
Posts: 413
Helped: 23


Post10 Feb 2006 19:39   

Re: Convert float to char in 89C51


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

Regards,
Back to top
eletro



Joined: 12 Sep 2002
Posts: 28
Location: Moon


Post11 Mar 2006 21:06   

Re: Convert float to char in 89C51


#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?
Back to top
Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
Post new topic  Reply to topic    EDAboard.com Forum Index -> Microcontrollers -> Convert float to char in 89C51
Page 1 of 1 All times are GMT + 1 Hour
Similar topics:
float to char (8)
convert double to char array (3)
how to convert float to string using HEW(renesas) (2)
float net and float pin in netlist (2)
how i am convert asm to hex file for 89c51 atmal help me (6)
char=int (9)
custom char LCD (1)
Char Array to double (5)
Graphics on Char LCD? (4)
Mux with comma char (3)


Abuse || Administrator || Moderators || Support us || sitemap
topic RSS