## ADC Problems with FloatToString and Float To Integer with LC

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

Taurus
Flowcode V4 User
Posts: 46
Joined: Tue Feb 23, 2010 3:58 pm
Has thanked: 3 times

### ADC Problems with FloatToString and Float To Integer with LC

Because I canβ€™t find good information how to use the VREF+ with Flowcode V4, I do it this way: I am looking for more information about the VREF+ or a good sample, also for the VREF-spanning?

I want to use the Lm35 as a temperature sensor.
When I understand it right, the temperature should range from 0 to 100 degrees Celsius. The sensor is 10mV/C. Let us say 10mV = 1degree Celsius and 1000mV is 100 degrees Celsius.

For the Lm35 I take ADC0 and set the VREF+ option to VREF+ in the properties.
The ADC3 I use as reference and set in the properties the VREF+ option as VDD and put 1 volt on this input.

To get the temperature on the display, I calculate this in the following way:
RefSpan=1000/255

Question 1
Is it correct that now the voltage from 0 to 1 V (Lm35) on ADC0 are equal pieces from 0 to 255 steps.

Question 2
How should I use it in this case.

Question 3 (See program StringLCD.fcf)
Why doesnβ€™t the FloatToString work with the ADC and LCD when using the PIC;
with the simulation it works.

Question 4 (see program FloatLCD.fcf)
Here I try to change Float in an integer for the LCD when using the PIC,
with the simulation it works.

With the PIC, both programs donβ€™t give the right information on the display.

I did ask Ben Rowland before and he thought it belongs on the forum.
I think it belongs in a good help file.

In a similar question on the forum he gives as an answer:
β€If it is a calculation then maybe you can simply store the result in a float variable. Then convert the float to a string and send the string to the LCD.β€

This is what I tried to do, but it didnβ€™t work

Another thing I donβ€™t understand is:
Has this to do with my problems.

Can someone help me with these problems please.
Attachments
FloatLCD.fcf
StringLCD.fcf
Taurus

Benj
Matrix Staff
Posts: 14219
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4361 times
Been thanked: 4096 times
Contact:

### Re: ADC Problems with FloatToString and Float To Integer with LC

Hello

Here is an updated version of your programs that should now work correctly on the hardware. The problem was due to the fact that BoostC requires all float manipulations to be done via functions.
Attachments
StringLCD.fcf
FloatLCD.fcf

Benj
Matrix Staff
Posts: 14219
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4361 times
Been thanked: 4096 times
Contact:

### Re: ADC Problems with FloatToString and Float To Integer with LC

Read as int would require an initial divide of

100 / 1023

100 / 255

Taurus
Flowcode V4 User
Posts: 46
Joined: Tue Feb 23, 2010 3:58 pm
Has thanked: 3 times

Hi Benj,