Shop OBEX P1 Docs P2 Docs Learn Events
Parallel LCD Interfacing — Parallax Forums

Parallel LCD Interfacing

Sal AmmoniacSal Ammoniac Posts: 213
edited 2009-11-23 22:29 in Propeller 1
I have an HD44780-compatible 20x2 LCD that I want to interface to a Propeller Proto board.

This LCD doesn't work with 3.3v on Vdd, but does with 5v. When I look at some of the LCD's pins (e.g. the data pins DB0-DB7) with a scope I see 5v on them. Can I connect this display directly to the propeller, or do I need a level converter to convert 5v -> 3.3v on the interface pins (RS, R/W, E, DB0-DB7)?
·

Comments

  • mikedivmikediv Posts: 825
    edited 2009-11-21 00:38
    Sal some of us have just connected straight through but to be honest I now use 1K resistors to the data lines and the control lines ,, Rayman is the resident display guru maybe he will chime in but I have a 4X20 working fine with the prop connecting with 1K resistors and it works just fine
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2009-11-21 02:04
    There is no need to use resistors if you lock the display in write mode by tying R/W low. Normally all that is read is the BUSY status as data manipulation is done externally. The delays for most things are fairly short and can be ignored especially if you interface in Spin. The only command that really takes any time at all is the CLEAR command so a 1ms delay or so is usually all that is necessary. Never had a problem with this approach.

    Most displays have an input threshold of 2V, in some rare cases I have come across CMOS threshold modules (0.7VCC).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
  • Sal AmmoniacSal Ammoniac Posts: 213
    edited 2009-11-21 06:29
    I threw some 4.7K resistors on the control and data lines, plugged the display into 5v, and everything works fine. Thanks.

    I'm finding it very easy to write driver code in Spin to control things like the LCD and the SCP1000 pressure sensor I wrote last night. The only mildly disappointing thing is the speed. I can only toggle an I/O pin every 11 usec in a tight loop at 80 MHz. I'll have to write drivers for devices that require faster timing in assembly.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-11-21 06:50
    You can use resistors as low as 3.9K while maintaining safe current limits for the internal diodes. The difference between that and 4.7K might buy you some speed. =) Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Parallax Engineering
    50 72 6F 6A 65 63 74 20 53 69 74 65
    ·
  • LeonLeon Posts: 7,620
    edited 2009-11-21 08:28
    It probably is working at 3.3V but needs a negative contrast supply for you to see anything! The PowerTip LCDs I have work at 3.3V according to the data sheet. You could generate a negative supply with a couple of diodes and caps connected to a Propeller o/p pin.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM

    Post Edited (Leon) : 11/21/2009 8:35:02 AM GMT
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2009-11-21 08:35
    I don't get it. Time and time and time again this parallel lcd interface stuff comes up. Everybody WANTS to put resistors in the I/O lines. It is ABSOLUTELY unnecessary if you tie R/W low, there is no need to read back, simple as that. With over 25 years of interfacing to the same boring lcd chipset I do know what I'm talking about, but go ahead put those resistors in anyway.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2009-11-21 09:41
    I agree with Peter. I just built one of these and 'super simple' LCD interface is:
    Pin 1,3,5,7,9,8,10,16 to ground.
    Pin 2 to 5V.
    Pin 15 to 5V via a 1k resistor (backlight).
    Pins 11,12,13,14 = data lines
    Pin 4 = RS
    Pin 6 = E

    As Peter says, tying R/W low means the device never sends any data back (it is a display so it doesn't really need to). So you don't need any resistors.

    Neither do you really need a contrast pot. After constantly finding they always ended up wound right round one way, I just tie the contrast to ground.

    No delays needed in spin code (there is code on the obex with 1ms delays but they are not needed). The only delay is one on startup = put all 6 lines low and wait 200ms before sending the setup codes.

    The only thing I haven't actually tested is running it from 3v3. I am driving it via a HC374 latch that is run from 5V and I know the latch will accept 3V3 as a high input. But I'm not 100% sure if LCD modules will.

    Re When I look at some of the LCD's pins (e.g. the data pins DB0-DB7) with a scope I see 5v on them., try pulling R/W low and see if any of those pins still have 5V on them.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.smarthome.viviti.com/build
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2009-11-21 11:19
    The data pins DB0..DB7 are the only pins that can be outputs and only if R/W and E is high. Back in the 80's the Hitachi style LCD interface (hd44780) was already ancient but they just keep making them the same for compatibility, forget about practicality. Even the micros of the 80's couldn't really interface to these via a traditional data bus as the cycle time was way too slow, it meant inserting lots of wait states plus giving them an active high rather than low signal. A real PITA they were. Many just interfaced to them via parallel I/O ports. It never made any sense but if they had originally been designed in the US or Europe they would have been a lot more sensible and usable.

    There is nothing stopping all these hundreds and hundreds of Hitachi compatible chip makers from putting in a shift register and do what the makers of the 128x64 LCD that I have been talking about have done by making it compatible plus practical so that you can just use two I/O instead. That would at least make a lot more sense than having this archaic interface on intensive life support. Of course I2C or asynch serial would make even more sense.

    Some LCD usage tips (take em or leave em):

    1. Tie R/W low and just use an appropriate delay as specified in the datasheet (1.5ms for clear and home commands, 40us for all else)

    2. Skip the pot. Try tying the contrast pin directly to ground or through a diode (0.6V) which is a good compromise. Alternatively use PWM into an RC network to drive the contrast. You find that most pots only use a few percent of their range and you need a screwdriver and access anyway so why bother.

    3. Practically all LCDs have 2V thresholds so they will work fine without buffers. As James pointed out you can probably run them off 3.3V but the contrast pin needs to be around 4.5V negative to the supply (that's why they quote the figure as Vdd-Vo).

    4. The backlights on some require over 200ma but you don't need a TO220 pack transistor to switch this, no no no, I use a tiny SOT-23 pack BC817 with a series 2R2 resistor to achieve on/off and PWM control of the backlight. Sometimes it makes more sense to tie the backlight to a higher voltage and control the current with the resistor or via PWM rather than cook the systems 5V regulator.

    If you really want to know about these displays then don't look at the display datasheets as they are little more than a brochure, go to the definitive source, the "Hitachi HD44780 Dot Matrix Liquid Crystal Display Controller/Driver" manual, it's 226 pages long.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
  • Sal AmmoniacSal Ammoniac Posts: 213
    edited 2009-11-21 17:27
    If you really want to know about these displays then don't look at the display datasheets as they are little more than a brochure, go to the definitive source, the "Hitachi HD44780 Dot Matrix Liquid Crystal Display Controller/Driver" manual, it's 226 pages long.

    Where can I get this manual? A Google search turned up a few references to it, but not the manual itself.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2009-11-21 17:41
    The 226 page Hitachi HD44780 LCD Controller manual.
    www.pbjtech.com/propeller/hd44780%20MANUAL.pdf

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
  • Sal AmmoniacSal Ammoniac Posts: 213
    edited 2009-11-22 18:30
    Thanks. I already had that manual. It's "226" pages because it starts at page 167. wink.gif
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-11-22 20:00
    Peter Jakacki said...
    I don't get it. Time and time and time again this parallel lcd interface stuff comes up. Everybody WANTS to put resistors in the I/O lines. It is ABSOLUTELY unnecessary if you tie R/W low, there is no need to read back, simple as that. With over 25 years of interfacing to the same boring lcd chipset I do know what I'm talking about, but go ahead put those resistors in anyway.
    Peter,

    Power users such as myself require the resistors because we are reading from the LCD.· If you're not reading the busy flag before sending data out to the LCD then you have no choice but to delay every byte sent.· Some commands take the controller longer to process than others meaning extra long delays for data not requiring it.· In my routines the busy flag is read allowing the next byte of data to be sent immediately upon the LCD being ready to receive it.· I have also had need in the past to read data stored in off-screen memory in the LCD.· Nonetheless, it is important to understand how to do this if you plan on reading any data.· Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Parallax Engineering
    50 72 6F 6A 65 63 74 20 53 69 74 65
    ·
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2009-11-23 22:29
    Chris, I'm not sure what a "power user" is but I have lcd modules designed into products from industrial controllers to vending machines spanning over 2 decades. I'm just passing on some tips to some who think you have to do it a certain way and you know, you don't. The historical note is simply there to elucidate the reasons for the parallel interface that is used and why it doesn't need to be used for the same reasons it was 25 or more years ago when your lcd had more ram then your system. How much ram does the Prop have?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
Sign In or Register to comment.