character LCD cursor not advancing

Thread Starter

testuserabcdef

Joined Jul 12, 2016
127
I have a project in which I wish to write a simple message to a standard 2 line by 16 character LCD. The initialization is ok, however, when I instruct my micro to print the characters with pauses in-between, it does so, however instead of the cursor advancing to the next position, it stays in the same position (first top-left position) and the next character overwrites the old character.

These are the commands and timings being issued to the LCD:

First I set LCD RS to 0 (command mode)
I issued command 38h three times with 40ms delay each time.
I add command 01h (to clear display) with 2ms delay.
I add command 0Fh (to show cursor, block cursor and turn display on) with 2ms delay.
I add command 06h with 2ms delay.

I set LCD RS mode to 1
Then I instruct the micro to print each letter of the test message with a 1ms delay then micro stalls until a key is pressed. After key press, the next character should be in position 2, not in position 1 (which overwrites first character).

Is there an LCD command I'm using that's incorrect or missing?
 

Thread Starter

testuserabcdef

Joined Jul 12, 2016
127
I thought I configured everything correctly because others who used a character LCD had no problem using the same kind of initialization setup. It makes me wonder if certain brands of LCD's require extra commands I'm not aware of.
 
That is not necessarily part of the configuration.

If you print a string of characters instead of a single character, does it print correctly?

Low level programming can be very demanding. Once you get the interface working, then it can become much easier.
 
I thought I configured everything correctly because others who used a character LCD had no problem using the same kind of initialization setup. It makes me wonder if certain brands of LCD's require extra commands I'm not aware of.
That is why I asked for the datasheet of the particular part first. Many LCD comply with the Hitachi instruction set.
 

ErnieM

Joined Apr 24, 2011
8,317
What manor of beast is this thing?

4 bit or 8 bit mode? Have a schematic? Have the init code? Have the print code? What controller? What language?

Sharing such information of your project would help and helpers.
 

JohnInTX

Joined Jun 26, 2012
4,669
Command 06h should put it into the normal mode - not shifting and increment cursor each character.

What language/compiler are you using? Make sure any library routines used don't set the cursor. For example in MikroC you would want Lcd_Out_CP, not Lcd_Out.

You could also try making the delays way longer as a test. Some knock-off 44780 stuff isn't remotely close to the original Hitachi timings.

Post your code?
 
Last edited:
Top