Let's Make Robots!

Help with Picaxe and serial LCD

Ok Picaxe Basic Gurus... I think I need some code snippits...

My new serial enabled LCD just arrived and I can't seem to get it up and running. I am using what I think is the standard picaxe basic commands but I am only getting white blocks, x's and some other random symbols. To be honest, I am confused with a lot of the serial commands in general, the whole ASCII thing and anything written as 0x7C or 0x14 or whatever.

Here is the display.

Here is the PDF

For instance, I first need to change the baud rate. The instructions tell me to send 124 followed by "<control>k" . Now it seems the picaxe standard is 2400 baud. What is the actual command? Do I send the "change baud" command at 2400 baud when the display is at a default of 9600? and then the command number is 124 and also 0x7C so what do I do?

In my mind (and to show I have no idea what I am doing) here are all the options I can see:

serout 7,N2400, (124, "<control>K")

-or-

serout 7,N2400,(124)

pause 5

serout 7,N2400,("<control>K")

-or-

serout 7,N2400,($7c, "<control>k")

I could go on and on with my guessing but nothing is working.

In general, I assume my major problem is with the baud rate, I hope and assume that after I get that fixed I should be able to return to the standard serout 7,N2400,("Hello") sorta commands.

Would anyone be so kind as to give me a crash course on what you think I should know?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

OMG! Fritsl totally kicks my butt me at interpreting these technical manuals! Respect!

And he nails it. I think. That sneaky word "<control>" in the serlcd manual refers back to the 124. Not to the control key on the keyboard.

Now how about linking the Sparkfun Manual Writers Guild to this page while referring to this little quote from their pdf:

"Please report types, inaccuracies, and especially unclear explanation to us at spark@sparkfun.com. Suggestion for improvements are welcome and greatly valued."

Of course this means no more artsy rants from you, Frits!

8 ;-)

Rik

OMG I cannot believe I have to retract this. And after so much time!

The "<control>l" in the Sparkfucked Manual in fact DID refer to a keyboard combo of the Control key and the letter "l"...

I needed this table to look up which ascii code is associated with that. Turns out to be 12 (decimal) aka $0C (hex).

Yep: I have one of these now and I scolded the darn manual and kicked the lcd into 4800 submission! I'd better do a walk through on LMR because the (otherwise very fine) slackers at the Sparkfun documentation dep. seem to still be asleep!!!!

Are you doing a walkthrough just on the serial LCD or a more comprehensive walkthrough on serial communications in general?

As long as it is green and has an interesting shape, it can be anything as far as I'm concerned. That goes for anything.

Since you know it's default setting is 9600 and the picaxe is capable of that I would leave it at 9600. I think your problem is that the serout command doesn't use a start bit. The display wants 8bits data, 1 start bit, 1 stop bit and no parity. I can't find anything in the manuals or your datasheet to change that. You may need to talk to sparkfun :( sorry.

Is it really necessary to indicate the use of a start bit? (disclaimer: I never did anything serial with picaxe, but I will soon)

I read both manuals (picaxe and serlcd). And although the serlcd says it uses a "start bit", I cannot find a description of the serial protocol that says it can do otherwise. I am figuring that (in rs232 protocols anyway) the start bit is implied. And that this is the reason that the RevEd people neglect to mention it in their student oriented docs.

And I doubt you will find a serial terminal emulator that will offer you to switch off the start bit. Here's a picture of mine (putty):

serialsetup_putty.png

I find confirmation in this wikipedia article. It says that two parties in any serial communication (rs232 or otherwise) must first agree on a number of things {and most of those are documented by picaxe}: 

  • full or half-duplex operation {does not apply: the lcd does not talk back}
  • the number of bits per character {8 data bit}
  • the speed or Baud of the line {9600 as Oddbot suggests}
  • both sides must agree to use or not use parity {nope}
  • if parity is used, both sides must agree on using odd or even parity {I said nope!}
  • the number of stop bits sent must be chosen (the number sent must be at least what the receiver needs) {one}
  • Mark and space symbols {not mentioned: these are implied by the use of rs232 electrical signals which wiki covers elsewhere}

Note how there is no mention of start bits!

I hope that Sparkfun (or any knowledgable LMR member) will confirm this. In the mean time; how about signal levels? Do both sides of the line agree on voltages and their significance?

More to the point (reading several picaxe manuals in parallel), should you perhaps use:

serout 7, T9600, ("line levels, sucker!")

Tizzle to the Nizzle!

8ik

I had considered the line level option prior to spotting the start bit requirement. It is definately worth a try. I'm not an expert on serial coms either. The start bit just struck me as the obvious difference.