PIC 16f877A LCD problem!


Closed Thread
Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    May 2010
    Posts
    19

    Default PIC 16f877A LCD problem!

    Hello Guys,

    I have interfaced LCD with my PIC 16f877a. I want to initially display words on my lcd but the problem is only garbage value is being displayed. Please tell me the solution. I have given the code which i used to program the MCU.


    Regards.

    CLEAR
    DEFINE OSC 4
    DEFINE LCD_DREG PORTD
    DEFINE LCD_RSREG PORTE
    DEFINE LCD_RSBIT 0
    DEFINE LCD_EREG PORTE
    DEFINE LCD_EBIT 1
    DEFINE LCD_RWREG PORTE
    DEFINE LCD_RWBIT 2
    DEFINE LCD_BITS 8
    DEFINE LCD_LINES 1
    DEFINE LCD_COMMANDUS 2000
    DEFINE LCD_DATAUS 50
    PAUSE 500
    LOW PORTE.2
    TRISD = %00000000
    TRISE = %00000000
    ADCON1=%00000111
    LOOP:
    LCDOUT $FE, 1
    PAUSE 250
    LCDOUT "HELLO"
    LCDOUT $FE,$C0
    LCDOUT "WORLD"
    PAUSE 250
    GOTO LOOP
    END

  2. #2
    Join Date
    Sep 2004
    Location
    Mentor, Ohio
    Posts
    352

    Smile

    Hello uaf5000,

    Well at first glance you are missing the line "DEFINE LCD DBIT 0". You also have a line that says you are only using 1 line when the statement "LCDOUT $FE,$C0" is the command to display the following on the second line of the LCD. Make these changes and see how it goes.
    Your code can also read--"LCDOUT $FE,1,"Hello"
    "LCDOUT $FE,$C0,"World"

    I think this also may have been messing things up for you.

    HTH,

    BobK
    Last edited by BobK; - 19th May 2010 at 22:39. Reason: After thought.

  3. #3
    Join Date
    May 2010
    Posts
    19

    Default

    Still same garbage values =(. I made the changes you told. But in those garbage values letter 'D' is appearing which wasn't before. What shall i do now? =(

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924

    Default

    PORTE is analog on this chip, so you will need to turn that off.
    http://www.picbasic.co.uk/forum/showthread.php?t=561
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924

    Default

    Dave
    Always wear safety glasses while programming.

  6. #6
    Join Date
    May 2010
    Posts
    19

    Default

    I've used the command ADCON1=%00000111. Didnt this command make port E digital?

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