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.

LCD Interfacing help needed!!

Status
Not open for further replies.

pike

Member
Hi guys,

I was doing some work over the weekend with my LCD that i bought second hand off my friend at work. I don't know the brand or chipset that it uses all i know is that it has 16 pins:

8 pins are for data
2 pins are for the LED lighting
2 pins are for power.
1 pin for contrast

and 3 other pins called:

Enable
RS
and R/W

Does anyone know what these last 3 pins actually do/ Require for operation??? I'm totally lost with this. I've had no luck on google, and i've had no experience with LCD's before. And i'm really desperate for some kind of explanation!!!

Thanx in advance
 
pike said:
thanx for that MonkeyXP.
Although I am still pulling my hair out over the "Enable"" pin. Anyone else?

The enable pin isn't needed, if you check my PIC tutorial pages I have circuits and code for using the LCD modules
 
You DO need the enable PIN.... I was kind of lazy to write something up since you should be able to find that information about everywhere on the net.... but here it goes :wink:

A standard LCD module comes with 14 pins (sometimes 16)
- 8 Dtata Lines (D0-D7)
- 3 Control Lines (RS, W/R, E)
- 3 Power Lines ( Vdd"+", Vss "-", Vee-Contrast Control "Sometimes negative")

:arrow: The Vee (if not a negative source required) can be obtain with a Potenciometer connected between Vdd and Vss.

:arrow: The Data lines D0-D7 are bus lines where information can be transfered from AND to the display. There are two modes of transmitting data 8-bits (using all 8 lines) at a time... or using nibbles (transmiting 4 bits, twice). Either way you are always transmitting 8-bits of data. When transmitting characters you will need to refer to a ASCII table most of the time. When transmitting commands you will need the commands intruction set for the LCD

:arrow: On the control side, we have the RS- Register Select. At this time I would like you to see the back of the LCD and check the chip that is in it. The most common is a HD44780 or similar. You can do a google search if yours is different and check the instruction set. Back to the RS.... you can send characters to the LCD or Commands such as position the cursor on the second line. To diferenciate between what you are sending if a command or Data you have to manipulate this line. If the RS line is set high, the LCD will interpret any information in its D0-D7 as a character. If the RS is Low then the LCD will read its D7-D0 and interpret that as a commands, according to its Instructions Set.

:arrow: R/W is the Read/Write line control... as you can probably guess they control weather you want to send data to the LCD or recieve information form the LCD. Most application you only want to send data to the display therefore you pull this line low in hardware, so you don't waste pins on your controller.

:arrow: And with the infamus E- Enable control input. This pin is used to tell the LCD that the data in its port is ready to be read and that the RS and R/W are also set. This Enable line is kept normally LOW and pulsed HIGH for a X amount of time (depending on your chip set). When the transition from low to high is detected on the pin E then and only then the data in the D0-D7 port will be read.

:arrow: Other things to consider... a LCD when powered up needs to go thru its initialization process, before you can send any commands to it. When powered up there are also certain "defaults" that the LCD starts with, such as Display is OFF (so altough you have power the LCD, it won't show characters sent), therefore in your LCD controller you must turn the LCD display ON.... certain cursor properties will be in default too... like Cursor OFF, etc. The controller CHIP intruction set will tell you what are the defults.


:idea: So the first thing you should do is get the instrucion set for your LCD controller. Here is a link to the HD44780..... try also looking for the specs on your LCD online... a google search will help you with something.

Well I hope it helps you some,

Good Luck

Ivancho
 
Nigel Goodwin said:
pike said:
thanx for that MonkeyXP.
Although I am still pulling my hair out over the "Enable"" pin. Anyone else?

The enable pin isn't needed, if you check my PIC tutorial pages I have circuits and code for using the LCD modules

You do use the E pin in the tutorials... perhaps it's been quite a while since you wrote those :) (just kiddin')
 
Nokia 3310 LCD

recently i try to interface PIC with Nokia 3310 LCD. Is there any PICBasic example code for it?
 
most Nokia LCD's use I²C. There's info about their protocol on the net.
Doing the I²C itself is easy with picbasic as it is a built in command
 
Thankyou very much Ivancho!! :D That has helped me alot!!

Just two other curious questions:

-Would this mean I can control multiple LCD's, provided i have the ENABLE pins on different outputs of the microcontroller???

-How long should i keep the enable pin high for, so the LCD has time to react??

Thanx again!! :D
 
pike said:
-Would this mean I can control multiple LCD's, provided i have the ENABLE pins on different outputs of the microcontroller???

-How long should i keep the enable pin high for, so the LCD has time to react??

Thanx again!! :D

I've never looked into using more than one LCD, but it could probably be done.

This is all I use to pulse the enable line, I added the NOP just as good practice, it will probably work fine without it. It works happily at either 4MHz or at 20MHz with all LCD's I've tested it on.

Code:
Pulse_e		bsf	LCD_PORT, LCD_E
		nop
		bcf	LCD_PORT, LCD_E
		retlw	0x00
 
pike said:
Thankyou very much Ivancho!! :D That has helped me alot!!

Just two other curious questions:

-Would this mean I can control multiple LCD's, provided i have the ENABLE pins on different outputs of the microcontroller???

-How long should i keep the enable pin high for, so the LCD has time to react??

Thanx again!! :D

I suppose that could work out, I've bever had to use something like that :D

How long your enable should remain high depends on the manufactureer.... But it is not something that will be to high.... the minimum for a HD44780 based LCD would be in the nano seconds, something like 450nSec minimum...... and it must remain low for another 550nsec..... That means a total of 1usec.... if you need something that reacts faster than that.....mmm..... :wink:

Make sure that you have the LCD datasheet, they are easily obtain..... that way you can see the timing tables, memory locatoins, etc.

Good Luck

Ivancho
 
pike said:
Thankyou very much Ivancho!! :D That has helped me alot!!

Just two other curious questions:

-Would this mean I can control multiple LCD's, provided i have the ENABLE pins on different outputs of the microcontroller???

-How long should i keep the enable pin high for, so the LCD has time to react??

Thanx again!! :D

- Yes, you can use multiple LCD's this way. Only the LCD wich E line is strobed will react to the data. Keep in mind HD44780's support 2 way communication. If you hook multiple LCD's on the same bus you'll might have problems reading back from a lcd. that's something you need to test
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top