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.
Any thoughts?
thanks, J.
Print Formatted Number - I2C LCD - Not working
Moderator: Benj
- 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
Hello,
The problem is not the print routine, it seems to be the calculation that is causing it.
If you change your calculation from
To
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.
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
Code: Select all
Ans_ULong = Arg1_U16
Ans_ULong = Ans_ULong * Arg2_U16
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- 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
Hi Ben,
Thanks for the quick response. I made the change as advised. This now work for the conventional 2x20 LCD,
but still nothing being displayed on the i2C LCD display.
regards, J.
Thanks for the quick response. I made the change as advised. This now work for the conventional 2x20 LCD,
but still nothing being displayed on the i2C LCD display.
regards, J.
- 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
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.
I believe I have now found and fixed the problem but have a go and see how you get on.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- 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
Thanks Ben,
Excellent, that all works with my Hardware.
Promptly resolved and its much appreciated.
J.
Excellent, that all works with my Hardware.
Promptly resolved and its much appreciated.
J.