Axe033 lcd help ?

curry87

Senior Member
Looking for some ideas on what i could do to solve the following problem in this example code.When the second lot of text is drawn to the firstline of the lcd it still has existing characters from the first write operation now what would be the best way around this that doesn't slow the lcd down or flicker the display.

Ive tried this but it flickers the lcd.
Code:
symbol outpin = b.4
serout outpin,n2400_8,(254,128)'lcd first line 
serout outpin,n2400_8,("                ")


example code
Code:
setfreq m8
symbol outpin = b.4
'28x2 pic
'16x2 lcd axe033
main:

serout outpin,n2400_8,(254,128)' lcd first line 
serout outpin,N2400_8,("testing display ")
pause 2000

serout outpin,n2400_8,(254,128)'lcd first line 
serout outpin,N2400_8,("a b   c  d   e  ")
pause 2000

serout outpin,n2400_8,(254,128)'lcd first line 
serout outpin,N2400_8,("5  4    3    21 ")
pause 2000

goto main
 
Last edited:

BillyGreen1973

Senior Member
Hi

The example code you posted, works just fine in the sim. I don't have my Axe033 setup at the moment, but you could try the 'Clear LCD' command instead of writting a line of spaces. e.g.

Code:
setfreq m8
symbol outpin = b.4
'28x2 pic
'16x2 lcd axe033
main:

serout outpin,N2400_8,(254,1)  ;Clear Display (must be followed by a ‘pause 30’ command)
pause 30
serout outpin,n2400_8,(254,128)' lcd first line 
serout outpin,N2400_8,("testing display ")
pause 2000

serout outpin,N2400_8,(254,1)  ;Clear Display (must be followed by a ‘pause 30’ command)
pause 30
serout outpin,n2400_8,(254,128)'lcd first line 
serout outpin,N2400_8,("a b   c  d   e  ")
pause 2000

serout outpin,N2400_8,(254,1)  ;Clear Display (must be followed by a ‘pause 30’ command)
pause 30
serout outpin,n2400_8,(254,128)'lcd first line 
serout outpin,N2400_8,("5  4    3    21 ")
pause 2000

goto main
let us know how you get on.
 

hippy

Ex-Staff (retired)
To avoid the flicker, the best way is not to clear but only overwrite.

This will leave trailing digits ...

w0 = 65535
Do
serout outpin,n2400_8,(254,128, #w0 )
w0 = w0 / 2
Pause 1000
Loop

This causes flicker ...

w0 = 65535
Do
serout outpin,n2400_8,(254,128, "-----" )
serout outpin,n2400_8,(254,128, #w0 )
w0 = w0 / 2
Pause 1000
Loop

But this overwrites the leftover characters -

w0 = 65535
Do
serout outpin,n2400_8,(254,128, #w0, "----" )
w0 = w0 / 2
Pause 1000
Loop

"-" used instead of spaces to make it clearer what is happening.
 

curry87

Senior Member
When you say overwrite what do you mean ? with spaces and whats the difference between this and clring the lcd with a line of spaces or clrlcd command ?

Is it faster to write to the lcd using this or to preload the message text in using the EEPROM command and loop though and output each character in turn?
Code:
serout outpin,N2400_8,("123456789101112")
 

Technical

Technical Support
Staff member
clearing the LCD is a waste of time - in effect you are writing a space and then writing a new character over the space.
Instead you can simply write the character over the old character, hence halving the update time. The only time you need to clear is when you actually want a 'space' displayed.
 

curry87

Senior Member
Ok i see what you mean about overwritten existing lcd text data rather than clearing makes sense actually never thought it.

On another note i don't know if this is a editor bug or if its supposed to be like this 28x2 btw .

Code:
symbol va = s_w0 'in the Manuel 2 page 13 its says these variables can be used as general purpose var but when i run the following i get an error.
"requires a word variable "

main:
put 0,word va
get 0,word va
goto main
 
Last edited:

hippy

Ex-Staff (retired)
This is a limitation of the special word variables. "Put 0, Word w0" actually generates code for two byte puts -

Put 0, b0
Put 1, b1

There's no s_b0 or s_b1 components of s_w0 so the code cannot be generated. The work around is to move the 's_w' variables into a normal 'w' variable then PUT, and in reverse for GET ...

w7 = s_w1
Put 0, Word w7

Get 0, Word w7
s_w1 = w7
 

curry87

Senior Member
Final problem of the night why when i run this code for my axe033 under "setfreq m16" do the characters get distorted ?

Code:
setfreq m16
symbol outpin = b.4
'28x2 pic
'16x2 lcd axe033
main:

serout outpin,n2400_8,(254,128)' lcd first line 
serout outpin,N2400_8,("testing display ")
pause 2000

serout outpin,n2400_8,(254,128)'lcd first line 
serout outpin,N2400_8,("a b   c  d   e  ")
pause 2000

goto main
 

Texy

Senior Member
As you have changed the frequency of the pickaxe to 16m, should you not change the serial out commands thus :
Serial outpin,n2400_16.....


Texy
 

curry87

Senior Member
That fixed it thx.

Im a little confused about the _n syntax does this mean that A will serout at baudrate n2400 at 8mhz despite the global freq is 16mhz ?


Code:
setfreq m16

serout outpin,n2400_8,(254,128)   'A

serout outpin,n2400_16,(254,128)  'B
 
Last edited:

westaust55

Moderator
That fixed it thx.

Im a little confused about the _n syntax does this mean that A will serout at baudrate n2400 at 8mhz despite the global freq is 16mhz ?


Code:
setfreq m16

serout outpin,n2400_8,(254,128)   'A

serout outpin,n2400_16,(254,128)  'B
No the baudrate_clockspeed keywords are just an alias for a predefined number.
So the n2400_8 is set for 2400 baud with a clock speed of 8 Mhz.
Using n2400_8 with the clock speed set to 16 MHz will in effect double the baud rate to 4800 bps.
 
Top