Type Casting

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
luthra_arun
Posts: 18
Joined: Wed Nov 11, 2009 7:39 am

Type Casting

Post by luthra_arun »

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.

luthra_arun
Posts: 18
Joined: Wed Nov 11, 2009 7:39 am

Re: Type Casting

Post by luthra_arun »

For the Above post i am sending you the File which i had make.
Type Casting.fcf
(7.5 KiB) Downloaded 352 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: Type Casting

Post by Benj »

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)

Post Reply