Can't change baudrate of SerLCD

NXTreme

Senior Member
Well, I've been having problems with my SparkFun SerLCD V2.5. I'm using a Picaxe 20x2 with firmware version C.1 (stuck on a 08 Proto Board Kit. Hey it works! I may have some pins leftover that I can't use but it works!) and Programming Editor 5.2.7 (I know, I should update. Will do that right away). I am using the SparkFun Picaxe programmer and it has worked great so far. My LCD is soldered onto the 08 Proto Board with some unshielded 22 AWG stranded wire and as far as I can see, the solder joints look pretty good.

I can display letters/words at T9600 baud no problem and I can clear the screen as well (254,0x01) but when I try to change the baud rate to T2400 (0x7C,"k") I end up with a whole ton of garbage on the screen and it stays at 9600 baud. I found a post on letsmakerobots.com that explained my problem to a T (http://letsmakerobots.com/node/4114) but ends up that that was a 28X firmware problem (http://letsmakerobots.com/node/4239) that I'm sure most of you are aware of. I'm afraid that I've done what I can and am sort of stuck. Has anyone else run into this problem before? I'm assuming (using the information rik gathered) that the Picaxe isn't catching the first bit and is messing up the message that way. However I'm slightly confused as I can still use it normally to just display ACII characters.

The first piece of code is what I used to check that the screen was working. The first few letters are garbled but I imagine thats just because the line has to initialize (or whatever else could happen).

Code:
main: pause 1000
	serout A.0,T9600_8,("Hello World")
	pause 1000
	serout A.0,T9600_8,(254,0x01)
	goto main

The second piece of code is supposed to flash some text quickly just to get everything warmed up and to prove that it's working. Then, it's supposed to clear the screen, change the baud rate to 2400 and display some text. However, after the first piece of text flashes by the rest is all garbled. Is it my code, my Picaxe, my SerLCD or should I blame it on solar flares and flying pigs? Thanks.

Code:
main: pause 5000
	
	serout A.0,T9600_8,("NXTreme, NXTreme")
	pause 300
	
	serout A.0,T9600_8,(0xFE,0x01)
	pause 100
	
	serout A.0,T9600_8,(0x7C,"k")
	pause 100
	
	serout A.0,T2400_8,("NXTreme, NXTreme")
(Yes, I know it's vain to stick your name in a piece of code more than twice :))
 

hippy

Ex-Staff (retired)
You should add a HIGH A.0 to initialise the serial line for Txxxx baud use if you haven't already got one.

To set the baud rate ... in the thread linked to you say, "The instructions tell me to send 124 followed by "<control>k" ... $7C is 124, but "k" isn't usually what's meant by "<control>k". Try -

serout A.0,T9600_8,( 124, 11 )

Added : And welcome to the PICAXE Forum !
 
Last edited:

NXTreme

Senior Member
Ok, I'm rather new to the whole Picaxe scene (have mostly played with Mindstorms) so I'm learning quite a bit. Thanks for the code examples, I'll try them out right away to see if they work! Would I need to add a HIGH Pin 0 if I use a 08M instead? I'm assuming I would.

Oh and thanks for the welcome as well :).

-EDIT- I just saw your post, eclectic. I will try that too. Thanks to both for your VERY quick reply's. Will post back about any success I may have.
 
Last edited:

NXTreme

Senior Member
Well it works! I had assumed that sending "k" was the same as sending 11. Well... its not :). Thanks to hippy and eclectic for giving me code samples that work. I do have one more question. In the (working) code below is the High A.0 command in the right spot? Or do I have to pull the line high before every serout command? And what about pulling the line low after every command? Thanks again!

Code:
main: pause 5000
	
	high A.0
	pause 20
	
	serout A.0,T9600_8,("NXTreme, NXTreme")
	pause 300
	
	serout A.0,T9600_8,(0xFE,0x01)
	pause 100
	
	serout A.0,T9600_8,(124,11)
	pause 100
	
	serout A.0,T2400_8,("NXTreme, NXTreme")
 

hippy

Ex-Staff (retired)
Glad to hear it's working.

The HIGH A.0 only has to be issued once, so you can put it before the main PAUSE if you wish.
 

BeanieBots

Moderator
You only need ONE high and it can be anywhere as long as it comes before the very first serout "T" command.
There is no need to ever put it low again.

The purpose is simple to change the line from idle low for "N" transmissions to idle high for "T" transmissions.
After it has been set initially (just the once), the serout command looks after everything else.
 

NXTreme

Senior Member
Ok, I get it now. Thanks to everyone that helped, even though I should have just searched for the answer.
 

Chavaquiah

Senior Member
Sorry to go off-topic but since your original question seems to have been answered... :eek:

Ok, I'm rather new to the whole Picaxe scene (have mostly played with Mindstorms) so I'm learning quite a bit.
Just out of curiosity, are you planning to use a NXT together with a Picaxe driven circuit? That, by the way, was what drove me to learn electronics. I wanted to get a better IRSeeker than the one available for the NXT...
 

NXTreme

Senior Member
Just out of curiosity, are you planning to use a NXT together with a Picaxe driven circuit? That, by the way, was what drove me to learn electronics. I wanted to get a better IRSeeker than the one available for the NXT...
It's nice to hear that I influenced someone for the good :). Yeah, I'm trying to build something like what Chris The Carpenter on LMR built; a house pet robot (http://letsmakerobots.com/node/15089). I'm going to try to make something like it with the Picaxe 20x2 and the Lego Mindstorms NXT. The project I'm working on right now is actually something to help farmers during haying season.

Which brings me back to another question. I got the program working fine and dandy, happily changing baud rates, displaying the usernames of vain forum members and overall just enjoying life when all of a sudden a little black fellow with a pitchfork popped up. I found out that my SerLCD doesn't keep the changes after a power cycle, contrary to what the manual says. So now, I have to change the baudrate every time I start it up which is a pain 'cause I want to use the 08M instead of a powerful 20x2 (or something similar).

I looked around online and saw that I wasn't the only one having problems. I found several people/pages online that clearly stated that their SerLCDs (v2.5) wouldn't save the baudrate changes, which conflicts with the manual that says it does save them... Anyways, sent SF an email and hope to get a reply back by tomorrow. Does anyone else know anything about this problem? I should get help from SF but it'd still be nice to hear from someone else about this. Thanks!
 

Chavaquiah

Senior Member
Even if SF is not able to help you solve the problem, perhaps there is still hope. On this other thread please see MPep's reply #6. He suggests using SERTXD to get a 08M to send out data at 9600bps.

And good luck with that pet robot! :) All it's missing is a PIR sensor to "know" when someone is nearby... ;)
 

NXTreme

Senior Member
Ok, nice to know that its not completely impossible. I'd still rather not modify the Proto Board but hey, that's life! Thanks for the link.

And about PIR... I've been eying a PIR sensor SF has for a while now... and its only $10 dollars... :)
 

Chavaquiah

Senior Member
Regarding SF's PIR, a word of caution. Even though they say if works "from" 5V, the truth is that at anything below 7V or 8V it's almost blind. If you can feed it from 9V (say, from the NXT's brick) it's quite alright. Below that, I'd suggest you look elsewhere. There seems to be a good reason the datasheet specifies 12V...
 
Top