Serial LCD: First time, unsure..

RogerTango

Senior Member
I have THIS serial LCD and I have no clue what Im doing with it. Sigh.

http://www.sparkfun.com/commerce/product_info.php?products_id=813

Datasheet:
http://www.sparkfun.com/datasheets/LCD/SerLCD_V2_5.PDF

The DS says it defaults to 9600, I am using a 14M and I think 2400 is highest at 4mhz internal.

I think I need to send the "special" character and "k" to set it to 2400 before I send text to it.

I dont know how to do that.

Once I set the baud rate, how do I send text? It is not looking as "obvious" as I thought. I am trying to use IC pin 12, or output pin 1 for serout.

A little help here would go a long way please. Thanks much!

Andrew
 

RogerTango

Senior Member
Im just thinking... If the display is default to 9600, dont I need to send the instruction at 9600???

If I cant get the 14M to send at 9600 then the LCD is a paper weight, isnt it?

Andrew
 

Andrew Cowan

Senior Member
I would assume not.

I see no point in the LCD supporting 2400 baud if you need to configure it using 9600. It could be it checks for the command 124 in all baud rates. I'll do some more searching.

Andrew



EDIT:

Someone has already thought about this and solved it.

http://www.picaxeforum.co.uk/showthread.php?t=9264

This wouldn't work on a 14M, though...
 
Last edited:

kevrus

New Member
why not try this:

setfreq m8 'sets picaxe internal frequency to 8Mhz

serout pin, t(n)4800,(254,128,"text in here")

I believe this will give a baud rate of 9600 (4800(4Mhz) running at twice the speed)

Ive used t1200(4Mhz) to give t2400 at 8MhZ
 

RogerTango

Senior Member
I just got off the phone with Sparkfun, they were actually as perplexed as I was.

$26 paperweight at this point. I just wanted to serout to an LCD. Sigh.

I guess in the future Ill be looking for serial LCDs that just do 2400 and that should work fine.

Is there a way to get the 14M to do 9600 serial by changing its default 4mhz clock speed? How would I go about doing that? I guess Ill need a resonator too.


Andrew
 

RogerTango

Senior Member
serout pin, t(n)4800,(254,128,"text in here")
Works after setfreq m8!

What IS 254 and 128?

Hello World starts in the second position on the first line when using it.

How do I clear the screen with 0x01?

I am at least seeing SOME progress...

Thanks much for the help!

Andrew
 

kevrus

New Member
for LCDs that use the 44780 control chip, the number 254 is usually used before issuing a command to the lcd, in this case, 128 is the first character at the start of the first line, the second line would start at 192, third line at 148 and fourth line at 212 (if you have a 4 line display).
If hello world is not starting at the first character with the 128 command, maybe you have a space before the text i.e " hello world"
instead of "hello world"

It follows that the second character starts at 129
 

Mycroft2152

Senior Member
Roger,

Before you part with your hard earned cash, you should read the manuals and datasheets.

You cannot expect someone to pull your hind end out the fire all the time.

Myc
 

kevrus

New Member
Roger,
Another thing to bear in mind is that the setfreq command will have an effect on some other commands that may be in your program, time delays for instance wil be halved i.e a 1000ms delay (1 second) will actually take only 500ms as the picaxe is running twice the speed.

You could just issue the setfreq m8 command when required, and then issue setfreq m4 when required, but its only worth doing this is other commands don't work such as readtemp
 

westaust55

Moderator
Sparkfun Serial LCD

IF and when the sparkfun datasheet is read, you will find that the Sparkfun display seems to be “Set and forget” in that setting are stored in EEPROM and re-loaded the next time the display is energised..

Therefore you should only need to issue to command “k” once at 9600 baud and thereafter you can operate at normal 4MHz PICAXE speed.

So use the SETFREQ command to select 8MHz and a SEROUT command at 4800 Baud.

The try to turn all off, and run the PICAXE at 4MHz and use the SEROUT at 2400 Baud.

Read PICAXE manual 2 page 151 for SEROUT information and page 160 for SETFREQ informaiton
 
