Page 1 of 1

Display string issue

Posted: Fri Nov 14, 2014 3:47 pm
by medelec35
The attached flowchart should take an integer value of 267 and display 26.7
Flowchart.png
(8.39 KiB) Downloaded 1406 times
Flowcode simulator shows:
LCD1.png
(2.91 KiB) Downloaded 1406 times
Hardware is the same as real pic which shows:
LCD2.png
(1.34 KiB) Downloaded 1406 times
Not sure why only the last byte of the string is displayed.
I'm hoping to save some memory and use:

Code: Select all

Temp_String = Left$ (Temp_String,2) + "." + Right$ (Temp_String,1)
Martin

Re: Display string issue

Posted: Mon Nov 17, 2014 10:07 am
by LeighM
Hi Martin,
Thanks for the detailed bug report.
We do have some known problems with the generated target code for string concatenation (mainly due to memory constraints on target and the use of temporary buffers)
I’ll try and raise the priority of this issue.
In the meantime, the workaround is to avoid multiple concatenations on the same line

Code: Select all

Temperature = Left$ (Temp_String,2) 
Temperature = Temperature + "." 
Temperature = Temperature + Right$ (Temp_String,1)
I think your other example

Code: Select all

Temp_String = Left$ (Temp_String,2) + "." + Right$ (Temp_String,1)
would be even more tricky, as it would require more internal buffers, but I’ll add this issue to the bug log as an interesting challenge :D
Regards,
Leigh