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
Temperature = RefSpan * ADC0.
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
Can I use ReadAsInt also instead of ReadAsByte when using as VREF+.
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:
When I need for example (see StringLCD.fcf) two ADC inputs, in the properties at the ADC’s I select then ADC0 and ADC3. But when I look in the properties of the macro then it is called ADC0 and ADC1, why not ADC0 and ADC3.
Has this to do with my problems.
Can someone help me with these problems please.
ADC Problems with FloatToString and Float To Integer with LC
Moderator: Benj
ADC Problems with FloatToString and Float To Integer with LC
- Attachments
-
- FloatLCD.fcf
- (8 KiB) Downloaded 359 times
-
- StringLCD.fcf
- (7.5 KiB) Downloaded 342 times
Taurus
- 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: 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.
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
- (6.5 KiB) Downloaded 415 times
-
- FloatLCD.fcf
- (7 KiB) Downloaded 441 times
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
- 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: ADC Problems with FloatToString and Float To Integer with LC
Read as int would require an initial divide of
100 / 1023
instead of
100 / 255
100 / 1023
instead of
100 / 255
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
Re: ADC Problems with FloatToString and Float To Integer with LC
Hi Benj,
Thanks for your response.
Thanks for your response.
Taurus