Hi to all,
I am getting the problem with splitting the float variable into two Bytes in the Flowcode simulation it is working but on the actual h/w the value of higher byte and lower byte are 0 and 0 respectively.I had check all the parameters like clock freq,MCU configuration.The other program are running on the same h/w
even splitting the integer in to byte is also working .Splitting the float into byte is not working.
Type Casting
Moderator: Benj
-
luthra_arun
- Posts: 18
- Joined: Wed Nov 11, 2009 7:39 am
- 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: Type Casting
Hello Luthra
Your program should compile and run correctly on the hardware if you use the HITECH compiler (Flowcode v4.2) which can nativly support floating point variables.
If you want to keep using BoostC then you will have to use the floating poing functions located in the functions window of the calculation icon properties.
Eg instead of
Float_Test = Float_Test * 10
You would need
Float_Test = fmul(Float_Test, 10)
Likewise to convert between floating point and other variables with BoostC you will need to use something like this.
Flowcode_Int_Var = float2int(Float_Test)
Your program should compile and run correctly on the hardware if you use the HITECH compiler (Flowcode v4.2) which can nativly support floating point variables.
If you want to keep using BoostC then you will have to use the floating poing functions located in the functions window of the calculation icon properties.
Eg instead of
Float_Test = Float_Test * 10
You would need
Float_Test = fmul(Float_Test, 10)
Likewise to convert between floating point and other variables with BoostC you will need to use something like this.
Flowcode_Int_Var = float2int(Float_Test)
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