Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
LinkBack Thread Tools Display Modes
Old 15th May 2004, 03:03 PM   (permalink)
Default HD44780 trouble (again) [for pic]

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.
Fletcher is offline  
Old 15th May 2004, 03:13 PM   (permalink)
Default

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 is offline  
Old 15th May 2004, 03:22 PM   (permalink)
Default

Quote:
Originally Posted by Exo
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.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline  
Old 15th May 2004, 03:35 PM   (permalink)
Default

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 is offline  
Old 15th May 2004, 03:46 PM   (permalink)
Default

Quote:
Originally Posted by Fletcher
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.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline  
Old 16th May 2004, 08:13 AM   (permalink)
Default

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'.
Fletcher is offline  
Old 16th May 2004, 08:28 AM   (permalink)
Default

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.
Fletcher is offline  
Reply

Bookmarks

Thread Tools
Display Modes





All times are GMT. The time now is 06:40 AM.


Electronic Circuits  |  Learning Electronics
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.

eXTReMe Tracker