LCD any number

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

User avatar
Jan Lichtenbelt
Posts: 796
Joined: Tue Feb 17, 2009 8:35 pm
Location: Haren GN, the Netherlands
Has thanked: 129 times
Been thanked: 264 times
Contact:

LCD any number

Postby Jan Lichtenbelt » Sun Jan 20, 2013 3:30 pm

Showing variables of the type Int, UInt, Long and ULong on LCD screen gives problems.
Please find a macro to show any number.

This maco shows any number on LCD screen.
Numbers may be boolean, byte, Int, UInt, Long or ULong.

Input:
1) the number
2) the number of bits, which is 1,8,16 or 32 for the positive-only variables and which is 15 or 31 for the positive-negative variables (the sign bit is bit 16 resp. 32)

- boolean =1
- byte =8
- Int =15 (bit 16 is sign bit)
- UInt =16
- Long =31 (bit 32 is sign bit)
- ULong =32

Remark: The LCD connected to a microchips works fine. Only in Flowcode simulation mode, numbers > 2^31 (>0x7FFFFFF) give wrong results *).

Attached is a test program LCD_Any_Number_V1.fcf and the macro LCDAnyNumber.fcm, which can be imported into your program. All variables used are locally declared in the macro.

Success

Jan Lichtenbelt

Note *) Detail Flowcode simulation error:
To get the first digits for number > 2^31 a division by 10^10 is necessary. This division gives wrong results.
Attachments
LCDAnyNumber.fcm
(10.58 KiB) Downloaded 120 times
LCD_Any_Number_V1.fcf
(22.87 KiB) Downloaded 136 times
These users thanked the author Jan Lichtenbelt for the post (total 3):
kersing (Sun Jan 20, 2013 3:39 pm) • medelec35 (Sun Jan 20, 2013 3:45 pm) • Enamul (Sun Jan 20, 2013 7:11 pm)
Rating: 15%
 

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8816
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2559 times
Been thanked: 3715 times
Contact:

Re: LCD any number

Postby medelec35 » Sun Jan 20, 2013 3:47 pm

Hi Jan,
Thanks for showing us how to display large numbers.
Very clever!

An alternative method for showing larger numbers is to use number to string function, then display the string.
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
Jan Lichtenbelt
Posts: 796
Joined: Tue Feb 17, 2009 8:35 pm
Location: Haren GN, the Netherlands
Has thanked: 129 times
Been thanked: 264 times
Contact:

Re: LCD any number

Postby Jan Lichtenbelt » Sun Jan 20, 2013 5:26 pm

Hi Martin,

I know the possibility to transform a number to a string, but that gave me a lot of wrong results. I do not know why.
That is the reason to develop this macro.

Kind regrads

Jan Lichtenbelt

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8816
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2559 times
Been thanked: 3715 times
Contact:

Re: LCD any number

Postby medelec35 » Sun Jan 20, 2013 5:40 pm

Its a very handy macro indeed.

Glad you posted it..

Thanks :)
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.