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.

Broken 4x20 LCD (hitachi 44780)?

Status
Not open for further replies.
Nigel Goodwin said:
OK, so you're setting it to 2 line mode then!.

However, instead of writing each command seperately, it makes much more sense to do it in a subroutine, like this example from my tutorials:

Yes, I will put that in a subroutine. But when I'm debugging, I tend to simplify as much as I can, and then optimise. Sorry for that...

So, I've probably initialised the LCD correctly. Let me just run the DDRAM addresses by you:

DDRAM is initially at zero DDRAM address.
Code:
...
MOVLW		b'1100000'	; Set DDRAM Address 40h (Line 2)
...
MOVLW		b'10010100'	; Set DDRAM Address 14h (Line 3)
...
MOVLW		b'11010100'	; Set DDRAM Address 54h (Line 4)
...

mcs51mc said:
Do you send a "Display On/Off Control" command with D=1, C=1 and B=0 (Display: On ; Cursor: On ; Blink: Off) see page 24 of datasheet?
If not, what you see isn't the cursor but some spookie thing because of I don't know what (yet)

Yes, did that, and it's set for two lines...

BTW, I'm more of a binary guy myself ;)
 
mcs51mc said:
Yes, it took me a little longer than you to analyse the code :eek:

I wonder why you never mentioned that it's completely against the sequence described on page 45 of the datasheet. Sorry to mention it again :D.

So johankj, please modify the sequence of commands according to page 45, respect the mentioned timings and everything would be ok. At least I hope.
Is it? This makes me angry and confused! :mad:

Okay, I'll rewrite the code, and see what happens... BRB ;)
 
Okay, still no joy... :(

My init routine is basically
Code:
MOVLW		B'00110000'	; Function Set.
...
CALL		   DELAY
...
MOVLW		B'00110000'	; Function Set.
...
CALL		   DELAY
...
MOVLW		B'00110000'	; Function Set.
...
CALL		   DELAY
...
MOVLW		B'00111000'	; Function Set. 8-Bit, two lines.
...
MOVLW		B'00001000'	; Turn the display off
...
MOVLW		B'00000001'	; Clear Display
...
MOVLW		B'00000110'	; Set entry mode
...
;Init procedure ends here!
...
MOVLW		B'00001110'	; Turn on the display and cursor
:confused: :confused: :confused:
 
Got it!!! :D :D :D

A small error, when addressing line two (40h) I wrote:
Code:
MOVLW		b'1100000'	; Set DDRAM Address 40h (Line 2)
When it should have been:
Code:
MOVLW		b'11000000'	; Set DDRAM Address 40h (Line 2)

It's funny what a difference a zero can make!!!:rolleyes:

Thank you everyone for helping me out here, especially Nigel and mcs51mc. Now I can start putting something useful on the display, I just gotta write some sub-routines for if first (Thanks Nigel, for the suggestion)...
 
hi i am also facing a similar problem with my 20X4 LCD i only able to see the dot matix from the first and the third line so pls can anybody help me with that
in case of 16X2 LCD, the command for initialization is 0x38h.. so,is it the same in case of 20X4 LCD? or is it different?
 
There are a few different versions of the LCD and how you initialise it. Basically check the datasheet and check you I/O pins. The initialisation command is probably different from a 2x16 and a 4x20. 2x16 can be either a one line or a two line, which depends on the hardware.
 
4X20 Hitachi LCD

Hi, I have a 4X20 Hitachi LCD and there are 14 connector pins on the PCB. Does anybody have pin layout for that 14 pins and can I have them? Thank you!
 
Status
Not open for further replies.

Latest threads

Back
Top