LCD Problem


Closed Thread
Results 1 to 7 of 7

Thread: LCD Problem

  1. #1
    Join Date
    Jun 2013
    Posts
    31

    Default LCD Problem

    This is my first post here

    I am very new to microcontroller,I had bought the PBP3 with LAB-X1,I try to test the LCD program from melabs with 16f887(Comes with the bundle),I assume the program have no problem,so why the LCD screen on the first line all are solid block,and empty on the second line,what have I done wrong?it happen to the LAB-X1 LCD and a external LCD.


    The Program
    http://melabs.com/samples/PBP-mixed/lcd.htm

  2. #2
    Join Date
    Dec 2012
    Location
    Tennessee
    Posts
    262


    Did you find this post helpful? Yes | No

    Default Re: LCD Problem

    You might want to go ahead and add DEFINE's at the beggining of your program, and the first PAUSE 500, change to Pause 1000
    Make sure the correct LCD pins are going to the correct PIC pins, some LCDs pinouts are different even if they have 14 or 16 pins.
    What did you use to set your occilator value, if your not using a internal OSC you might need to DEFINE OSC. You will probobly want to use a TRIS command to define the I/O of your pins too, this causes alot of problems when left out.

    What I find is that if the LCD is a 2 line display, and the top is full and bottom empty, the LCD is not initialized, on a 4 line its the top 2.
    it will usually do this for about a second when first turned on then will clear and then show data when its working right.

    Look in the manual and read up on DEFINE, LCDOUT you can also access a free ebook on GoogleBooks, search for "30 pic projects" on the google books site, its great for learning PBP.

    Here is a program I wrote for 18F 40Pin devices and only using PORT D for "Display", You can also tie a LED (Long Leg) directly to PORTD Pin 6 and the Short Leg to GND the led will be very bright, you can add a resistor if you want.

    Code:
    DEFINE LCD_DREG PORTD   ' LCD Data bits on PORTD
    DEFINE LCD_DBIT 0       ' PORTD starting address
    DEFINE LCD_RSREG PORTD  ' LCD RS bit on PORTD
    DEFINE LCD_RSBIT 5      ' LCD RS bit address
    DEFINE LCD_EREG PORTD   ' LCD E bit on PORTD
    DEFINE LCD_EBIT 4       ' LCD E bit address
    DEFINE LCD_BITS 4       ' LCD in 4-bit mode
    DEFINE LCD_LINES 4      ' LCD has 4 rows
    
    TRISD = 0			' PORTD is output
    
    PAUSE 1000			' Wait 1 sec for LCD to initialize
    LCDOUT $FE, 1			' Clear LCD
    
    AGAIN:
    LCDOUT $FE, 2
    LCDOUT $FE, $80
    LCDOUT "I Am ---"
    Pause 500
    LCDOUT $FE, $80
    LCDOUT "WORKING!"
    PAUSE 500			' Wait .5 seconds
    TOGGLE PORTD.6			' Blink LED to show Program Running
    GOTO AGAIN 			' Repeat
    END
    Last edited by wdmagic; - 20th June 2013 at 22:01.
    Chris


    Any man who has accomplished anything in electronics at one time or another has said... " STOP! WAIT! NOOO! Dangit.... Oh Well, Time to start over..."

  3. #3
    Join Date
    Dec 2010
    Posts
    409


    Did you find this post helpful? Yes | No

    Default Re: LCD Problem

    Getting LCD displays going the first time can often be difficult. If you are using an example program and a development board where you don't need to set any jumpers, then the main code and board are likely O.K. The most likely issue is that you don't have the PIC clock configured properly. LCD displays are quite sensitive to timing. You should actually start off by trying to blink a single LED - in fact if your development board has several, you could try blinking LEDs on a whole port to make sure you don't accidentally choose a special function pin. In any case, blink to start and verify that the length of the blinks actually match the time you put in your code, which proves you have the clock set up right and that you've told PBP correctly what it's set to.

  4. #4
    Join Date
    Jun 2013
    Posts
    31


    Did you find this post helpful? Yes | No

    Default Re: LCD Problem

    I had tried the blinking led and the running led,it works fine,I have tried to see if there any signal being pass to the LCD on a oscilloscope ,seems that there are no signal being sent,the scope show a straight line,not a single pulse

  5. #5
    Join Date
    Dec 2010
    Posts
    409


    Did you find this post helpful? Yes | No

    Default Re: LCD Problem

    Time to post your code then...

  6. #6
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default Re: LCD Problem

    Since you are using a LAB-X1, it'll be best to start with the LAB-X1 samples.

    For the LCD - http://melabs.com/samples/LABX1-16F887/lcdx.htm
    More LAB-X1 samples for the 887 - http://melabs.com/samples/LABX1-16F887/index.htm
    DT

  7. #7
    Join Date
    Jun 2013
    Posts
    31


    Did you find this post helpful? Yes | No

    Default Re: LCD Problem

    Thank You for the reply and help,I am out station now for two weeks,will try it out when I am back hoe,thank you very much for thw assistance

Similar Threads

  1. LCD Problem!
    By uaf5000 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 19th May 2010, 23:06
  2. LCD problem
    By Andre_Pretorius in forum General
    Replies: 8
    Last Post: - 27th January 2009, 15:47
  3. problem with 2*16 lcd
    By ibra in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 29th April 2007, 15:21
  4. problem with LCD
    By Rhatidbwoy in forum General
    Replies: 9
    Last Post: - 13th October 2005, 23:01
  5. LCD problem
    By leonel in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 1st August 2005, 18:52

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