PDA

View Full Version : Fun with LCD display



Bullwinkle
05-07-2006, 03:34 PM
I'm in the process of transferring a breadboarded project to Eagle Lite. Part of my project will use the LCD display that can with the Stampworks kit.

However trying to connect up the BS2 pins 12..15 to the LCD header was just impossible (single sided PCB...).

The right hand side of the BS2 looks like this:

P15
P14
P13
P12
...

The LCD header looks like this (rotated 180 degrees to line up better with the BS2):

DB7 DB6
DB5 DB4
. .
. .
E RW
RS .
. .

In the end I just connected the pins on the BS2 to the header in THE ONLY WAY that would eliminate tracks crossing each other. Which was like this:

P15 -> DB4
P14 -> DB6
P13 -> DB7
P12 -> DB5
P11 -> E
P10 -> RS
P9 -> RW

This solves the hardware problem. But software was simple writting nibbles to P12..P15 to drive the LCD. Since the bit ordering is not screwed I have to change my code from this:

LCD_Out:

nLCDbus = yChr.HIGHNIB ' output high nibble
PULSOUT E, 3 ' strobe the Enable line

nLCDbus = yChr.LOWNIB ' output low nibble
PULSOUT E, 3

HIGH RS ' return to character nMode

RETURN

to this:

LCD_Out:

nLCDbus = (yChr.HIGHNIB.BIT0 << 3) | (yChr.HIGHNIB.BIT2 << 2) | (yChr.HIGHNIB.BIT3 << 1) | (yChr.HIGHNIB.BIT1) ' output high nibble
PULSOUT E, 3 ' strobe the Enable line
nLCDbus = (yChr.LOWNIB.BIT0 << 3) | (yChr.LOWNIB.BIT2 << 2) | (yChr.LOWNIB.BIT3 << 1) | (yChr.LOWNIB.BIT1) ' output low nibble
PULSOUT E, 3
HIGH RS ' return to character nMode
RETURN

I have attached the circuit diagram if anybody is interested. It's ALMOST finished. Just need to add a few connections to the shift register and I think I'm finally done.

Has anybody else had this kind of problem? How did you solve it? This is my first project so I don't want to do a double sided PCB. Single sided is hurting my brain enough.

Bruce Bates
05-07-2006, 04:16 PM
Bullwinkle -

Generally speaking trying to correct a hardware problem in software, or a software problem in hardware is not a good idea, unless there is no other workable or cost effective solution. You certainly have another workable and cost effective·solution here, although you may not see it.

All you need to do now is to strighten out the order of the pins with a small cable between the Stamp carrier board, and the LCD. There's more than one reason for using a connecting cable, and no one ever said there had to be a direct Pin 1 ==> Pin 1 correspondence between the cables ends! So, you make yourself a short cross-over cable, something like this, or however you need it wired:

/code

DB4 ---····· -----------> DB7
········ · \·/
DB6 ----/\-------------> DB6
······· ·· /··\
DB7 ---·· --\-----------> DB5
······· ·· /···· \
DB5 ---········ ---------> DB4

E··· ===========> E

RS· ===========> RS

RW· ===========> RW

code/

Now, using a hardware solution, your hardware problem is ended, and you can go back to using the appropriate (software) program coding.

Regards,

Bruce Bates


▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<!--StartFragment -->

Bullwinkle
05-07-2006, 05:25 PM
Thanks Bruce, that sounds like good advice. I'm still in the planning phase at this stage. Now I finally have the schematic done, it's time to layout the components on the PCB. I'm sure I'll strike more physical problems with the hardware before I'm thru.

It's terrific fun though. http://forums.parallax.com/images/smilies/turn.gif

SSteve
05-07-2006, 11:05 PM
Bruce, did you mean to put your cable illustration in a code block? If so, you didn't use the right delimiters. The code tag is the word "code" in square brackets, not "/code". (And the end tag is "/code" in square brackets.) Maybe it looks different on your screen, but I'm having a hard time deciphering what you wrote.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
OS-X: because making Unix user-friendly was easier than debugging Windows

Bruce Bates
05-08-2006, 12:48 AM
Steve -

That's the only way I know how to keep the spacing and lines intact, and I only know that from seeing others do it that way. It's always worked before, and the message here on the web site looks reasonable, although no ASCII "art" is great!

Apparently Bullwinkle got the idea which is all that really counts. The diagram is useless to anyone else.

Regards,

Bruce Bates

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<!--StartFragment -->

SSteve
05-08-2006, 01:36 AM
But you realize that "/code" and "code/" don't don't do anything, right?

And don't sell yourself short. The diagram isn't necessarily useless to anyone else. http://forums.parallax.com/images/smilies/smile.gif

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
OS-X: because making Unix user-friendly was easier than debugging Windows

Bullwinkle
05-08-2006, 07:18 AM
Thanks Bruce. I understood your ASCII art "picture" immediately because I had drawn an identical one to work out how to modify the software. Doing the same thing with the ribbon cable would negate the need for the software fiddle.

While on the topic of the LCD header. Do I need to run Vcc and/or Vss to the LCD? So far the only signals I am hooking up are E, RW, RS, DB4, DB5, DB6 and DB7.

BTW - The LCD is the parallel one that comes with the Stampworks kit. I probably should use a serial LCD in this project since the parallel unit takes 7 I/O pins. But it's always easier to build with stuff you have on hand. I'd still need the shift register anyway due to the large number of I/O ports this project calls for.

Bruce Bates
05-08-2006, 09:10 AM
Bullwinkle -

You will certainly need to bring both the positive voltage and ground to the LCD by some means. You may also need a negative voltage, depending on the type of LCD, if the contrast circuit requires it -some do and some don't. If it's convenient to bring it along with the rest of the signals - fine, otherwise you can easily strip down a piece of ribon cable to bring along just what you need for the power circuit.

There are LCD driver IC's which will permit a parallel LCD to be used in serial mode, if you are interested. E-Lab has a couple of different types:
http://www.elabinc.com/

Click on EDE IC's and then on the "LCD Screen Control" IC's

Regards,

Bruce Bates

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<!--StartFragment -->

Bullwinkle
05-08-2006, 10:13 AM
Thanks Bruce - I'd forgotten about the contrast circuit! D'oh!!!!

Does anyone know if Parallax publish the circuit diagram of the Stampworks kit somewhere? That could be useful for me.

Chris Savage
05-08-2006, 10:18 AM
The schematic for the PDB can be found here:

http://www.parallax.com/detail.asp?product_id=28138

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com (mailto:csavage@parallax.com)

Bullwinkle
05-08-2006, 10:21 AM
Fantastic!

Thanks Chris... http://forums.parallax.com/images/smilies/smile.gif