LCD displaying 2 variables?

TYKE

New Member
Hi
I am using the AXE133 serial LCD module linked to the 18m2 tutorial board and I would like to display 2 variables in the same message is this possible ? I’ve tried to find a reference or an example but I am not able to find one so if it is possible could some kind person give me an example.
 

nick12ab

Senior Member
Why can't you do it?

If you want a number to take up the same amount of space no matter how many digits there are, use the bintoascii command to separate the variable into ASCII digits first then send them all to the LCD.
 

Eclectica

Member
Hi

We've all been there at one time or another, just keep trying; it will work in the end! :)

It could be the LCD not responding instantly after switch on. Just ensure that there is a decent delay to give it time to initialize completely.

If I understand correctly, it is simply a matter of something like this (to print out w0 and w1:

Try something like this:

Code:
pause 5000 ; wait 5 sec for display to initialize

serout B.7,N2400,(" "); get serial output line operating (the first char is often lost)
pause 100

serout B.7,N2400,(254,1) ;clear LCD display
pause 30;wait for recovery

w0 = 11223 ; values we want to send
w1 = 55443

serout B.7, N2400, (254, 128, #w0, " ", #w1, "        " ) ' locate cursor at line 1 and print out value of w0 followed by space and w1

Make sure that the last thing to print is 12 trailing spaces - this will keep the display tidy with changing length strings of #w0 and #w1, if you have enough spare variables then bintoascii works too and will always display the values in the same character positions on the LCD.

Hope this helps.

E.
 

TYKE

New Member
Something odds happening I’ve just run the the program again to copy the code to show it and now it works fine? For the last 2 days when I’ve converted from Logicator to basic the second bintoascii conversion has not been put into the text line but in a line before it?

Thanks Nick and electica
 

nick12ab

Senior Member
Something odds happening I’ve just run the the program again to copy the code to show it and now it works fine? For the last 2 days when I’ve converted from Logicator to basic the second bintoascii conversion has not been put into the text line but in a line before it?

Thanks Nick and electica
I found that in Logicator when displaying lots of variables on the LCD using the LCD cell (e.g. 4), it would execute all the bintoascii commands before the serout command and as it only reserves six variables for bintoascii conversion, the first two variables displayed would match the second two.

You could post the flowsheet for assistance on your specific issue.
 

TYKE

New Member
Hi I’m not sure how to post the flow code only the converted basic. In Logicator I have variables A & B, A increases by 1 until it reaches 25 then A is reset to 0 and B increases by 1, both were displayed via the LCD command as they counted up, the code doesn’t serve any purpose other than to show that the LCD works. I have deleted the old routines so I cant post the original fault so I have altered the working basic to show the problem.
main:
label_2:
let varA = varA + 1 'Expression command
if varA >= 25 then label_3 'Compare command
label_5: pause 250 'Wait command
bintoascii varA,b8,b9,b10
serout 7,N2400_4,(254,128,"A = ",b8,b9,b10," ")
bintoascii varB,b8,b9,b10
serout 7,N2400_4,(254,192,"B = " ")<<<<<<<<<<<<<<<<
goto label_2

label_3:
let varB = varB + 1 'Expression command
let varA = 0 'Expression command
goto label_5

I hope this is some help in trying to explain the fault.
 

Technical

Technical Support
Staff member
Is your Logicator up to date? This looks like a flowchart conversion bug from an older version.
www.picaxe.com/Logicator

Change this line

serout 7,N2400_4,(254,192,"B = " ")<<<<<<<<<<<<<<<<

to

serout 7,N2400_4,(254,192,"B = ",b8,b9,b10," ")
 

TYKE

New Member
I updated to the latest version of Logicator yesterday morning but I still had the problem and then last night it cleared itself and know it works fine.
 
Top