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.
Int2float
Moderator: Benj
- 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:
- 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
Hello Jan,
In your program you are enabling timer 0 but disabling timer 1. Could this be the source of the problem?
In your program you are enabling timer 0 but disabling timer 1. Could this be the source of the problem?
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- 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
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
You are right.Because timer 1 is going on, the variable Count will change with time, also after the int2float equation.
Kind regards
Jan