Int2float

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
User avatar
Jan Lichtenbelt
Posts: 797
Joined: Tue Feb 17, 2009 8:35 pm
Location: Haren GN, the Netherlands
Has thanked: 128 times
Been thanked: 264 times
Contact:

Int2float

Post 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.
Attachments
Test2.fcf
(9.5 KiB) Downloaded 236 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Int2float

Post by Benj »

Hello Jan,

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

User avatar
Jan Lichtenbelt
Posts: 797
Joined: Tue Feb 17, 2009 8:35 pm
Location: Haren GN, the Netherlands
Has thanked: 128 times
Been thanked: 264 times
Contact:

Re: Int2float

Post 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

Post Reply