Character LCD (24x2) not writing to the 2nd line

Thread Starter

Kaoshae

Joined Jan 18, 2011
2
LCD data sheet for reference: http://www.newhavendisplay.com/specs/NHD-0224AZ-FSW-GBW.pdf

I have this LCD working, able to print characters to the first row, but the 2nd line refuses to display anything other than the cursor.

My LCD initialization is the following:

Rich (BB code):
   command(0x30);
   command(0x30);
   command(0x30);
   command(0x38);
   command(0x10);
   command(0x0f);
   command(0x06);
   command(0x01);
(Where "command" means RS = 1, R/W = 0, and the 0x__ code is DB7~DB0 in hexadecimal)

When I use
Rich (BB code):
   command(0xc0);
to move the cursor to position 64 (the first position on the 2nd line), I see the cursor blinking at the start of the second line. If I try to print a string of characters, I see the cursor move along the 2nd row of the display as if it were responding. No characters appear on the 2nd row, even when this exact string prints to the 1st row perfectly.

I have my code giving the LCD commands at a rate of about 4 commands/second, so timing shouldn't be an issue.

Does anyone have any idea what could possibly be wrong?
 

spinnaker

Joined Oct 29, 2009
7,830
No need to go through all of that hassle.

You will need to adjust your clock speed in delay.h and set your various output pins in lcd,h.


It is for the C18 compiler but you should be able to adjust for your compiler.

It uses the 4 bit option on the lcd.


You should have put this in the embedded forum.
 

Attachments

spinnaker

Joined Oct 29, 2009
7,830
Here is some sample code:

Rich (BB code):
    char string[16];
    LCD_Init();
    
    sprintf(string,(const far rom char*)"Hello",0);   
    LCD_string(string,1);        
    sprintf(string,(const far rom char*)"World",0);  
    LCD_string(string,2);

It is for 16x2 but you can just modify the code.
 
Top