How to show decimal points on a LCD

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
dawladin
Posts: 13
Joined: Mon Feb 04, 2013 12:05 pm
Has thanked: 4 times
Been thanked: 1 time
Contact:

How to show decimal points on a LCD

Post 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

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

Re: How to show decimal points on a LCD

Post 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
Attachments
flt to str exmp.fcf
(5.5 KiB) Downloaded 346 times
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

dawladin
Posts: 13
Joined: Mon Feb 04, 2013 12:05 pm
Has thanked: 4 times
Been thanked: 1 time
Contact:

Re: How to show decimal points on a LCD

Post by dawladin »

Thank you Dazz

It worked perfectly once again :)

Regards Michael

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

Re: How to show decimal points on a LCD

Post by dazz »

glad it worked
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: How to show decimal points on a LCD

Post 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
Attachments
flt to str exmp V1 With Rounding.fcf
(7.5 KiB) Downloaded 321 times
Martin

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

Re: How to show decimal points on a LCD

Post 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.
Attachments
decimal_pt_dis_v4.fcf
(8 KiB) Downloaded 326 times
Enamul
University of Nottingham
enamul4mm@gmail.com

dawladin
Posts: 13
Joined: Mon Feb 04, 2013 12:05 pm
Has thanked: 4 times
Been thanked: 1 time
Contact:

Re: How to show decimal points on a LCD

Post 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

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

Re: How to show decimal points on a LCD

Post 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?
Enamul
University of Nottingham
enamul4mm@gmail.com

dawladin
Posts: 13
Joined: Mon Feb 04, 2013 12:05 pm
Has thanked: 4 times
Been thanked: 1 time
Contact:

Re: How to show decimal points on a LCD

Post 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
Attachments
Eksamensprojekt -test-Power Failure Atmega 8.fcf_avr
(26.87 KiB) Downloaded 289 times

Post Reply