Last edited:

stocky

Senior Member
ummm - obvious answer - plug it into a PC serial port and set the display to the required baud rate. As per the datasheet it will remember the setting

Then you can use it as you wish:)
 

RogerTango

Senior Member
ummm - obvious answer - plug it into a PC serial port and set the display to the required baud rate. As per the datasheet it will remember the setting

Then you can use it as you wish:)
Nice try, but the guys at Sparkfun recommend a level converter so as to not blow the driver board, since serial from a typical serial port is not TTL.

Andrew
 

RogerTango

Senior Member
You cannot expect someone to pull your hind end out the fire all the time.
I never met a man with the last name Tango. Maybe in the movie Tango and Cash. RogerTango is my screen name. If you read my post properly, you would see I sign with my given name, Andrew.

And if you do not want to help a n00b out, please avoid post with n00b style subject lines. No need to be gritty, I read... I tried.. and then I asked here. That is the usual n00b protocol for getting help. You make it sound like I dont read first. Oh, and reading does not guarantee understanding...

Thanks to the others that offered productive comments, I hope to pass on my knowledge freely and with positive support as it is developed.

Andrew
 

RogerTango

Senior Member
The only good think I can get thus far is "Hello World", after that I cannot clear the screen or display any other text. I am following the suggestions I posted earlier.

I tried setting freq to 8 and change LCD to 2400 or 4800 baud, and go back to freq 4, but it doesnt look like that works either.

Being my first time and an LCD n00b virgin, looking for any other advise what I might try, what I might be doing wrong.

Thanks,
Andrew
 

westaust55

Moderator
West, you always offered good advice for me in the past, thanks again. Please, I did read the sheet but I do not understand all of what I am reading.

Thanks,
Andrew

Andrew,


You indicated you have managed to get the screen to display "Hello World".

Please can you upload your current program code. so members can look for specific problems - otherwise we are always guessing where the problem may be.

If you have some comemnts included at key lines where you are trying to clear the screen or perform other functions it would be all the better and save all time looking through code and trying to match up with the datasheet.


Another point the code to permanently change from 9600 baud to 2400 bause is ctrl-k not just the letter "k".

holding down the Control key while pressing another key zeroed the leftmost 2 bits of the 7 bits in the generated ASCII character. This allowed the operator to produce the first 32 characters in the ASCII table. These are non-printing characters that signal the computer to control where the next character will be placed on the display device, eject a printed page or erase the screen, ring the terminal bell, or some other operation.

so the hex value for "k" is $6B, and if we mask off the 2 most significant bits we get $2B which is not in the control code area.
But if we look at "K" then the value is $4B and after masking the top 2 bits is #0B".
So try using $0B (decimal value = 11) where you have been using "k".
 
Last edited:

Mycroft2152

Senior Member
Andrew aka RT,

Helping newbies is not a problem, that's why we choose to be here. The problem is with newbies who expect all the answers with little apparent effort on their part.

You come across as a very impatient person, not willing to invest a reasonable amount of time in learning or researching a project; so you expect others to do so for you. And then complain when you don't get it.

In your latest project, you ordered apiece of hardware without knowing a.enough information to determine if it could be made top work with a PICAXE; and b, not knowing enough about the PICAXE to be ale to make it work. All of the info necessary was in the datasheet on the Sparkfun website and in the PICAXE manual. Don't just scan the datasheets and manual but actually read them for a change.

