LCD dsiplay driving me up the wall!


Closed Thread
Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    Mar 2008
    Posts
    3

    Default LCD dsiplay driving me up the wall!

    I am still fairly new to the whole PIC enviorment but not to microcontrollers in general. I have a parallel LCD display 2x16 and am trying to use the LCDOUT commands native to the PIC. I am unsing a PIC 16F687 and no matter what I try the screen stays all solid black boexs. i have checked to make sure the screen is not broken and have tried the screen in other devices I have and it seems to work fine. I have only changed one varible in the definitions at the begining of the program and that is the enable pin (I changed it to PORTB.4) other than that I simply want to display "hello" on the LCD screen. all 8 lines of my code are posted below if anyone has a suggestion as to how I can get some letters to display on my screen please I am open to all suggestions. FYI the screen is a powertip PC1602c screen. Much thanks for any info on this subject. As an add on, I know the LCD display I'm using has an 8 bit bus and the default LCD command uses a 4 bit bus, but I would be perfectly happy using only one line on my display as long as I can use it.

    DEFINE LCD_EREG PORTB 'set LCD enable port
    DEFINE LCD_EBIT 4

    Loop:

    pause 500
    lcdout $FE,2, "hello"
    pause 500

    Goto Loop

    END
    Last edited by agross; - 6th March 2008 at 22:33.

  2. #2
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default

    agross, It looks like you have forgotten a few lines of code, Try this sequence:

    DEFINE LCD_DREG PORTB 'LCD DATA BUS ON PORT B
    DEFINE LCD_DBIT 4 'LCD DATA BUS ON PORTB.4:7
    DEFINE LCD_RSREG PORTB 'R/S REGISTER ON PORT B
    DEFINE LCD_RSBIT 2 'R/S ON PORTB.2
    DEFINE LCD_EREG PORTB 'E-CLOCK ON PORT B
    DEFINE LCD_EBIT 3 'E-CLOCK ON PORTB.3
    DEFINE LCD_BITS 4 'DATA BUS 4 BITS
    DEFINE LCD_LINES 2 'LCD DISPLAY LINES

    Dave Purola,
    N8NTA

  3. #3
    Join Date
    Mar 2008
    Posts
    3


    Did you find this post helpful? Yes | No

    Default Made the additions to my code but still solid blocks on screen

    I added the code you suggested to mine with a few alterations becasue my b register didn't have enough ports so I had to shift a few things around but I still am only seeing solid black boexs. I threw an LED in the circuit to make sure the code was repeating correctly and the light blinked in perfect step. I have the LCD using only the 4 bit bus and I am using the upper 4 bits on the LCD display so A.0-A.3 is connected to D3-D7. R/W is grounded, and Enable is on B.5 while RS is on B.4. I can see the pulses coming off the pin with my O-scope so the chip seems to be working The only thing I can think of now is to add pull down resistors to the buslines, Any other suggestions I might be able to try? Thanks for the help so far, The new code i have is posted below minus the blinking LED.

    DEFINE LCD_DREG PORTA 'LCD DATA BUS ON PORT B
    DEFINE LCD_DBIT 0 'LCD DATA BUS ON PORTB.0:3
    DEFINE LCD_RSREG PORTB 'R/S REGISTER ON PORT B
    DEFINE LCD_RSBIT 4 'R/S ON PORTB.4
    DEFINE LCD_EREG PORTB 'E-CLOCK ON PORT B
    DEFINE LCD_EBIT 5 'E-CLOCK ON PORTB.5
    DEFINE LCD_BITS 4 'DATA BUS 4 BITS
    DEFINE LCD_LINES 2 'LCD DISPLAY LINES

    Loop:

    pause 500
    lcdout $FE,2, "hello"
    pause 500
    Goto Loop
    END

  4. #4
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default

    agross, What actual display are you using? How do you have the contrast pin wired?

    Dave Purola,
    N8NTA

  5. #5
    Join Date
    Mar 2008
    Posts
    3


    Did you find this post helpful? Yes | No

    Default

    I am using a powertip PC1602c LCD, I have the contrast set correctly because I can see the solid squares when I power the PIC and LCD panel up. The contrast pin is set by throing a pot on the bread board and then adjusting the wiper.

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


    Did you find this post helpful? Yes | No

    Default

    Hello agross,
    Install some code to flash an LED just so you know the PIC is working, set your contrast so the squares are barely visable, usually I simply ground that pin, and mine work. Check your breadboards connections, especially the Osc connections.
    try:
    Code:
    FLAGS = 0              ' Forces LCD to initialize
    pause 500              ' Allows the time
    lcdout $FE,1           ' Clears LCD
    lcdout $FE,2, "hello"  ' Returns to beginning of line 1 and writes "string"
    Check this link too . . .http://www.geocities.com/dinceraydin/lcd/commands.htm notice . . link has popup ads, not my link though . . .
    Last edited by Archangel; - 8th March 2008 at 07:18.
    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.

Similar Threads

  1. Is this code not initialising the LCD properly?
    By Platypus in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 30th January 2010, 19:14
  2. 16f688 LCD what have I done wrong
    By spitfiredriver in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 8th August 2009, 19:54
  3. Play with LCD on PICDEM
    By The IceMan in forum mel PIC BASIC
    Replies: 5
    Last Post: - 22nd August 2008, 16:56
  4. Need help with LCD number display.
    By Steve Matson in forum mel PIC BASIC
    Replies: 8
    Last Post: - 26th June 2007, 23:07
  5. LCD will not start
    By btaylor in forum mel PIC BASIC Pro
    Replies: 49
    Last Post: - 24th May 2007, 02:30

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