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

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

LCD any number

Post by Jan Lichtenbelt »

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 275 times
LCD_Any_Number_V1.fcf
(22.87 KiB) Downloaded 296 times

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: LCD any number

Post by medelec35 »

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

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

Re: LCD any number

Post by Jan Lichtenbelt »

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

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: LCD any number

Post by medelec35 »

Its a very handy macro indeed.

Glad you posted it..

Thanks :)
Martin

Post Reply