Page 1 of 1

Adding ascii % symbol to LCD display

Posted: Thu Jul 14, 2022 12:10 am
by canary_wharfe
I am displaying a number that can vary from 1 to 3 digits on a 16 x 2 LCD module. The number is always placed at char position 12 and therefore takes up either the 12th position, the 12 and 13th position or the 12th, 13th and 14th position. Can someone please show me the command to write into the LCD macro line that will add the % character immediately after the last digit to the right of the number? I think the number has to be inserted into a string denoted by " " but I can't for the life of me remember how to do it.

Re: Adding ascii % symbol to LCD display

Posted: Thu Jul 14, 2022 8:40 am
by medelec35
Hello.
The easiest way is to use

Code: Select all

PrintString "%  "

If the number goes from 255 to 3 for example, the two spaces between % and "ensure the unwanted 55 digits are erased.
You won't require a cursor command prior to the PrintString function.

Re: Adding ascii % symbol to LCD display

Posted: Thu Jul 14, 2022 9:38 am
by canary_wharfe
Thanks Martin. That should work nicely.
So you're saying the solution is to add the PrintString function after I have done the PrintNumber.
FYI I thought there was a way to insert the number with the PtintString % as one function but my memory is fuzzy and I may be thinking back to earlier code development before I switched to using Flowcode.

Re: Adding ascii % symbol to LCD display

Posted: Thu Jul 14, 2022 10:23 am
by canary_wharfe
Martin
Just to confirm, it does all work as expected and as you pointed out it has also eliminated a few cursor command functions in the flowcode.
:-)

Re: Adding ascii % symbol to LCD display

Posted: Thu Jul 14, 2022 12:35 pm
by medelec35
Sorry yes, I should have said to add the PrintString directly after the PrintNumber function.
Thank you for confirming it's working for you. :)