I hope your next p[roject is not asking for help ininterfacing a PICAXE to a flux capacitor

You seem to be in the running for the "Golden Spoon" award for the neediest newbie.

So I'll pass on offering any assistance.

Good Luck, perhaps you will get some sympathy responses.

Myc
 
Last edited:

westaust55

Moderator
Another guess here:
Have you first printed the special command character (value = decimal 124) immediately before you send the <control>-k command to change the baud rate? :confused: See datasheet section 3.4

But again, I am guessing as to the possible problem in the absence of good information.

This is why it is good for you to post YOUR actual program code so we can see exactly where you may have gone wrong and give a clear answer the first time. It can save us having to go several rounds with posts to resolve a relatively simple problem.
 
Last edited:

westaust55

Moderator
Works after setfreq m8!

What IS 254 and 128?


Andrew
For the value 254 see the datasheet section 2 on page 1

For the value 128, see the datsheet end of section 3.3 points 1,2, 3 and 4 on page 3. Hint 0 + 128 = 128

While a different LCD, can I sugegst you also download the Rev Ed AXE033 manual and have a read through that as well. It may also help you understand the use/purpose of control codes.
 

RogerTango

Senior Member
I hope to post a little later the code I am using.

Its been a long time since I dealt with bits and shifting, so its all new again.

As far as the display, I didnt buy it and then ask questions, a few weeks ago I posted if this would be the display I wanted to get and purchased it based on the advice of others.

I am trying, and maybe a little impatient, I do want to learn as much as I can, as fast as I can. I guess I could be more patient but Id have to say I am simply excited.

Ive got other projects I want to work on and it is frustrating to be caught in speed bump on what I anticipated would be an easy deployment (using an LCD display).

Thanks for the continued help, Ill post the code and await further advice.

Thanks much,
Andrew
 

kevrus

New Member
Roger,
How do I clear the screen with 0x01?
to clear the whole screen and move to start of first line, just send the command as follows
(254,1)
As a matter of interest, (or not), I usually turn off the cursor as I find the display looks better without it . This is done with the command no. 12, so to clear the screen and turn off the cursor... (254,1,12). I always do this at the beginning of my code.
 

RogerTango

Senior Member
I cannot get the boot screen to disable, or set the baud rate. I may have to "set it up" with a computer serial port. I am also looking at Hippy's LCD driver project but I dont have any 18x chips.

Andrew
 

kevrus

New Member
I had a quick glance at the datasheet link, it looks to me as though you need to send the command (124,9) to turn off the boot screen. Only send this once as it toggles, so next time it will turn it back on
Code:
setfreq m8                                         'sets picaxe frequency
pause 2000                                         'wait 1 sec (at 8mhz) to initialise lcd
serout 0,t(or n) 4800,(124,9)                      'i think this will turn off the boot screen
serout 0,t(or n) 4800,(124,2<control>k")           'i think this is how the baud rate is changed 

setfreq m4                                         'returns picaxe to default speed
serout 0,t(or n) 2400,(254,128,"can you see this")
as a matterof interest, try the above
 

westaust55

Moderator
I cannot get the boot screen to disable, or set the baud rate. I may have to "set it up" with a computer serial port. I am also looking at Hippy's LCD driver project but I dont have any 18x chips.

Andrew
Andrew,
you obviously have some code that you are trying to use.

You do not confirm what you have specifically tried from the suggestions received.

AGAIN, I ask you to post your program code so that we can have a look at exactly what you are doing rather than everyone guessing.
We do not expect glossly finished code or you would not be asking questions. It's just a case of seeing what you are actually doing.

in the meantime, where Kevrus gave the line
Code:
serout 0,t(or n) 4800,(124,2<control>k")           'i think this is how the baud rate is changed
The PE will not handle that and in line with my earlier post, suggest try
Code:
serout 0, t(or n)4800, (124,11)           ' 11 = $0B = Ctrl-k
 
Last edited:

kevrus

New Member
Westaust,
you are right,
Code:
serout 0,t(or n) 4800,(124,2<control>k")           'i think this is how the baud rate is changed
does not compile, I missed out a set of speech marks, it should be

Code:
serout 0,t4800,(124,2,"<control>k")
At least, thats how I read the datasheet, but i'm open for critisism on my interpretation...

RogerTango,
As Westaust says, post your code as it will help others to see the problem
 

hippy

Ex-Staff (retired)
serout 0,t4800,(124,2,"<control>k")

That will send all the characters individually, "<", "c", "o", etc etc.

To send a single byte representing Ctrl-K ( ASCII value $0B / 11 ) send it as described by westaust55 in post #27.
 
Top