4-line LCD Help - using PortA instead of B


Closed Thread
Results 1 to 29 of 29

Hybrid View

  1. #1
    Join Date
    Feb 2005
    Location
    Bellevue
    Posts
    125


    Did you find this post helpful? Yes | No

    Question No Joy!

    OK, I have been going crazy on the 4-line LCD.. the book makes it look so easy.. I am trying to send it an initialization routine (which apparently I need to do?) This is a Crystalfontz unit which should be really nice... I attached the spec sheet in case an expert out there might be able to take a look. I am sure others will want to use these displays also.

    http://www.crystalfontz.com/products...2004LYYBJP.pdf

    In any event, I've taken all the advice here, and from the Mfg says I am seeing just what I should before it is initialized.. However I still get nothing on any LCD.. I *MUST* be doing something really stupid.

    Here is the initialization routine I sent (which did nothing) - from page 17 of the LDC data sheet...


    define LCD_DREG PORTA ' Set data pin of LCD to
    define LCD_DBIT 0 ' PORTA.0-PORTA.3

    define LCD_RSREG PORTA ' Set RS bit of LCD to
    define LCD_RSBIT 5 ' PORTA.5

    define LCD_EREG PORTA ' Set E bit of LCD to
    define LCD_EBIT 4 ' PORTA.4

    DEFINE LCD_LINES 4 ' 4 Lines LCD
    define LCD_COMMANDUS 2000 ' Command delay time in uSec
    DEFINE LCD_DATAUS 100 ' Data delay time in uSec

    pause 20

    low PortA.5 ' RS
    ' RW is held low on board
    low PortA.3 ' db7
    low PortA.2 ' db6
    High PortA.1 ' db5
    high PortA.0 ' db4

    pause 20

    low PortA.5 ' RS
    ' RW is held low on board
    low PortA.3 ' db7
    low PortA.2 ' db6
    High PortA.1 ' db5
    Low PortA.0 ' db4

    pause 10

    low PortA.5 ' RS
    ' RW is held low on board
    high PortA.3 ' db7 - says "N" ??
    high PortA.2 ' db6 - says "F"??
    Low PortA.1 ' db5 - says "*" ??
    Low PortA.0 ' db4 - says "*" ??

    pause 2

    low PortA.5 ' RS
    ' RW is held low on board
    low PortA.3 ' db7
    low PortA.2 ' db6
    Low PortA.1 ' db5
    Low PortA.0 ' db4

    pause 1

    low PortA.5 ' RS
    ' RW is held low on board
    High PortA.3 ' db7
    low PortA.2 ' db6
    low PortA.1 ' db5
    Low PortA.0 ' db4

    pause 1

    low PortA.5 ' RS
    ' RW is held low on board
    low PortA.3 ' db7
    low PortA.2 ' db6
    low PortA.1 ' db5
    Low PortA.0 ' db4
    pause 1

    low PortA.5 ' RS
    ' RW is held low on board
    low PortA.3 ' db7
    low PortA.2 ' db6
    Low PortA.1 ' db5
    High PortA.0 ' db4

    pause 1

    low PortA.5 ' RS
    ' RW is held low on board
    low PortA.3 ' db7
    low PortA.2 ' db6
    High PortA.1 ' db5 - says "I/D" ??
    High PortA.0 ' db4 - says "S" ??

    pause 1

    low PortA.5 ' RS
    ' RW is held low on board
    low PortA.3 ' db7
    low PortA.2 ' db6
    low PortA.1 ' db5
    Low PortA.0 ' db4

    pause 1

    for x = 1 to 100
    lcdout $fe, 1
    lcdout $fe, 2
    LCDOUT "Hellow World"
    pause 2000
    next x

  2. #2
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762


    Did you find this post helpful? Yes | No

    Default

    Tom,

    according to the datasheet the LCD has en embedded HD44780 (or compatible) controller.

    with this controller you don't need to "manually" initialize the LCD.

    The first LCDOUT command issued does all the initialisation for you.

    assuming you have a 4k7 pull-up on RA4
    the following should work on an 16F876(A)

    Code:
    DEFINE OSC 20          ' <-- set your clock speed here !
    
    ADCON1=7               ' All Digital
     
    DEFINE LCD_DREG PORTA  ' Set data pin of LCD to
    DEFINE LCD_DBIT 0      ' PORTA.0-PORTA.3
    
    DEFINE LCD_RSREG PORTA ' Set RS bit of LCD to
    DEFINE LCD_RSBIT 5     ' PORTA.5
    
    DEFINE LCD_EREG PORTA  ' Set E bit of LCD to
    DEFINE LCD_EBIT 4      ' PORTA.4
    
    DEFINE LCD_LINES 4     ' 4 Lines LCD
    
    PAUSE 1000	       ' wait for LCD controller to start up	
    
    Loop:
    
    LCDOUT $FE,1	       ' clear display and move cursor home
    
    PAUSE 500              ' wait for "CLEAR" command to complete
    
    LCDOUT "HELLO WORLD"   ' print "HELLO WORLD" at current cursor position
    
    PAUSE 1000             
    
    GOTO LOOP
    
    END

    If there is still no success there is most likely something wrong with your LCD and/or your PIC.
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



  3. #3
    Join Date
    Feb 2005
    Location
    Bellevue
    Posts
    125


    Did you find this post helpful? Yes | No

    Exclamation

    Thanks very much!

    I am going to assume the LCDs from Crystalfontz don't work then. I ran the program and got nothing. Everything else on the PIC works fine. I have tried both of the LCDs I got from them, and the most I can see is line 1 and line 3 lit up with squares if I vary Vo.

    Does anyone have any good sources of 4x20 LCD displays?

    Thanks,
    Tom

  4. #4
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Tom Gonser
    Does anyone have any good sources of 4x20 LCD displays?
    Tom,
    it depends on where you are based.

    Over here a good 4x20 Backlit LCD will be EUR 20 - EUR 30.
    I have a source for 4x27 LCDs (non backlit) at EUR 5

    contact me via PM
    and see this
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



  5. #5


    Did you find this post helpful? Yes | No

    Default 4 line lcd

    before writing off 2 lcd's why don't you try hooking them up to your printer port like this
    http://www.myrolypoly.com/lcd_project/lcd_project.html
    it's an easy to follow article,if they work that way you'll know for sure whether it's a code or pic problem or there both bad.digikey or mouser are good sources of lcd's.
    good luck
    Last edited by bbarney; - 25th March 2005 at 14:35.

  6. #6
    Join Date
    Feb 2005
    Location
    Bellevue
    Posts
    125


    Did you find this post helpful? Yes | No

    Exclamation

    Interestingly, I see that the Crystalfontz displays require a pretty substantial intitialization routine. I can't tell if that is the same as what PBP send as standard or not.

    I downloaded a demo app, and it sets the bits E,RS,etc. high and low for about 10 seconds in a pattern that looks like it must be matching the tech notes for their displays. It takes the PC parallell port driver about 10 seconds to send all the bit settings, so I'd guess it is much more than 'standard'..

    The Crystlfontz guys don't seem to be able to provide details about exactly WHAT bits need to be sent and in what order to initialize the LCD.

    I think my time is better spent switching to an LCD that we KNOW works with PBP, which is too bad because CrystalFontz LCDs really look nice.

    Thanks as ususal for all the help folks!

    TG

  7. #7
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    can you try something for me and post your results?


    Code:
    ' place your LCD define here and all the others
    
    pause 2000
    FLAGS=0
    pause 500
    LCDOUT $fe,1
    pause 500
    
    start:
         LCDOUT $FE,1,"Hello"
         Here: goto Here
    Last edited by mister_e; - 25th March 2005 at 15:49.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  8. #8
    Join Date
    May 2004
    Location
    New England
    Posts
    164


    Did you find this post helpful? Yes | No

    Default

    I just took a peek at the Hitachi 44780 LCD controller data sheet.
    The initialization routine shown in the Crystalfontz part is the same - taken word-for-word from the Hitachi 44780 specs. So PBP should be initializing it properly.

    Arch

Similar Threads

  1. Play with LCD on PICDEM
    By The IceMan in forum mel PIC BASIC
    Replies: 5
    Last Post: - 22nd August 2008, 16:56
  2. PIC16F684 + LCD to use the 256bytes of EEPROM - HELP
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 7th March 2008, 14:19
  3. Need help with LCD number display.
    By Steve Matson in forum mel PIC BASIC
    Replies: 8
    Last Post: - 26th June 2007, 23:07
  4. having problems with Hantronix 20x4 lcd
    By Rhatidbwoy in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 22nd December 2005, 12:22
  5. 4 line LCD with 16F88
    By anj in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 7th February 2004, 09:06

Members who have read this thread : 0

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