Which LCD are HD44780-compatible?

General discussion on mikroPascal.
Post Reply
Author
Message
uwe1722
Posts: 128
Joined: 24 Sep 2005 08:47
Location: Germany

Which LCD are HD44780-compatible?

#1 Post by uwe1722 » 08 Apr 2006 18:55

Hello,

I used one 18F252 PIC and one 4*20 LCD-Modul. I have three LCD modules of the 4*20-type and have mixed these up inadvertently. One modul worked often, two didn't work anytime. The module which worked had one HD44780A00-controller on board, the other two modules have a KS0066F00-Controller.

With the HD44780A00 the program hanged up sometimes and then my watchdog started the program again.

Now I only changed to one 2*8-LCD-Modul and everything worked.

Which modules are completly HD44780 compatible?

LGR
Posts: 3204
Joined: 23 Sep 2004 20:07

#2 Post by LGR » 08 Apr 2006 21:32

KS0066 is compatible with HD44780.
If you know what you're doing, you're not learning anything.

uwe1722
Posts: 128
Joined: 24 Sep 2005 08:47
Location: Germany

#3 Post by uwe1722 » 09 Apr 2006 08:31

I think there is a little bit other timing on KS0066F00. I found a list with HD44780-compatible modules and there was listed the KS0066F07 as compatible and the KS0066F00 not!

If I showed some output at the KS0066F00 everything ist ok, but if I showed three outputs at one second, I got a problem, the PIC-program "hanged".

LGR
Posts: 3204
Joined: 23 Sep 2004 20:07

#4 Post by LGR » 09 Apr 2006 15:36

There's a slight difference in the timing spec, but I'm pretty sure that All KS0066 controllers work with the mE LCD library. Unless anyone knows differently.
If you know what you're doing, you're not learning anything.

xor
Posts: 5465
Joined: 18 May 2005 00:59
Location: NYC
Contact:

#5 Post by xor » 09 Apr 2006 20:15

I believe it's initialization and command structure are the same as the Hitachi controller, which means the libraries will work....up to a point. The differences to pay attention to are the line addressing, which for the KS0066 starts at 0 for Line 1, and 64 for Line 2. The Hitachi controller addressing starts at 128 for Line 1, and 192 for Line 2. You can access these addresses directly through the LCD_CMD() function of the LCD library, and then use LCD_OUT_CP() and LCD_CHR_CP() functions to start writing characters.

These differences in line addressing effectively means that using the LCD_OUT() and LCD_CHR() functions will not work since the library is based on the Hitachi controller. But there is a means to make it work rather easily and transparently, by changing the values for Lines 1 thru 4 in the "Uses\P16\Consts\lcd_conts.ppas" or "Uses\P18\Consts\lcd_consts.ppas" modules/units. Here is the example I pulled from the mBASIC module:

Code: Select all

CONST
      LCD_FIRST_ROW          as  byte = 128    ' <-- change to 0
      LCD_SECOND_ROW         as  byte = 192    ' <-- change to 64
      LCD_THIRD_ROW          as  byte = 148    ' <-- change to 20 if using 20x4 LCD
      LCD_FOURTH_ROW         as  byte = 212    ' <-- change to 84 if using 20x4 LCD
Rackley, who posts in the mBASIC forum, uses a 20x4 LCD that implements the KS0073 controller, and has used the library functions. This is the line addressing scheme his LCD uses:
  • Line 1: $00 thru $13
    Line 2: $20 thru $33
    Line 3: $30 thru $43
    Line 4: $40 thru $53
