Page 1 of 1

How to show decimal points on a LCD

Posted: Tue Mar 05, 2013 8:58 pm
by dawladin
Hello mods and Flowcode experts :)

I was wondering if there was any solution to the problem that bytes dose not tolerate decimal points in calculations.
The problem im facing is quite simple i got a variable [var = var + 0.5] and i want to show the var value on a LCD.

Thanks before hand.

Regard Michael

Re: How to show decimal points on a LCD

Posted: Tue Mar 05, 2013 9:15 pm
by dazz
Hi
Havent got much time so made a simple chart for you , create varialble as a Float, then use float to string to print string to lcd

let me know if it works

Regards
Dazz

Re: How to show decimal points on a LCD

Posted: Tue Mar 05, 2013 10:13 pm
by dawladin
Thank you Dazz

It worked perfectly once again :)

Regards Michael

Re: How to show decimal points on a LCD

Posted: Tue Mar 05, 2013 10:59 pm
by dazz
glad it worked

Re: How to show decimal points on a LCD

Posted: Tue Mar 05, 2013 11:18 pm
by medelec35
Hi Michael,
Attached is another flowchart to play with.
It's a bit more complex, but it allows you to alter at the beginning how many decimal places you require.

I believe there is a slight bug with V4 causing rounding to be simulated only. Will not round on hardware.
Works just fine on Flowcode V5 .

Martin

Re: How to show decimal points on a LCD

Posted: Wed Mar 06, 2013 12:03 am
by Enamul
Hi

Although I believe to deal with decimal numbers floating point and in LCD float2str is useful. But for only one or two decimal place addition and adding decimal number with byte, I must recommend normal arithmetic operation than using Float as that uses huge memory and really slow.
Rather I have put an example to show any number with one decimal point can be easily managed with addition and decision.

Re: How to show decimal points on a LCD

Posted: Wed Mar 13, 2013 7:08 pm
by dawladin
Hi guys
Thanks for the reply's :)

I was wondering what were the advantage of those 2 programs over the simple program dazz made? (I need to show 0.5,1,1.5,2,2.5,3.....)
And i got one more thing when i simulate it, it works but when i send it to the chip it wont show the decimal value eg (1.0,1.0,2.0,2.0,3.0.....)
Why is that and what can i do about im using an ATmega8-16pu.

Regards Michael

Re: How to show decimal points on a LCD

Posted: Thu Mar 14, 2013 12:51 am
by Enamul
I was wondering what were the advantage of those 2 programs over the simple program dazz made? (I need to show 0.5,1,1.5,2,2.5,3.....)
I have mentioned the advantage in my last post..you can't accommodate float data manipulation in small memory chip.
And i got one more thing when i simulate it, it works but when i send it to the chip it wont show the decimal value eg (1.0,1.0,2.0,2.0,3.0.....)
Also this can happen if not done carefully. Can you please post your code so that we can see?

Re: How to show decimal points on a LCD

Posted: Thu Mar 14, 2013 10:37 am
by dawladin
Okay I apologize for the ignorance but im still trying to get the hang of it :)

But here is the program :)

Regards Michael