C++ and the LCD function.

This is the English forum for all topics related to IO-Warrior. Please post in English only

Moderator: Guido Körber

williamk
Posts: 20
Joined: Thu Feb 19, 2004 8:06 am
Contact:

Post by williamk »

It doesn't hurt to ask, so here I go again. ;-) (just ignore me if I'm bothering too much)

The LCD I'm using is 4x20, it works, but the lines shows in a diferent order. I could code taking that in account. BUT, I could also init it the right way.

How can I init a 4x20 LCD?

data[0] = 0x05;
data[1] = 0x03;
data[2] = 0x28 | 0x14; // for 2*16 display

And how can I select the second set of characters? ROM Code: A02

Wk
williamk
Posts: 20
Joined: Thu Feb 19, 2004 8:06 am
Contact:

Post by williamk »

Guido Körber wrote:
williamk wrote:BTW: Can't I use the same ON port that lights the backlite to open the 5+V or Ground to the LCD? So it stays OFF until you send the LCD-ON command? If I said something stupid, ignore me ...

Wk
If you make sure that the voltage drop across your transistor (or whatever you use to switch the supply voltage) is low enough you can do that. You should switch the +5V end of the power, switching ground is more critical as this is the comman reference and if that changes you can get errors.
Hummm, can't I just use an extra transistor on the same way you guys present on the PDF to turn the LCD Backlight ON? {5+V, IOW LCD ON Out, LCD 5+V Input}

Wk
Guido Körber
Site Admin
Posts: 2856
Joined: Tue Nov 25, 2003 10:25 pm
Location: Germany/Berlin
Contact:

Post by Guido Körber »

williamk wrote:The LCD I'm using is 4x20, it works, but the lines shows in a diferent order. I could code taking that in account. BUT, I could also init it the right way.
You can't. The HD44780 is quite old and a bit arkward. The funny relation between data address and actual display position is due to the way they originally implemented the things. The controller is relying on shift registers and the original chips used extender chips if you needed larger displays. This lead to the funny placement of the data relative to the display.
Guido Körber
Site Admin
Posts: 2856
Joined: Tue Nov 25, 2003 10:25 pm
Location: Germany/Berlin
Contact:

Post by Guido Körber »

williamk wrote:Hummm, can't I just use an extra transistor on the same way you guys present on the PDF to turn the LCD Backlight ON? {5+V, IOW LCD ON Out, LCD 5+V Input}

Wk
Basically you can, but make sure you understand what you are doing. The second transistors needs it own base resistor and you should make sure to use a type with sufficient current amplification to make sure you have a low voltage drop.
williamk
Posts: 20
Joined: Thu Feb 19, 2004 8:06 am
Contact:

Post by williamk »

Guido Körber wrote:
williamk wrote:The LCD I'm using is 4x20, it works, but the lines shows in a diferent order. I could code taking that in account. BUT, I could also init it the right way.
You can't. The HD44780 is quite old and a bit arkward. The funny relation between data address and actual display position is due to the way they originally implemented the things. The controller is relying on shift registers and the original chips used extender chips if you needed larger displays. This lead to the funny placement of the data relative to the display.
But I can still use it, right? Just have to code taking this to account..

Wk
Guido Körber
Site Admin
Posts: 2856
Joined: Tue Nov 25, 2003 10:25 pm
Location: Germany/Berlin
Contact:

Post by Guido Körber »

williamk wrote:But I can still use it, right? Just have to code taking this to account..
Of course you can use it. This is what almost everybody using LCD modules has been living with during the last 25 years or more...
williamk
Posts: 20
Joined: Thu Feb 19, 2004 8:06 am
Contact:

Post by williamk »

Guido Körber wrote:
williamk wrote:But I can still use it, right? Just have to code taking this to account..
Of course you can use it. This is what almost everybody using LCD modules has been living with during the last 25 years or more...
Eeeekkk, is impressive on how a company can crap something like they did. ;-) But I'm glad I can still use it ...

I found how to use the 8 user-set chars, very usefull for me. But still, the ROM Mode: A02 would be best for me, but I can't figure out how to set to it ... Anyway, back to reading more PDFs I guess. ;-)

Wk
Guido Körber
Site Admin
Posts: 2856
Joined: Tue Nov 25, 2003 10:25 pm
Location: Germany/Berlin
Contact:

Post by Guido Körber »

williamk wrote:Eeeekkk, is impressive on how a company can crap something like they did. ;-) But I'm glad I can still use it ...
The HD44780 is about 25 years old. Back then there was very good reason to build the thing like it is. Transistor count was at a premium back then and CMOS was slow. The wohle thing is hard wired logic with shift registers and latches galore. Since one part of the design goal was to make the chip expandable from 2x8 chars to 2x40 chars while keeping the complexity of the logic low it ended up being what it is now.

The driver chip does not know anything about the physical implementation of the display, it does not even know if the registers are really 2x40 chars log or if the extender lines are open.

But that is electronic history...

I have an old display here that has an original HD44780 on it and a couple extender chips that each handle 2x8 chars of the display.
Post Reply