Jaycar LCD Modules

01Sep08

Couple of weeks ago I wanted to add a display to one of my pic projects so I headed down to jaycar and purchased a simple LCD module. 3 screens later I’ll share the do’s and do nots on these screens and hopefully form a good howto on these babies.

Models covered: QP5515, QP5517, QP5518, QP5519, QP5520. Stay away from the mini version unless you have a ribbon cable clap, jaycar don’t.

Step 1: Connections

This is a vital step :). Messed up logic connections aren’t going to damage this unit but power connections are important!!! Look at the datasheet because connections do differ between different models, but usually pin1 = 5v and pin2 = 0v, GET THIS ONE RIGHT!

LCD Connections

  1. 5v                   -> Pin1 ;Power
  2. GND                -> Pin2 ;Gnd
  3. GND ->10Kpot -> Pin3 ;Contrast Adjust
  4. RS                   -> Pin4 ;Register Select – Instruction/Data
  5. GND                -> Pin5 ;Write/Read
  6. E                     -> Pin6 ;Write Enable
  7. GND                -> Pin10-7 ;4LSB data
  8. Data7-4          -> Pin14-11 ;4HSB data

Definitions

  1. Power. On these modules this powers the controller, backlight(if app) and LCD screen so don’t worry about that A & K crap in some of the data sheets its already been done for you.
  2. Ground. 0volt
  3. Contrast Adjust. This must be hooked up if anything is to be displayed on the screen as it completes the LCD circuit. A 10kpot gives good adjustment and can be replaced by a single resistor at a later stage. The LCD isn’t too fussy, I’m just using a 100k pot I had laying around . When you turn on the screen you should see some square boxes along the top row if you have the contrast set correctly.
  4. RS. This pin tells the LCD whether we are writing an instruction(clear screen etc..) or a character(A B C 123 etc..)
  5. R/W. Tells the LCD controller whether we are reading or writing to LCD memory. We will only ever be writing to memory so we can set this to gnd.
  6. Enable. Setting this to high informs the LCD controller that our data is ready to be read
  7. Data0-3. Used in 8bit communication mode. Will be set to gnd in our configuration for consistency.
  8. Data4-7. Data lines.

Note: Making all these connections on a breadboard or the like can be time consuming and the LCD is sensitive to heat and static. So I suggest buying a 2 x 16pin header from jaycar also (they didn’t have 14pin ones when I was there) and some ribbon cable and connector. Solder one to the screen and one to some prototyping board with some dip legs so you can have the screen off the bread board and lots of room to make connections. The headers legs just aren’t wide enough to make it across the center of my breadboard thats why I made a little prototype attachment

.

Blown: If your power line is shorted to ground I’m sorry but that screen is now rubbish, there may be a way to repair it but for the meantime its broken, time to get a new one.

Step 2: Software

The LCD controller is based upon a Hitachi 44780 LCD controller (Datasheet http://www.datasheetcatalog.org/datasheets/400/81271_DS.pdf) and there are heaps of example code out there on how to get the thing running. Perhaps later I will post mine but for the mean time I will just leave some hints and notes how how to best get it working.

First you need to run the initialisation sequence. Follow the steps in the datasheet with gaps of around 100ms inbetween the first 3 instructions and 10ms in between the following pairs of instructions. Choclabs have some good example code here for PIC but its all assembler in the end http://www.choclab.eu/mtorrens/Files/LPM01-4bit.asm

If your having trouble I found it to be my Enable signal. The best sequence is as follows, set your data out and RS then call a function that puts E high, few nops, then low, so it pulses the enable line. We want the enable pulse to last about 1uS(thats heaps) whilst the data is stable.

E        _________________—————-________________________

Data  ______________—————————-______________

RS    ______________—————————-______________

where high in both Data & RS is to demonstrate that the line is stable and containing values, they may be of another value.

Once the initialisation has finished the data is going to be sent in pairs(4bits then 4bits), there doesn’t need to be a delay between 4bit pieces longer than 1uS, but once both instructions have been sent a delay of 1mS is needed before the next instruction.

The LCD controller does produce a busy flag whilst it is processing an instruction which is raised at the end of a data pair. You can use this to determine when to write to the screen but it will require an extra connection to RW to enable reading from the screen and the time savings will be minimal/of no real use when your first starting. I suggest just waiting 1mS after a data pair is sent until you are familiar with the unit.

Step 3: Troubleshoot

Its unlikely you will get this baby working first time so don’t be disheartened. It took me a few nights to get mine going. Just check the cables, make sure the screen is getting the signals. Keep the supply voltage around 4.7-5v and use example code on the web but make sure your pin assignment is the same as theirs and adjust as necessary.



5 Responses to “Jaycar LCD Modules”

  1. 1 Lee

    I may have very stupidly blown mine by shorting the power rail to ground! Any ideas on repair?

  2. 2 celtek

    Unfortunately if you applied the incorrect polarity to the LCD module you’ve destroyed part of the little IC under the black stuff on the back. That can’t be fixed so you will have to get another one I’m affraid :’( happened to me once also very frustrating! Keep the screen though you can use that again(create your own controller or get a new one ie replacing the IC on the back) or if it was backlit you can take out the electroluminescent pannel and use that for something else http://en.wikipedia.org/wiki/Electroluminescence.

  3. 3 Lee

    I see, thanks for the info anyway. I’ve got another one now anyway!

    I’m interested in the little attachment you made to get the ribbon cable connector onto your breadboard properly. How did you do that?

  4. 4 celtek

    A little section of prototyping board, dip pins(actual name has escaped me) and 2 headers(http://jaycar.com.au/products_uploaded/productLarge_354.jpg), one for the LCD and one for the prototyping board. Solder it together so that the dip legs are wide enough to fit across the gap in the center of the bread board, you should then be able to connect the screen to the breadboard. I will post some more detailed pictures of this later this week.

  5. This is very hot information. I’ll share it on Twitter.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.

%d bloggers like this: