gLCD help

elios

Senior Member
Okay, me again.

How do i get multiple lines of text on the screen. Im kinda stuck with looking at the manwell and this is my code:

Code:
init:
pause 1500
Serout 1 , T2400 , ( 10) : Pause 300
Serout  1 , T2400 , (20 , 1)
pause 32
serout 1,T2400,(100,7,3,0,"welcome")
pause 1500
serout 1,T2400,(10)
pause 300

main:
serout 1,T2400,(100,7,3,0,"welcome")
pause 3000
serout 1,T2400,(10)
pause 300
loopa:
sertxd (#b1,13,10)
serout 1,T2400,(100,1,1,0,"1) Joystick Axis")
serout 1,T2400,(100,3,1,0,"2) Joystick Plot")
pause 32
goto loopa
It the screen goes welcome for a bit then it refreshes and makes my screen say "1) Joystick axisd" with a blocky thing at the end.

any help appreciated!
 

BeanieBots

Moderator
The pause suggested by Dippy is essential between commands.
If you don't want to wait for the timeout period, you must test the status line. This is clearly explained in the manual.

It is also a very good idea to make use of the symbol directive so that your code is readable. At the very least, comment your code.

eg
Serout 1 , T2400 , (20 , 1) 'turn backlight on.

or
Symbol GLCD=1
Symbol Backlight = 20
Symbol On=1
Symbol CLS=10

Serout GLCD,T2400,(CLS)
Pasue 300 'wait for screen to clear.
Serout GLCD,T2400,(Backlight,On)

It will be SO MUCH easier to read when you go back to it later.

Also, something which is not mentioned in the manual is that you need to set the serial line high before sending the first command. If you don't, the very first instruction to the GLCD may be missed. This only needs to be done once and can be in your GCLD startup code.

eg
High GLCD 'set serial line to GLCD high
Serout GLCD,T2400,(CLS)
Pasue 300 'wait for screen to clear.
 

elios

Senior Member
awesome. this program here works but it is 3 bytes over the limit for the humble 08m!

Code:
init:
pause 1500
Serout 1 , T2400 , ( 10) : Pause 300
Serout  1 , T2400 , (20 , 1)
pause 32
serout 1,T2400,(100,7,3,0,"welcome")
pause 1500
serout 1,T2400,(10)
pause 300

main:
serout 1,T2400,(100,7,3,0,"welcome")
pause 3000
serout 1,T2400,(10)
pause 300
loopa:
sertxd (#b1,13,10)
serout 1,T2400,(100,1,1,0,"1| Joystick Read")
pause 50
serout 1,T2400,(100,1,2,0,"2| Joystick Plot")
pause 50
serout 1,T2400,(100,1,3,0,"3| Sensor Inputs")
pause 50
serout 1,T2400,(100,1,4,0,"4| Remote Functions")
pause 50
serout 1,T2400,(100,1,4,0,"5| Base System Check")
pause 50
goto loopa
i wiil update all the commands with the SYMBOL one, later when i have some more time on my hands
 

westaust55

Moderator
Part of the problem is that test strings do take up a space and most of your code replated solely to text strings.
Not at home to try in the PE but does this help?
Code:
init:
pause 1500
Serout 1 , T2400 , ( 10) : Pause 300
Serout  1 , T2400 , (20 , 1)
pause 32

pause 1500
serout 1,T2400,(10)
pause 300

main:
GOSUB Welcome
pause 3000
serout 1,T2400,(10)
pause 300
loopa:
sertxd (#b1,13,10)
serout 1,T2400,(100,1,1,0,"1| Joystick Read")
pause 50
serout 1,T2400,(100,1,2,0,"2| Joystick Plot")
pause 50
serout 1,T2400,(100,1,3,0,"3| Sensor Inputs")
pause 50
serout 1,T2400,(100,1,4,0,"4| Remote Functions")
pause 50
serout 1,T2400,(100,1,4,0,"5| Base System Check")
pause 50
goto loopa

Welcome:
serout 1,T2400,(100,7,3,0,"welcome")
Return
If this does not achieve a space reduction then you may need to look at something like:
1 storing the character/text strings in EEPROM (see EEPROM Command) so words such as “Welcome” and “joystick” are not repeated.
2 Can you try some abbreviations JStick instead of Joystick
3 A bigger PICAXE chip 14M


If the 08M is alread full just getting out the mesages, you are not making great use yet of the GLCD or implimenting any real control. Seems a bigger PICAXE could be in order if you intend to do more
 

elios

Senior Member
Yeah, thanks westaust.

I have my 28x2 on the job now, as i need to rig up some computing power, a 12key numeric interface, and a HopeRF transceiver.

So yeah, will keep you guys notified of anything more that comes up, and progress.

Thanks again all
 

elios

Senior Member
now just for development code, ill compress it later... but my understanding off this program is that once i press 1 on the keypad (hence then loop name) it will go to another screen. One it does that, i push 0 to go back to the main menu.

currently when i push that last zero, it doesnt seem to be going back to the main_menu:

here is the code:

Code:
#picaxe 28x2

' Converted by X2 Conversion Wizard Version 1.0.2

let dirsB = %11111111
let adcsetup = 0

init:
High B.7
pause 1500
Serout B.7 , T2400 , ( 10) : Pause 300
Serout B.7 , T2400 , (20 , 1)
pause 32
serout B.7,T2400,(100,7,3,0,"welcome")
pause 1500
serout B.7,T2400,(10)
pause 300

main:
serout B.7,T2400,(100,7,3,0,"welcome")
pause 3000
serout B.7,T2400,(10)
pause 300

main_menu:


pause 50
serout B.7,T2400,(100,1,1,0,"1| Joystick Read")
pause 50
serout B.7,T2400,(100,1,2,0,"2| Joystick Plot")
pause 50
serout B.7,T2400,(100,1,3,0,"3| Sensor Inputs")
pause 50
serout B.7,T2400,(100,1,4,0,"4| Remote Functions")
pause 50
serout B.7,T2400,(100,1,5,0,"5| Base System Check")
pause 50
serout B.7,T2400,(100,1,6,0,"6| Engine Options")
pause 50

Main_menu_:

readadc 0,b1

if b1 => 1 then goto keypad

goto Main_menu_


keypad:

readadc 0,b1
sertxd ("keypad data",9,#b1,13,10)
if b1= 54 then ONE
if b1= 58 then TWO
if b1= 63 then THREE
if b1= 69 then FOUR
if b1= 76 then FIVE
if b1= 84 then SIX
if b1= 95 then SEVEN
if b1= 109 then EIGHT
if b1= 127 then NINE
if B1= 153 then STAR
if B1= 191 then ZERO
if B1= 254 then HASH
goto keypad


ONE:
serout B.7,T2400,(10)
pause 300
ONE_:
readadc 0,b1
serout B.7,T2400,(100,0,1,0,"Joystick Read")
pause 50
if b1 => 1 then goto keypad
goto ONE_


TWO:

TWO_:

goto TWO_


THREE:

goto THREE


FOUR:

goto FOUR


FIVE:

goto FIVE


SIX:

goto SIX


SEVEN:

goto SEVEN


EIGHT:

goto EIGHT


NINE:

goto NINE


STAR:

goto STAR

ZERO:
serout B.7,T2400,(10)
pause 300
ZERO_:
readadc 0,b1
if b1 => 1 then goto main_menu

goto ZERO_

HASH:

goto HASH
 

hippy

Ex-Staff (retired)
When you enter your 'keypad' routine, what does the SERTXD report when the zero key is pressed ? 191 or something else ?

Analogue keyboards can vary slightly so an "IF var = value" test for match may not always work. You really need an "IF var >= value1 And var <= value2" test to handle those variations of keyboard voltage.
 

elios

Senior Member
Yes, it works with the exact variable. I got it working now, i can't exactly remember what i did.... I think i re-routed the goto on ZERO_.
 
Top