Basic noob question

Krafter

Member
Hi all. I playing with my picaxe again (40x1) and my new LCD but I'm having issues getting the LCD to display any text. I'm using this LCD and using the following code.

Code:
main:

serout 1, N9600_8, ("testing")
All I'm getting on the LCD is gibberish. I'm guessing it's a baud rate problem but according to the datasheet the LCD is 9600. What the heck am I doing wrong? I tried searching the forums for the answer but I'm not having much luck on the basics on using an LCD. As far as I can tell, all I should have to do is configure the pin for the baud rate and send a string, variable or an ascii command but it's obvious I'm not doing something right.

Thanks
 

Hemi345

Senior Member
Are you running both the 40X1 and LCD at 3.3V like it requires?

Schematic or clear photo of how you have everything connected?
 

Krafter

Member
"TTL serial" would not normally require inverted output from the Picaxe
I was just going to give an update. After doing some research I did try T9600_8 vs N9600_8 and it worked. I also learned the difference between idle high and idle low serial comms. :)

Thanks for the input and sorry to bug you all with such a silly thing.

edit: I should also add that I set the clock speed to 8MHz.

Code:
setfreq 8M
 
Last edited:

westaust55

Moderator
When a signal uses the True as opposed to iNverted serial format then it is recommended to include a HIGH <pin> command in the start of the program so that the serial line is made high early and not left floating. This can prevent electrical &#8220;noise&#8221; with a floating line resulting in garbage seen on the LCD screen. Another solution can be a say 10 kOhm pull up resistor on the serial comms line.
 

Krafter

Member
Seriously everyone, I'm not trying to be spoon fed here but I've ran into another issue that I hope someone can help with. Acording the the datasheet, I can send a 0x0E to enable the underline cursor but I'm just getting gibberish again. Same goes for any other command in the extended commands list. The text still prints fine but that's about it. Here is the code I'm using.

Code:
setfreq M8
LCD:
pause 500
serout 1, T9600_8, ($0E)
pause 500
I'm also able to use special characters in the following chart just fine. I don't understand what I'm doing wrong while trying to use the extended commands......




edit:

Why in the heck doesn't the datasheet mention anything about prefacing a command with "FE"???? I finally found this article and gave it a shot and guess what?? It worked.


Code:
serout 1, T9600_8, ($FE, $0E)
Thanks anyway guys. :)
 
Last edited:

westaust55

Moderator
Why in the heck doesn't the datasheet mention anything about prefacing a command with "FE"???? I finally found this article and gave it a shot and guess what?? It worked.
Keep in mind this is a Sparkfun datsheet, not a Revolution Educaiton/PICAXE related datasheet.


However, from the Sparkfun datasheet that you gave a link to, at section 2 Interface Specifications: it states

". . . . There are only two exceptions to this. These are the command characters decimal 254 ($FE) and 124 ($7C)."

The information is there - just a case of careful study needed.





 

Krafter

Member
Why in the heck doesn't the datasheet mention anything about prefacing a command with "FE"???? I finally found this article and gave it a shot and guess what?? It worked.
Keep in mind this is a Sparkfun datsheet, not a Revolution Educaiton/PICAXE related datasheet.


However, from the Sparkfun datasheet that you gave a link to, at section 2 Interface Specifications: it states

". . . . There are only two exceptions to this. These are the command characters decimal 254 ($FE) and 124 ($7C)."

The information is there - just a case of careful study needed.

Thanks for the reply. I just had another look at the manual and I found what you are referring too but to a noob, that doesn't say use a 254 or 124 before issuing any command. Now I know though. :)

I think about it and it does make since in a way. If using a $0D or similar without something to tell the display the expect a command, it would just translate that as ASCII.
 

westaust55

Moderator
Thanks for the reply. I just had another look at the manual and I found what you are referring too but to a noob, that doesn't say use a 254 or 124 before issuing any command. Now I know though. :)

I think about it and it does make sence in a way. If using a $0D or similar without something to tell the display the expect a command, it would just translate that as ASCII.
The Sparkfun datasheet is not necessarily the best in presentation.
However section 3.3 covers the &#8220;Extended Commands&#8221; including those for cursor control such as cursor on/off and positioning the cursor.
Only for the positioning the cursor do they give an example and in that example (over the page to page 3)
at step 3 they inform to
&#8220;Now transmit the special character 254 to tell the SerLCD you want to send a command&#8221;
and then for step 4
&#8220;Finally, transmit the number <xxx>. The cursor is now sitting in the . . . . .&#8221;


However, you are alway free to ask a question if something does not make sense.
 

srnet

Senior Member
Thanks for the reply. I just had another look at the manual and I found what you are referring too but to a noob, that doesn't say use a 254 or 124 before issuing any command. Now I know though. :)
It certainly implies it.

When reading any data sheet, it is wise to read it all at the beggining, there is less risk of not seeing the important bits.

And if something does not work as expected, go back and read the data sheet again, to make sure you did not miss something on the first read through.
 

grim_reaper

Senior Member
I think it's best to read the whole datasheet twice; especially if it's a new chip/display/part to you.

The first pass gives you an idea of what it's all about and what it's possible to do with it, then after some thinking about your intended implementation, a second read should make your brain latch onto the specific things that may apply to you or cause you issues.
 

Krafter

Member
I did read the datasheet before I even powered up the LCD. Where I messed up was, I wasn't expecting to have to tell the LCD that a "command" was coming therefore it didn't sink in when I read the section about setting the cursor position (I admit I only read that section once). I had in my head that simply sending $0D or similar was enough. I'm a total noob at this sort of thing but I am learning. :)

Thanks again guys.
 
Top