Print Formatted Number - I2C LCD - Not working

A forums to allow bugs and problems with Flowcode v7 to be reported and resolved.

Moderator: Benj

Post Reply
User avatar
Jay Dee
Posts: 398
Joined: Tue Aug 18, 2009 6:42 pm
Has thanked: 121 times
Been thanked: 154 times
Contact:

Print Formatted Number - I2C LCD - Not working

Post by Jay Dee »

Hi guys,
I'm pretty sure this is a bug, not me being a clunk.... maybe!
I am using the i2C LCD component and cant print ULong values, Im using the PrintFormattedNumber function.
Both simulate OK.

I also could not get a good result using a conventional 2x20 LCD, it output a value but is not what I expected.
Example FC attached.
Display_ULong.fcfx
example
(13.24 KiB) Downloaded 272 times
Any thoughts?
thanks, J.

User avatar
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: Print Formatted Number - I2C LCD - Not working

Post by Benj »

Hello,

The problem is not the print routine, it seems to be the calculation that is causing it.

If you change your calculation from

Code: Select all

Ans_ULong = Arg1_U16 * Arg2_U16
To

Code: Select all

Ans_ULong = Arg1_U16
Ans_ULong = Ans_ULong * Arg2_U16
Then it should work as expected.

The first is cast as a 16-bit value when performing the calculation and then assigned to the 32-bit value.

The second uses a 32-bit value in the calculation and so forces the result to also be 32-bit.

User avatar
Jay Dee
Posts: 398
Joined: Tue Aug 18, 2009 6:42 pm
Has thanked: 121 times
Been thanked: 154 times
Contact:

Re: Print Formatted Number - I2C LCD - Not working

Post by Jay Dee »

Hi Ben,
Thanks for the quick response. I made the change as advised.
Display_ULong2.fcfx
(12.5 KiB) Downloaded 295 times
This now work for the conventional 2x20 LCD,
but still nothing being displayed on the i2C LCD display.
regards, J.

User avatar
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: Print Formatted Number - I2C LCD - Not working

Post by Benj »

Thanks for letting us know.

I believe I have now found and fixed the problem but have a go and see how you get on.
lcd_I2C.fcpx
(26.12 KiB) Downloaded 291 times

User avatar
Jay Dee
Posts: 398
Joined: Tue Aug 18, 2009 6:42 pm
Has thanked: 121 times
Been thanked: 154 times
Contact:

Re: Print Formatted Number - I2C LCD - Not working

Post by Jay Dee »

Thanks Ben,
Excellent, that all works with my Hardware.
Promptly resolved and its much appreciated.
J.

Post Reply