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 LCD operation

Status
Not open for further replies.
hi. can someone please help me? im using HD44780 LCD. i don't know why it is not working. a tested program was provided to us, proper connections and yet it doesn't diplayed anything. what seems to be the problem? im using z8microcontroller.
 
I would start by applying power and verifying the powerup test pattern works. The first row of characters will be darkened boxes, followed by a blank second row. If it remains blank, it's either a display fault, or you have the Vo pin set to minimum contrast. Otherwise, this is the startup sequence I use in my 4-bit displays. Keep in mind 4-bit mode uses pins Data4 thru Data7; with Data4 as the LSB. To "EXECUTE," I ground the ENable pin for 1us, then raise it back to Vdd.

---ON POWER UP
* RS pin grounded
* EN pin at Vcc
* R/W permanently grounded into write mode

---LCD INITIALIZE
* Hold 16.320ms (15ms minimum required)
* Send "03h" to LCD bus
* EXECUTE
* Hold 4.608ms (4.1 minimum required)
* EXECUTE
* Hold 128us
* EXECUTE
* Hold 128us
* Send "02h" to bus ("Function set" for using a 4 bit interface)
* EXECUTE
* Hold 128us

---LCD BUS WIDTH AND DISPLAY SIZE SETUP
* Send "02h" to bus ("Function Set" command)
* EXECUTE
* Hold 64us
* Send "04h" to bus (To indicate dual line display)
* EXECUTE
* Hold 64us

After that I send the remainder of command to power off the display, change cursor options, then tell the LCD to power on again. Basically all my holds are 10% longer than the minimum recommendation.
 
wschroeder:

I've gotten your code working on my LCD. Again, I connected the data ports wrong, which resulted in not seeing anything on my LCD. How would I switch the position of the cursor? By using one of the command flashing functions in your code?
 
ssylee said:
wschroeder:

I've gotten your code working on my LCD. Again, I connected the data ports wrong, which resulted in not seeing anything on my LCD. How would I switch the position of the cursor? By using one of the command flashing functions in your code?

All the commands are listed on the datasheet, and also in my tutorials - where I also provide subroutines to move the cursor (and various other common actions).
 
ssylee said:
wschroeder:

I've gotten your code working on my LCD. Again, I connected the data ports wrong, which resulted in not seeing anything on my LCD. How would I switch the position of the cursor? By using one of the command flashing functions in your code?

The LCD4_CMD() is how you set the address for the cursor, and anything you write will show at that point. Remember that the LCD is setup to automatically advance the cursor position after a write.

Here are the starting addresses of the most common HD44780/compatible controllers. You can simply count across the screen from these addresses to find any point on a line.

2x16, 2x20, 2x24, 2x40 LCD Line Start Addresses + DDRAM Access:
LINE 1 = 0 + 128 = 128
LINE 2 = 64 + 128 = 192

If using a 4 line LCD, Line3 is a continuation of screen addresses from Line1, and Line4 is a continuation of addresses of Line2:

4x16 LCD Line Start Addresses + DDRAM Access
LINE 1 = 0 + 128 = 128
LINE 2 = 64 + 128 = 192
LINE 3 = 16 + 128 = 144
LINE 4 = 80 + 128 = 208

4x20 Line Start Addresses + DDRAM Access
LINE 1 = 0 + 128 = 128
LINE 2 = 64 + 128 = 192
LINE 3 = 20 + 128 = 148
LINE 4 = 84 + 128 = 212

128 (Setting Bit-7 of the Command Byte) is the additional Command requirement for accessing the DDRAM, also known as the read/write screen locations. So, if you want to set the cursor to Line 1 and and the 4th character, do something like this:

Code:
LCD4_CMD(131)
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top