How to interface LCD to microcontroller?

Discussion in 'General Electronics Chat' started by CVMichael, Feb 6, 2012.

  1. CVMichael

    Thread Starter Senior Member

    Aug 3, 2007
    416
    17
  2. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    2,692
    2,756
    This is a single backplane LCD. There are three ways to drive it:

    1) Manually drive each segment via an I/O on your CPU. Need 1 pin for each segment and 1 pin for the backplane. You will need to write code to drive the pins/backplane with AC (squarewave).

    2) Use a CPU with a built-in LCD driver. Still need 1 pin for each segment + backplane.

    3) Use a separate discrete LCD driver attached to your CPU. Need fewer pins on CPU, but driver needs all pins for segment/backplane.

    FYI, you may want to consider a multiplexed LCD. Fewer pins to drive, and many CPUs (for instance, PICs) can drive up to four backplanes.
     
  3. CVMichael

    Thread Starter Senior Member

    Aug 3, 2007
    416
    17
    Thanks for your response.

    For #1

    But how do I connect the PIC to the LCD, do I connect pin directly? or do I use a resistor? (if yes, what value)

    Is the common wire "COM", common negative, or common positive?

    I have PICs that are 5V, and also 3.3V, do both pics work? i.e. what voltage does the LCD need?
     
  4. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,887
    1,016
    If I were you I would consider looking for another display. The datasheet on the digikey site is worthless, the link inside the datasheet does not work and the part number can't be found on the manufacturers site.

    Exactly what do you want to do with the display? Graphics or just characters?
     
  5. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    2,692
    2,756
    Why do you say the datasheet is worthless? It is perfectly clear to me. Obviously, he wants a numeric display, not graphics or characters.

    The only thing that isn't clear is the driving voltage, which I assume is 5V since that is the most common for this type of display. Even if it's a 3V display, 5V ain't gonna hurt it.
     
  6. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,887
    1,016
    I don't know which datasheet you are looking at but all I see is one for environmental specs and one showing a mechanical drawing.
     
  7. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    2,692
    2,756
    No, you don't need resistors. LCD are voltage driven parts, not current. Each segment just looks like a really sloppy capacitor. You can tie the CPU pins directly to each segment/backplane.

    One thing to remember is that you must supply a square wave to the back plane and each segment. Segments that are 'off' should be in phase with the backplane. Segments that are 'on' are 180 degrees out-of-phase. You will need 50% duty cycle on your square waves to ensure no DC component, as that will destroy the segments over time.

    This all *can* be done manually through programming, but most times, a dedicated driver (or on-chip LCD peripheral) is used.

    5V should work fine.

    EDIT: BTW, your square wave frequency should be on the order of 60Hz or so.
     
    Last edited: Feb 6, 2012
  8. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    2,692
    2,756
    Yes. The mechanical drawing is all one needs.
     
  9. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,887
    1,016
    Yeah see it now. All the way on the last page. Oh brother.
     
  10. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    2,692
    2,756
    This is a typical spec for this kind of display. I actually design these myself.
     
  11. CVMichael

    Thread Starter Senior Member

    Aug 3, 2007
    416
    17
    So your saying that I have to supply a 50% duty PWM to the pins? What is the normal frequency? Can I do that only on the COM (common) pin ?
     
  12. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    2,692
    2,756
    NO! Not PWM. Just a square wave. Think toggling pins 60 times per second. One pin is the master, connected to the backplane. Then, one pin for each segment. For each segment line, it should toggle in phase with the backplane if the segment is 'off', and toggle 180 degrees out-of-phase (opposite polarity) if the segment is on.

    Don't think PWM....it won't work!

    *EACH* pin must toggle. Any DC component will destroy the LCD.
     
  13. CVMichael

    Thread Starter Senior Member

    Aug 3, 2007
    416
    17
    Yes, that's right, I need numeric only, for a clock I want to make, and I want it to tell me when the battery is low. That's why I picked this particular display
     
  14. CVMichael

    Thread Starter Senior Member

    Aug 3, 2007
    416
    17
    Thank you for all the info, I think I'll be fine... I will get the display tomorrow, and I will play with it in the next few days...
     
  15. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    2,692
    2,756
    What CPU are you going to use?
     
  16. CVMichael

    Thread Starter Senior Member

    Aug 3, 2007
    416
    17
    Either PIC18F9722 or PIC18F87K90 (both 80 pin), or something close to that, I have a lot of PICs :D
     
  17. CVMichael

    Thread Starter Senior Member

    Aug 3, 2007
    416
    17
    And I will do the programming in mikroC PRO
     
  18. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    2,692
    2,756
    The 87K90 has a built in LCD driver for up to 48 segments. This will be *much* easier than trying to manually implement your own driver!

    Don't know about the 9722...

    Edit: Actually, I cannot find a pic18f9722 on microchips website...did you get the number wrong?
     
  19. CVMichael

    Thread Starter Senior Member

    Aug 3, 2007
    416
    17
    Ow, yea, it's PIC18F8722.... sorry
     
  20. CVMichael

    Thread Starter Senior Member

    Aug 3, 2007
    416
    17
    Just want to let you know that I got it work with the PIC18F8722.

    If anyone wants pics/schematic/source code (in mikroC), let me know.

    Thanks again for your help.
     
Loading...