[color=darkred][b]xor[/b][/color]
[url=http://circuit-ed.com]CircuitED -[/url]

LGR
Posts: 3204
Joined: 23 Sep 2004 20:07

#6 Post by LGR » 09 Apr 2006 20:32

xor -

That is very, very valuable information of the sort that belongs in the documentation. This is exactly the sort of information that should be in a wiki. There have been rumors of a mE-supported wiki board as an outgrowth of this forum, and if it materializes, that should be in the LCD section.

Similarly, there are a couple of variations on the KS010x GLCD that causes questions to pop up on the forum periodically. This, and a few dozen more hardware quirks, would be better posted in a wiki.

I think that 90% of the answers to questions on the forum are already posted somewhere, they just need to organize the answers.

BTW - I got lucky, and the 4x20 that I used worked perfectly with the mE library, but I believe that it has a genuine Hitachi chip. So it will work with some displays.
If you know what you're doing, you're not learning anything.

xor
Posts: 5465
Joined: 18 May 2005 00:59
Location: NYC
Contact:

#7 Post by xor » 09 Apr 2006 20:55

I'm with you on the wiki. I purchased a couple Varitronix MDLS-20464B-LV 20x4 Hitachi-based LCD's that plugs directly onto the board pins with no alterations whatsoever and works a charm. Mouser Electronics has several different models that can work easily like mine.
[color=darkred][b]xor[/b][/color]
[url=http://circuit-ed.com]CircuitED -[/url]

xor
Posts: 5465
Joined: 18 May 2005 00:59
Location: NYC
Contact:

#8 Post by xor » 10 Apr 2006 23:10

Some errata to declare about my previous comments on KS0066, KS0073, and HD44780 LCD controllers.

First, let me clarify that DDRAM address $00 of the KS00xx controllers, which is the first character of the first line, is identical to the HD44780 controller. I forgot to add the Command instruction that accesses DDRAM, which is 128......it's the same for all three controllers.

So here is the line/first-position addressing that a 20x4 LCD would use for each controller. As you can see, the KS0066 line addressing is identical to the HD44780 and therefore should be plug-in compatible with the LCD libraries:
  • KS0066:
    • Line 1 = 128 (128 + 0)
      Line 2 = 192 (128 + 64)
      Line 3 = 148 (128 + 20)
      Line 4 = 212 (128 + 84)
    KS0073:
    • Line 1 = 128 (128 + 0)
      Line 2 = 160 (128 + 32)
      Line 3 = 192 (128 + 64)
      Line 4 = 224 (128 + 96)
    HD44780:
    • Line 1 = 128 (128 + 0)
      Line 2 = 192 (128 + 64)
      Line 3 = 148 (128 + 20)
      Line 4 = 212 (128 + 84)
[color=darkred][b]xor[/b][/color]
[url=http://circuit-ed.com]CircuitED -[/url]

Golgob
Posts: 1
Joined: 24 Mar 2007 14:18

#9 Post by Golgob » 24 Mar 2007 14:21

hi,

maybe it's not the perfect subject, but I seem to have a problem with communicating with a 20x4LCD display controlled by a KS0073

I use the right adresses, with the right commands (80h, A0h, C0h and E0h) but line 2 and 4 don't seem to work.

suggestions anyone?

uwe1722
Posts: 128
Joined: 24 Sep 2005 08:47
Location: Germany

#10 Post by uwe1722 » 24 Mar 2007 16:41

hi,

if line 1 and 3 worked and line 2 and 4 didn't work then there is a problem with the line start address.

Did line 1 and 3 worked very well?

Bye

xor
Posts: 5465
Joined: 18 May 2005 00:59
Location: NYC
Contact:

#11 Post by xor » 24 Mar 2007 20:36

I looked at the datasheet for the KS0073 to be sure and these are the line addresses. You need to set bit 7 (0x80) to create the address command.
  • Line1 = 0x00 + 0x80 = 0x80 = 128
    Line2 = 0x20 + 0x80 = 0xA0 = 160
    Line3 = 0x40 + 0x80 = 0xC0 = 192
    Line4 = 0x60 + 0x80 = 0xE0 = 224
To move cursor to start of line:
  • Line1: LCD_CMD(128)
    Line2: LCD_CMD(160)
    Line3: LCD_CMD(192)
    Line4: LCD_CMD(224)
[color=darkred][b]xor[/b][/color]
[url=http://circuit-ed.com]CircuitED -[/url]

gabrielmrc
Posts: 6
Joined: 02 Jun 2011 14:55

Re:

#12 Post by gabrielmrc » 07 Dec 2011 15:25

xor wrote:I believe it's initialization and command structure are the same as the Hitachi controller, which means the libraries will work....up to a point. The differences to pay attention to are the line addressing, which for the KS0066 starts at 0 for Line 1, and 64 for Line 2. The Hitachi controller addressing starts at 128 for Line 1, and 192 for Line 2. You can access these addresses directly through the LCD_CMD() function of the LCD library, and then use LCD_OUT_CP() and LCD_CHR_CP() functions to start writing characters.

These differences in line addressing effectively means that using the LCD_OUT() and LCD_CHR() functions will not work since the library is based on the Hitachi controller. But there is a means to make it work rather easily and transparently, by changing the values for Lines 1 thru 4 in the "Uses\P16\Consts\lcd_conts.ppas" or "Uses\P18\Consts\lcd_consts.ppas" modules/units. Here is the example I pulled from the mBASIC module:

Code: Select all

CONST
      LCD_FIRST_ROW          as  byte = 128    ' <-- change to 0
      LCD_SECOND_ROW         as  byte = 192    ' <-- change to 64
      LCD_THIRD_ROW          as  byte = 148    ' <-- change to 20 if using 20x4 LCD
      LCD_FOURTH_ROW         as  byte = 212    ' <-- change to 84 if using 20x4 LCD
Rackley, who posts in the mBASIC forum, uses a 20x4 LCD that implements the KS0073 controller, and has used the library functions. This is the line addressing scheme his LCD uses:
  • Line 1: $00 thru $13
    Line 2: $20 thru $33
    Line 3: $30 thru $43
    Line 4: $40 thru $53
i have a lcd whit KS0066F00 driver. i use miKroC software to program my pic16F887. what i need to modify
do to lcd library ??

bboy
Posts: 1
Joined: 16 Oct 2013 14:50

Re: Which LCD are HD44780-compatible?

#13 Post by bboy » 16 Oct 2013 14:54

Hello, I have a problem with controler KS0066F00.

It is impossible to date to write the last 7 addresses the LCD: LMN96S009C2E .

The controller is equivalent to KS0066F00 HD44780F00 .

Writing at 0x60 is possible and even for all other lower this address.

Addressing a character at 0x65 , automatically repositions the character at 0x60 and even addresses 0x61 to 0x67 . Sending more characters following direct address to the RAM addresses 0x61 to 0x67 has the effect to be rewritten to address 0x60 and the characters address succeeds on this one after the other.

example:
Send 0, 1, 2, 3 , 4 and 5 to the respective addresses 0x61 , 0x62 , 0x63 , 0x64 , 0x65 , 0x66 .
Each character is sent successively every second.
The result is as follows:
The character '0 ' is displayed at 0x60 .
The character '1 ' is displayed at 0x60 and rewrote the old character '0' .
The character '2 ' is displayed at 0x60 and rewrote the old character '1' .
So on for the characters 3, 4 and 5.

Another method is to send letters directly to the address 0x60 .
By the means of a loop to receive the other characters without the RAM address . So the characters are displayed in natural increment of the LCD screen.

example:
Send 0, 1, 2, 3 , 4 and 5 to the respective addresses 0x60 , 0x61 , 0x62 , 0x63 , 0x64 , 0x65 .
Each character is sent successively every second.
The result is as follows:
The character '0 ' is displayed at 0x60 .
The character '1 ' is displayed on the 0x61 address.
The character '2 ' is displayed on the 0x62 address.
The character '3 ' is displayed at 0x63 .
The character '4 ' is displayed at 0x64 .

Post Reply

Return to “mikroPascal General”