Page 1 of 1

Int2float

Posted: Sat Jul 02, 2011 8:41 pm
by Jan Lichtenbelt
I get lost. I have the byte Count and the float Sin3. To convert Count from byte to float I use the euqation:
sin3 = int2float(Count).
In the simulation this works correct, but in the PIC877A the byte Count=203 will be converted into the float Sin3 = 200.0000.

See test2 file at the main macro next to remark "Here the Count(byte) will be converted into Sin3 (float)"

What do I wrong?

Regards,

Jan Lichtenbelt

PS. In the meanwhile I find out that any mathematical equation on this place gives wrong results.

Re: Int2float

Posted: Tue Jul 05, 2011 10:23 am
by Benj
Hello Jan,

In your program you are enabling timer 0 but disabling timer 1. Could this be the source of the problem?

Re: Int2float

Posted: Wed Jul 06, 2011 7:51 pm
by Jan Lichtenbelt
Hi Ben,

You are right.Because timer 1 is going on, the variable Count will change with time, also after the int2float equation.


Kind regards

Jan