LCD problem with 16F877


Closed Thread
Results 1 to 11 of 11
  1. #1
    Join Date
    Jul 2007
    Posts
    4

    Default LCD problem with 16F877

    Hi Guys, first of all sorry about my bas english, i'm from argentina.
    I'm new on PBP programming, i'm having troubles connecting my lcd to pic
    I bought a pic16f877A and a pic16f84A, i connect my lcd usind the default circuit present on pbp manual, now, the circuit works fine using pic16f84 but when a use the 16f877 i see nothing on the display, y add the line CMCON1=7 to convert analog inputs to digital, but do the same thing, in both cases i use a 4mhz xtal, the code i'm using is the example included in pbp.
    any help would be very preciate,Thanks a lot.

    Alex

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


    Did you find this post helpful? Yes | No

    Smile

    Quote Originally Posted by alexx_57 View Post
    y add the line CMCON1=7 to convert analog inputs to digital
    The 877A does not have a register named CMCON1 - try

    ADCON1 = 7

    Post your code - otherwise we just have to guess
    Paul Borgmeier
    Salt Lake City, UT
    USA
    __________________

  3. #3
    Join Date
    Jul 2007
    Posts
    4


    Did you find this post helpful? Yes | No

    Default

    Thamks for the answer,
    this is the code i used

    ' PicBasic program to demonstrate operation of an LCD in 4-bit mode
    '
    ' LCD should be connected as follows:
    ' LCD PIC
    ' DB4 PortA.0
    ' DB5 PortA.1
    ' DB6 PortA.2
    ' DB7 PortA.3
    ' RS PortA.4 (add 4.7K pullup resistor to 5 volts)
    ' E PortB.3
    ' RW Ground
    ' Vdd 5 volts
    ' Vss Ground
    ' Vo 20K potentiometer (or ground)
    ' DB0-3 No connect
    ADCON1=7
    Pause 500 ' Wait for LCD to startup

    loop: Lcdout $fe, 1 ' Clear LCD screen
    Lcdout "Hello" ' Display Hello
    Pause 500 ' Wait .5 second

    Lcdout $fe, 1 ' Clear LCD screen
    Lcdout "World"
    Pause 500 ' Wait .5 second

    Goto loop ' Do it forever

    the lcd is connected in 4bit mode with pullup resistor on porta.4, i'm compile the program with: pbp lcd.bas -p16f877a
    I probed tu pic using blink exammple, ands works fine, the led blinks.

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


    Did you find this post helpful? Yes | No

    Smile

    Everything appears correct (as I am sure you know) - things to try and see

    - Add another Pause 1000 below ADCON1=7 (for now to give everything more time to settle)
    - Add your blink routine at the top to make sure your PIC is alive with this program
    - Is MCLR pulled high?
    - Do you have both VSS pins connected to GND
    - Do you have a decoupler CAP between VDD and VSS?

    Let us know
    Paul Borgmeier
    Salt Lake City, UT
    USA
    __________________

  5. #5
    Join Date
    Jul 2007
    Posts
    4


    Did you find this post helpful? Yes | No

    Default

    Hi paul, thanks for your time, currently I have 4,7k resistor on MCLR pin, both vss are connected to gnd and both vdd to +5v. No decoupler caps, i will make a test with a .1uf ceramic cap.
    I made the circuit over a breadboard, could be that???
    cheers.

    Alex

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


    Did you find this post helpful? Yes | No

    Smile

    Quote Originally Posted by alexx_57 View Post
    Hi paul, thanks for your time, currently I have 4,7k resistor on MCLR pin, both vss are connected to gnd and both vdd to +5v. No decoupler caps, i will make a test with a .1uf ceramic cap.
    I made the circuit over a breadboard, could be that???
    cheers.

    Alex
    I run LCDs connected from breadboards all the time and they always work - try adding 10uF decoupler in addition to your .1uF bypass on both sets of VDD and VSS.

    What brand of LCD? (I know it works for you on the 84A)

    Are you sure this 877A PIC is alive with your current program?
    Paul Borgmeier
    Salt Lake City, UT
    USA
    __________________

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by paul borgmeier View Post
    The 877A does not have a register named CMCON1
    But it does have a CMCON

    Try adding to the top of your program
    Code:
    CMCON = 7
    TRISA = %00000000
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default

    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default

    I re-read post #1 OOPPSS
    I thought you were using the "A". But do try the TRISA part.
    Dave
    Always wear safety glasses while programming.

  10. #10
    Join Date
    Jul 2007
    Posts
    4


    Did you find this post helpful? Yes | No

    Smile

    Hello, it works :-), finally i found the problem, it was lcd backlight, in the morning i made some test, for some reason when i disconnect the lcd backlight the entire screen show up black boxes,i change the contrast resistor and could see characters,...nothing more to say, at this moment is working with backlight, one again sorry about my english and thanks to all!!!

    Alex.

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


    Did you find this post helpful? Yes | No

    Smile

    Glad it works but I am confused ... what is wrong with your English?
    Paul Borgmeier
    Salt Lake City, UT
    USA
    __________________

Similar Threads

  1. LCD problem with 16F628
    By ngeronikolos in forum mel PIC BASIC Pro
    Replies: 25
    Last Post: - 19th September 2016, 08:28
  2. Newbie? Problem with LCD
    By lew247 in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 7th December 2009, 19:48
  3. Play with LCD on PICDEM
    By The IceMan in forum mel PIC BASIC
    Replies: 5
    Last Post: - 22nd August 2008, 16:56
  4. LCD Problem
    By karenhornby in forum General
    Replies: 3
    Last Post: - 19th June 2008, 11:43
  5. problem with 16f877 and display
    By Steve S. in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 15th January 2007, 21:53

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