LCD 4x20 HD44780


Closed Thread
Results 1 to 14 of 14
  1. #1
    inteco's Avatar
    inteco Guest

    Question LCD 4x20 HD44780

    Hi,

    Wonder if anyone has code sample or kow how to setup
    for this LCD 4x20 HD44780.


    Thanks
    Lee

  2. #2
    Join Date
    Feb 2005
    Location
    Kolkata-India
    Posts
    563


    Did you find this post helpful? Yes | No

    Default Same as any other LCD

    Hi,

    You connect the LCD as any other like the 2x16. Read your PBP manual. If still unclear post specific queries. Here is a sample LCD defination :
    Code:
    'LCD DEFINATION*****************************************************************
    
            DEFINE LCD_DREG PORTD       ' Set LCD Data port
            DEFINE LCD_DBIT 4           ' Set starting Data bit (0 or 4) if 4-bit bus i.e, PortD.4-PORTD.7
            DEFINE LCD_RSREG PORTB      ' Set LCD Register Select port
            DEFINE LCD_RSBIT 0          ' Set LCD Register Select bit i.e, PORTC.5
            DEFINE LCD_EREG PORTB       ' Set LCD Enable port
            DEFINE LCD_EBIT 1           ' Set LCD Enable bit i.e, PORTE.4
            DEFINE LCD_BITS 4           ' Set LCD bus size ot 4 bit Upper Nibble (4 or 8 bits)
            DEFINE LCD_LINES 4          ' Set number of lines on LCD to 4 Lines
            DEFINE LCD_COMMANDUS 2000   ' Set command delay time in us
            DEFINE LCD_DATAUS 50        ' Set data delay time in us
    
    '*******************************************************************************
    Regards

    Sougata

  3. #3
    Join Date
    Jun 2005
    Location
    Wisconsin
    Posts
    382


    Did you find this post helpful? Yes | No

    Default

    Only one problem with the previous post, picbasic doesn't support LCDOut or any of the defines. You would need to upgrade to PRO to do it this way. That being said you may want do a little searching here or on the web. BasicStamp LCD routines should work fine for what you are doing.

  4. #4
    inteco's Avatar
    inteco Guest


    Did you find this post helpful? Yes | No

    Default

    Thanks for your reply.
    I'm using PBPro version. When I watch carefully to the LCD, I got
    the display output, but it is very blur and almost invisible.
    Only viewable from a certain angle. I already adjusted the pot for
    the contrast pin from 0-5 Vdc, 0 Vdc still the best, but still
    unreadable. Wish there are more space to turn the pot beyond the
    pot.
    Wonder if there is any type of LCD that need negative voltage
    at the contrast pin ?

  5. #5
    inteco's Avatar
    inteco Guest


    Did you find this post helpful? Yes | No

    Default

    In fact, I got 2 x 16 LCD, and they all work find with the code,
    only the 4 x 20 LCD that has contrast problem.
    Thanks

  6. #6
    Join Date
    Feb 2005
    Location
    Kolkata-India
    Posts
    563


    Did you find this post helpful? Yes | No

    Default LCDs are temperature sensitive

    Hi,

    Try using a negative supply. If you are using a Centre tapped transformer then you may derive it from there. An onboard Hardware PWM with a diode-cap charge pump can do the same. MAX232 has an onboard charge pump (-12V) available on its VEE pin. So a little experimentation would solve your problem
    Regards

    Sougata

  7. #7
    inteco's Avatar
    inteco Guest


    Did you find this post helpful? Yes | No

    Default

    Thanks guy.
    Will experiment with negative voltage later this weekend,
    hope I won't burn my LCD : -)

  8. #8
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    If you do not want to damage your 4x20 then read the 4x20 datasheet before trying anything else. I have several brands of 4x20s in use and none require a negative voltage on the contrast pin. Yours could be different but read the datasheet first.

    Good Luck,

    Paul Borgmeier
    Salt Lake City, Utah
    USA

  9. #9
    inteco's Avatar
    inteco Guest


    Did you find this post helpful? Yes | No

    Default

    Thanks for reply.

    In fact, I read the datasheet, but somehow it just different from the real world. Anyway, just burn 1 because I plugged in the wrong cable which power up the LCD with 10 volts.

    The contrast, indeed need negative voltage of up to -5.7 vdc with relative
    to 0/gnd. Whereas the Vdd remain at 5.1 Vdc.

    The LCD is made by OPTREX model DMC20481.

  10. #10
    inteco's Avatar
    inteco Guest


    Did you find this post helpful? Yes | No

    Default

    Extra Information :
    There won't be any need to
    DEFINE LCD_LINES 4

    PBPro will work too if with DEFINE LCD_LINES 2.

    Not really sure if the DEFINE LCD_LINES actually applied.

  11. #11
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Default

    snip ....
    The contrast, indeed need negative voltage of up to -5.7 vdc with relative
    to 0/gnd. Whereas the Vdd remain at 5.1 Vdc.

    The LCD is made by OPTREX model DMC20481.
    ... end snip

    Wow - something is not right because my DMC20481 uses a + voltage for contrast. See the attached snippets from my DMC20481 datasheet.

    Thoughts?

    Paul Borgmeier
    Salt Lake City, Utah
    USA
    Attached Images Attached Images

  12. #12
    inteco's Avatar
    inteco Guest


    Did you find this post helpful? Yes | No

    Default

    yup,
    this is the one I got, but it just don't work with + voltage.
    I have 6 pieces of these, tried them all, and they all need
    neg voltage.

  13. #13
    Join Date
    Sep 2005
    Posts
    10


    Did you find this post helpful? Yes | No

    Default Negative contrast voltage

    Recently I bought two Hantronix HDM16216-B LCD's. I got the same results as you did. Needed a negative contrast voltage.

  14. #14
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    If your PIC has a spare unused PWM output, you can easily create a (software variable) negative voltage and drive your LCD contrast from that directly. The added bonus is that by varying the duty cycle, you have full software adjustable contrast.

Similar Threads

  1. 16f688 LCD what have I done wrong
    By spitfiredriver in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 8th August 2009, 20:54
  2. Play with LCD on PICDEM
    By The IceMan in forum mel PIC BASIC
    Replies: 5
    Last Post: - 22nd August 2008, 17:56
  3. Need help with LCD number display.
    By Steve Matson in forum mel PIC BASIC
    Replies: 8
    Last Post: - 27th June 2007, 00:07
  4. LCD will not start
    By btaylor in forum mel PIC BASIC Pro
    Replies: 49
    Last Post: - 24th May 2007, 03:30
  5. Lcd Hd44780
    By alaaodeh in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 6th February 2007, 15:04

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts