float

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
Tony Brown
Posts: 81
Joined: Wed Jun 20, 2012 9:59 pm
Has thanked: 36 times
Been thanked: 5 times

float

Post by Tony Brown »

Can anyone please tell me if I can use the float function in flowcode 5 for pic?

It will not let me select it, maybe im doing something wrong.

Thanks

Tony

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 25 times
Been thanked: 188 times
Contact:

Re: float

Post by Jordy101091 »

what do you mean by
It will not let me select it, maybe im doing something wrong.
maybe the variable that your are using is not a floating point type.

Regards Jordy
the will to learn, should not be stopped by any price

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times

Re: float

Post by Enamul »

Hi
Can you please give an example which float function you tried but can't use as we can use any float function in fcv5
Enamul
University of Nottingham
enamul4mm@gmail.com

Tony Brown
Posts: 81
Joined: Wed Jun 20, 2012 9:59 pm
Has thanked: 36 times
Been thanked: 5 times

Re: float

Post by Tony Brown »

Basically I'm trying to read the values from the ADC as volts, but I want two places after a decimal point, and looking at other examples on the forum decided to try using the float command, but I cant work out how to select the float command from the list that appears when you select what format (I think this is the correct word) you want the values in.

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times

Re: float

Post by dazz »

Hi Tony

have you set your variable to a float

Regards
Dazz
Untitled.jpg
Untitled.jpg (70.89 KiB) Viewed 7341 times
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times

Re: float

Post by Enamul »

Hi Tony,
Here is a simplest example of using ADC as volt read where ADC is declared as FLOAT variable. But the float variable can't be displayed in LCD as it is as LCD can display BYTE or INT variables. That's why using float to string function I have converted the float variable to string (i.e., DISP_STR). Float variable has precision up to 6 decimal points but the voltage is just up to 2 decimal points that's why I have taken only 2 decimal places using Left string function.
Hope this will help to start. :)
Attachments
ADC_Float.fcf
(9 KiB) Downloaded 331 times
Enamul
University of Nottingham
enamul4mm@gmail.com

Tony Brown
Posts: 81
Joined: Wed Jun 20, 2012 9:59 pm
Has thanked: 36 times
Been thanked: 5 times

Re: float

Post by Tony Brown »

Thanks Enamul thats brilliant, how would I make it so that instead of the numbers after the decimal point going up in steps of 5 it would go up in increments of 1?

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times

Re: float

Post by Enamul »

Hi Tony,
Are you looking for 5V range or higher? Number in first decimal place is going up by 1 and in second decimal place by 5 seems in simulation...So do you want to have 2nd decimal point change by 1 as well?

I have changed the Vref =1.25V, You have much finer resolution now..
Attachments
ADC_Float_v1.fcf
(9 KiB) Downloaded 289 times
Enamul
University of Nottingham
enamul4mm@gmail.com

Tony Brown
Posts: 81
Joined: Wed Jun 20, 2012 9:59 pm
Has thanked: 36 times
Been thanked: 5 times

Re: float

Post by Tony Brown »

Hi Enamul I am wanting to read the voltage of a board under test, its voltage is 24V, I am passing this through several potential divider to drop the voltage to 3V = 24V.

This is what I am wanting to read from the ADC and print on my GLCD. This test is quite critical so IO am using 0.1% resistors.

Thanks by the way for the extra flowcode file.

Regards

Tony

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times

Re: float

Post by Enamul »

Hi Tony,
This version is with Vref=5V and I have modified the program so that it can read 0-5v in ADC input but produces output 0 to 40V which represents 3V equal to 24V as you have mentioned. You can test in hardware with normal LCD and adjust the resistor network. I think in hardware you will get finer resolution than simulation.
Hope this will help.
Attachments
ADC_Float_v2.fcf
(10 KiB) Downloaded 302 times
Enamul
University of Nottingham
enamul4mm@gmail.com

Tony Brown
Posts: 81
Joined: Wed Jun 20, 2012 9:59 pm
Has thanked: 36 times
Been thanked: 5 times

Re: float

Post by Tony Brown »

Hi Enamul

That's BRILLIANT thankyou very much

Regards

Tony

Post Reply