We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
dear friends
i would like to know how can we convert the ascii values to decimal values to perform some calculations. my requirement is that i am receiving a six digit ascii data via com port of AT 89c52.now i have to perform some calculations with this value and send back via comport.so first i have tonvert the receiving ASCII value to a float value, then after the necessary calculations i've to convert the result again to ASCII to send via com port.can anyone provide some idea ?
sunish
http://www.keil.com/support/man/docs/c51/c51_modf.htm
"we have to extract every digits from the float value.how is it possible?"
This is only possible, if you mean binary digits.
Every real number can not be exactly stored as a floating point number. Because of this, a floating point value does not always convert exactly to the decimal number you expect.
The extracted number may for example look like 2.99999999997.
Because of this, you normally do not want to make an exact extract, but want to round the number to a reasonable number of digits. This is what happens when using sprintf() with the %g conversion - it tries to establish the real number of value digits in the floating point number.