Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

HD44780 trouble (again) [for pic]

Status
Not open for further replies.

Fletcher

New Member
I have written some code which works but the 2nd line of the display does not work. I have made sure ive set the lcd to be in 2line mode and set the correct 5x8 font but i just cant get any text come up. However i can get the cursor to flash on that line.

heres my setup routine:

Code:
INIT
CLRF LCD_CTRL
CALL DELAYSTART        ;delay 30ms
MOVLW 0X38                ;set disp as 2line 5x8 font
MOVWF LCD_DATA
CALL ENABLE
CALL DELAY40              ;delay 45us
MOVLW 0X0F                ;set disp on with blinking cursor
MOVWF LCD_DATA
CALL ENABLE
CALL DELAY40              ;40us delay
CALL CLRDISP              ;clear disp
RETURN


im totally stuck here.
 
Second line starts on address 0x40 on a hd44780 lcd...
so any letters beyond the end of line 1 do not emmidiately begin at line 2
 
Exo said:
Second line starts on address 0x40 on a hd44780 lcd...
so any letters beyond the end of line 1 do not emmidiately begin at line 2

I thought it was decimal 40?, I have a 2x40 LCD and that goes immediately from the end of line 1 to the beginning of line 2. With a smaller LCD you have to shift the cursor down to line 2 your self, or wait until it gets to the 40th character.

The actual memory in a smaller LCD is still actually 2x40, and the LCD has commands to scroll along this 40 character wide buffer if you want.
 
Yeah i realise that and my program actually writes the first line, then it goes back into command mode, writes the new cursor location (40h for this display), then it goes back into data mode and starts writing the second line. Probem is the second line never shows.
 
Fletcher said:
Yeah i realise that and my program actually writes the first line, then it goes back into command mode, writes the new cursor location (40h for this display), then it goes back into data mode and starts writing the second line. Probem is the second line never shows.

You're probably not setting it correctly somewhere, most probably it thinks it's a single line display - check the command very carefully.
 
Th weird thing is I if i start writing a whole bunch of characters on the first line eventually the counter in the lcd will hit 40h and start writing perfectly on the second line.

This is the bit in my program where is changes lines:
Code:
        BCF PORTA,0              ;Set RS Line low (command)
	MOVLW 0X40              ;Set DDram address in W
	CALL SENDDATA         ;move data in W to lcd data lines and strobe enable line
	BSF PORTA,0              ;Set RS Line back to high ready for next character

Anything look wrong with that?
Ive checked everything else, ive made the delays a bit longer to be sure, the only other thing i can think of is there are these commands in the datasheet which i havent used. They are 'cursor or display shift' and 'set DDRAM address'.
 
Wait, dont worry ive worked it out now. For some reason the DDRAM address table on my datasheet goes from 00 - 4F but i found another datasheet which goes from 80 - CF. I dont get that at all.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top