16f688 LCD what have I done wrong


Closed Thread
Results 1 to 7 of 7
  1. #1

    Default 16f688 LCD what have I done wrong

    Hello
    I am new to using pic's, I have bought a Pickit 1 and have started with a 16f688. I can not get my display to show anything, can some one point out where I am going wrong. R/W is connected to ground.

    TRISC.0 = 0 '(pin 10) Blue Lcd Data bit 4
    TRISC.1 = 0 '(pin 9) White Lcd Data bit 5
    TRISC.2 = 0 '(pin 8) Green Lcd Data bit 6
    TRISC.3 = 0 '(pin 7) Orange Lcd Data bit 7
    TRISC.4 = 0 '(pin 6) Orange/Black Lcd Register select
    TRISC.5 = 0 '(pin 5) Blue/White Lcd Enable bit

    ' PIC Hardware Definitions (ie Pin-Out & Port Assignments)
    ANSEL = 0 ' all pins are digital
    CMCON0 = 7 ' turn off comparators
    ADCON0 = 0
    ADCON1 = 0

    'pin name connection
    '1 VDD 5V
    '2 OSC1 Crystal
    '3 OSC2 Crystal
    '4 MCLR Pulled up
    '5 RC5 E LCD
    '6 RC4 RS LCD
    '7 RC3 DB7
    '8 RC2 DB6
    '9 RC1 DB5
    '10 RC0 DB4
    '11 RA2 NC
    '12 RA1 NC
    '13 RA0 NC
    '14 VSS Ov

    'Define LCD registers and bits
    DEFINE LCD_DREG PORTC 'Define PIC port used for LCD Data lines
    DEFINE LCD_DBIT 0 'LCD Data Starting Bit = Bit 0 or 4
    DEFINE LCD_EREG PORTC 'Define PIC port used for E line of LCD
    DEFINE LCD_EBIT 5 'Define Port pin used for E connection
    DEFINE LCD_RSREG PORTC 'Define PIC port used for RS line of LCD
    DEFINE LCD_RSBIT 4 'Define Port pin used for RS connection
    DEFINE LCD_BITS 4 'Define the 4 bit communication mode to LCD
    DEFINE LCD_LINES 2 'Define using a 2 line LCD
    DEFINE LCD_COMMANDUS 2000 'Define delay time between sending LCD commands
    DEFINE LCD_DATAUS 50 'Define delay time between data sent.



    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

  2. #2


    Did you find this post helpful? Yes | No

    Default

    Can you see anything on the LCD? Like a cursor? If not, check the data sheet for the LCD. Some LCDs need a negative voltage for contrast.
    Tim Barr

  3. #3
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Hello Spitfiredriver,
    Welcome to the forum !
    To start with, I know nothing about PICKit1, so bear with me. I looked into your code, and using a breadboard the code looks good . . .but you forgot to DEFINE OSC x where x is the frequency you chose probably 4 if you are using default config. You will find the Default config listed in the 16f88.inc file which is in the root directory of your PBP installation, I just checked mine and it defaults to INTOSC which does not agree with your use of a crystal, so either change it there, comment it out there, and put it in YOUR source code ( I always do it that way), or plan on using internal OSC.
    Last edited by Archangel; - 7th August 2009 at 20:47.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  4. #4


    Did you find this post helpful? Yes | No

    Default removed crystal

    I have removed the crystal but still get nothing on the display, I have not got a datasheet for the LCD just the pinout, hope to be sent the pdf tomorrow. As it has a HD44780 compatible controller and a standard pinout I hoped it would be a positive V0 for contrast but that might be the problem. The only markings on the display are the pinout and (ELECTROLITE QY-162A)

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


    Did you find this post helpful? Yes | No

    Default

    Like Tim asked, can you see anything on the display? You may want to look at the PBP manual to see how to use a pot with the contrast pin.

    And I will ask. Can you make an LED blink at the correct rate? Maybe the PIC is not even running?

    If the PIC is running at the correct speed and you can change the contrast it could be in the commandus or dataus settings.
    Dave
    Always wear safety glasses while programming.

  6. #6
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by spitfiredriver View Post
    As it has a HD44780 compatible controller and a standard pinout I hoped it would be a positive V0 for contrast but that might be the problem. The only markings on the display are the pinout and (ELECTROLITE QY-162A)
    Most HD44780 LCD units, pin 3 contrast is at or very near ground, I usually just ground pins 1,3,5
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  7. #7


    Did you find this post helpful? Yes | No

    Default

    Thanks for the help
    I have solved it, I could not see anything on the display, I knew the program was running as I put an extra led that flashed on each loop.
    My mistake was that the display pdf that I was working to, said to wire the back light on pins A and K with a 10 ohm resister. This was wrong, I needed to use pins 15 and 16, there are extra resistors in the circuit. The back light was just too bright. Works fine now.
    once again thanks for the advice.

Similar Threads

  1. DS1820 with 16f688
    By jessey in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 23rd May 2009, 06:07
  2. LCD Showes Some Wrong Letters
    By sbobowski in forum General
    Replies: 2
    Last Post: - 23rd September 2008, 20:15
  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. Help with 16f688
    By jessey in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 21st October 2006, 00:12

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