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.
I want to use full 256 bytes of RAM of 89S52. I am neither using Interrupts nor Timers. KEIL gives error of overflow over 128 bytes. I want to use SFRs RAM area to be included for my program(for float variable). Actually i m using LCD 20x4 for lots of variable display. So far no problem
//Ascii Conversion temp=adc_int_variable/10; temp1=temp/10; buffer[4]=adc_int_variable%10+0x30; // Last digit buffer[3]=temp%10+0x30; buffer[2]=0x2E; //decimal point buffer[1]=temp1%10+0x30; buffer[0]=temp1/10+0x30; //simply> sprintf(buffer,"%u ",adc_int_variable);
But if i m using some mathematical calculation and result is in float variable then i have to use sprintf, that causes Overflow of RAM. Please help to lighten the load of "sprintf" function or to use the other 128-stack area.
Thanx all for help.
Why do you use floating point? Can't you use fixed point Beacause I m using some mathematical expression that results float variable(result is in 2 decimal place) If i will use integer, then Result of mathematical expression will not be accurate. your example
sprintf(buf,"%u.%03u volt",v/1000,v%1000);
is related to integer variable converted to fixed point display. I m saying FLOAT variable! please help
No, my example is how a fixed point value (representing a number with decimals) is presented as if it was a floating point value with three decimals.
A fixed-point number is an integer where some of the digits are considered to represent decimals. It is just that the decimal point is at a fixed point, and not floating.
You can do quite a lot of numeric operations with fixed point solutions. Everything from computing sqr(17) with 1k decimals to computing sin(n) where n is also a fixed point value.
The specific thing about fixed point is that a processor with limited word length can produce results with just about any number of digits (or decimals) and that you in many situations may be able to produce exact answers, where a fp equation results in an approximation since the fp numbers are normalized and are treating the decimal parts as a sum of 1/(2^n) terms.
How do you store something as simple as 0.3 using floating point?
1/4 + 1/32 + 1/64 + 1/512 + 1/1024 + 1/8192 + 1/16384 + ...
Thanks a lot!