PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Mar 21, 2006 5:12 pm |
|
|
Quote: |
I’m trying to store values in a float variable. The my problem is that the
maximum value I can store is 1410.065408 when I need to Store values
till 9999.99. |
In the program below, the 'value' variable is set to 9999.99 and
the printf statement displays this:
Code: |
#include <16F877.H>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
//============================
void main()
{
float value;
value = 9999.99;
printf("Value = %7.2f", value);
while(1);
} |
This was compiled and tested with PCM vs. 3.245. |
|