PIC16f690 LCD Not Working


Closed Thread
Results 1 to 20 of 20
  1. #1
    Join Date
    May 2009
    Posts
    6

    Default PIC16f690 LCD Not Working

    Hello all,
    I'm new to Pic Programming and need some help!
    I would like to learn how to display text on a HD44780.

    at this time I'm using a PIC16f690 using the Conections listed below:

    D4 - PortA.0
    D5 - PortA.1
    D6 - PortA.2
    D7 - PortA.3
    RS Pin4 - PortA.4 ( 10K pull up) also tried it with out pull up and get the same thing

    Enable Pin6 - PortB.6
    VO Pin3 - 10k pot
    R/W Pin5 Connected to Ground

    After start up I just get Black Blocks on line 2.
    I got this code from the Book "Picbasic Projects 30 Projects using Pic Basic"
    The only thing that I changed was the Define for Enable. I had to change it to use Portb.6 because the Pic16f690 does not have a pin b.3.

    Please help
    Here is the Code:

    DEFINE LCD_DREG PORTA 'SET THE DATA PORT

    DEFINE LCD_DBIT 4 'Set starting Data bit (0 or 4) if 4-bit bus
    DEFINE LCD_RSREG PORTA ' Set LCD Register Select port
    DEFINE LCD_RSBIT 4 ' Set LCD Register Select bit
    DEFINE LCD_EREG PORTB ' Set LCD Enable port
    DEFINE LCD_EBIT 6 ' Set LCD Enable bit
    DEFINE LCD_BITS 4 ' Set LCD bus size (4 or 8 bits)
    DEFINE LCD_LINES 2 ' Set number of lines on LCD

    Cnt VAR Word
    'CMCON = 7 'THIS DOES NOT WORK WITH THE PIC 16F690
    TRISA = 0
    TRISB = 0
    PAUSE 500
    Cnt = 0
    LCDOUT $FE,1

    RPT:
    LCDOUT $FE,2
    LCDOUT "CNT=",DEC CNT
    PAUSE 1000
    Cnt = Cnt +1
    GOTO RPT
    END

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    1. PortA Doesn't Work http://www.picbasic.co.uk/forum/showthread.php?t=561
    2. Look in your datasheet for ANSEL and ANSELH registers.
    3. All Digital http://www.picbasic.co.uk/forum/showthread.php?t=11100

    'CMCON = 7 'THIS DOES NOT WORK WITH THE PIC 16F690
    Sure, this PIC don't have CMCON register, check the datasheet under Voltage Comparator section.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    May 2009
    Posts
    6


    Did you find this post helpful? Yes | No

    Default

    Thanks for the fast reply!
    Again I’m new at this so please be patient with me on this.
    I changed the code that the data lines use PortC instead of Port A.
    I also added the following to change the pins to all digital
    POKE ANSEL,0
    poke ANSELH,0
    is this the correct usage?

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Yes it is correct, but if you're using PBP you don't really need to use Peek/Poke.

    ANSEL = 0
    ANSELH = 0

    The above will do the job.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

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


    Did you find this post helpful? Yes | No

    Default

    These should do for 16f690
    Code:
    ANSEL = 0
    ANSELH = 0
    CM1CON0 = 0
    CM2CON0 = 0
    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.

  6. #6
    Join Date
    May 2009
    Posts
    6


    Did you find this post helpful? Yes | No

    Default

    Ok, I made the changes and I'm still having the same problem.
    I attached the schematic and the code is listed below:
    [CODE]
    DEFINE LCD_DREG PORTC 'Set port C for the data lines
    DEFINE LCD_DBIT 4

    DEFINE LCD_RSREG PORTB 'Set the RS Port and Pin
    DEFINE LCD_RSBIT 5

    DEFINE LCD_EREG PORTB 'Set LCD Enable bit and pin
    DEFINE LCD_EBIT 6

    DEFINE LCD_BITS 4
    ' Set number of lines on LCD
    DEFINE LCD_LINES 2
    ' Set command delay time in us
    DEFINE LCD_COMMANDUS 2000
    ' Set data delay time in us
    DEFINE LCD_DATAUS 50

    ANSEL = 0
    ANSELH = 0
    CM1CON0 = 0
    CM2CON0 = 0

    Cnt VAR WORD

    'Start Program
    poke TRISC,0
    poke TRISB,0

    Pause 500

    cnt=0
    RPT:
    HIGH PORTB.6
    LCDOUT $FE,1 'CLEAR LCD SCREEN
    LCDOUT "CNT=", DEC CNT
    Pause 1000
    CNT=CNT+1
    GOTO RPT
    END
    [CODE/]
    Attached Images Attached Images  

  7. #7
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Code:
    DEFINE LCD_DREG PORTC 'Set port C for the data lines
    DEFINE LCD_DBIT 0
    And you should try to use a pot on the contrast pin. As it is right now, and depending of your LCD module, you may have only black boxes instead of characters.
    Last edited by mister_e; - 6th May 2009 at 15:45.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  8. #8
    Join Date
    May 2009
    Posts
    6


    Did you find this post helpful? Yes | No

    Default

    I did have a 10k pot on the contrast pin, I just wanted to remove it while I was testing it out. I will try again when I get home.
    Thanks again,

  9. #9
    Join Date
    May 2009
    Posts
    6


    Did you find this post helpful? Yes | No

    Default

    Still have the same problem, any other ideas?

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


    Did you find this post helpful? Yes | No

    Default

    Are you using this chip on a solderless breadboard or are you using the Low Pin Count Demo Board from Microchip ?
    this is you code with only minor tweeks and it works on a solderless breadboard. try grounding the contrast pin #3 on the lcd. This is compiled using MPASM as it is what I always use.
    Code:
    @ __config _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_OFF &_CP_OFF
    define OSC 4
    DEFINE LCD_DREG PORTC 'Set port C for the data lines
    DEFINE LCD_DBIT 4
    
    DEFINE LCD_RSREG PORTB 'Set the RS Port and Pin
    DEFINE LCD_RSBIT 5
    
    DEFINE LCD_EREG PORTB 'Set LCD Enable bit and pin
    DEFINE LCD_EBIT 6
    
    DEFINE LCD_BITS 4
    ' Set number of lines on LCD
    DEFINE LCD_LINES 2
    ' Set command delay time in us
    DEFINE LCD_COMMANDUS 2000
    ' Set data delay time in us
    DEFINE LCD_DATAUS 50
    
    ANSEL = 0
    ANSELH = 0
    CM1CON0 = 0
    CM2CON0 = 0
    
    Cnt VAR WORD
    
    'Start Program
    TRISC = 0
    TRISB = 0
    
    Pause 500
    
    cnt=0
    RPT:
    HIGH PORTB.6
    LCDOUT $FE,1 'CLEAR LCD SCREEN
    pause 500
    LCDOUT $FE,2,"CNT=", DEC CNT
    Pause 1000
    CNT=CNT+1
    GOTO RPT
    END
    Last edited by Archangel; - 8th May 2009 at 07:26.
    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.

  11. #11
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891


    Did you find this post helpful? Yes | No

    Default same problem for me...

    I applied Joe's code and still can't bring my display to work with this chip (I tried with three).

    Never had problems with other chips.

    Don't know what's wrong :-/
    Roger

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by flotulopex View Post
    I applied Joe's code and still can't bring my display to work with this chip (I tried with three).

    Never had problems with other chips.

    Don't know what's wrong :-/
    What are you getting Roger ? Blocks , anything ?
    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.

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


    Did you find this post helpful? Yes | No

    Default

    Checked it again, and it's fine. here is the hex:
    Attached Files Attached Files
    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.

  14. #14
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891


    Did you find this post helpful? Yes | No

    Default

    Sorry, I'm wrong, it worked for me too.. in the past, also with 16F690.

    I may have a problem with my breadboards. Gonna buy a new one today.

    Nevertheless, what I see on my LCD display is on it's first line, a row of blocks, slightly visible.

    Of course, I tried to change the contrast, but nothing helps.
    Roger

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by flotulopex View Post
    Sorry, I'm wrong, it worked for me too.. in the past, also with 16F690.

    I may have a problem with my breadboards. Gonna buy a new one today.

    Nevertheless, what I see on my LCD display is on it's first line, a row of blocks, slightly visible.

    Of course, I tried to change the contrast, but nothing helps.
    I never use a contrast pot, I ground pins 1,3,5,16, put power on 2,15 always works for me. Those breadboards get nasty inside, corrosion after the plating wears a bit, the component pins wear the contacts quickly too.
    Last edited by Archangel; - 28th May 2009 at 08:04.
    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.

  16. #16
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891


    Did you find this post helpful? Yes | No

    Default

    No pot on my side too.

    I use a 1k2 to 2k2 resitor instead.

    Must be the breadboards...
    Roger

  17. #17
    Join Date
    May 2009
    Posts
    6


    Did you find this post helpful? Yes | No

    Default

    Still not working!
    Just get a row of black blocks.

    any one else able to get this working yet?

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by hhosteam View Post
    Still not working!
    Just get a row of black blocks.

    any one else able to get this working yet?
    Just a row of blocks indicates either contrast is too far + or no pic signal. Not meaning to offend or agitate, but you did look at the pic pinout in the data sheet, yes? I ask because this PIC has a somewhat convoluted pin arrangement and it is easy to wire it incorrectly. Is your programmer up to this chips needs? Most PICs like 16F84, 16F628 . .. have power in the center of the device but this has them swapped side for side and at 1 end, your programmer might not know this. I programmed mine using PICKitII and low parts count demo board made for 16F690. You might have to set up for ICSP to properly program it.
    Last edited by Archangel; - 29th May 2009 at 05:49.
    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.

  19. #19
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891


    Did you find this post helpful? Yes | No

    Default ...

    I just found what was bothering me: wrong oscillator fuse setting.

    Couldn't see this for hours.....
    Roger

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by flotulopex View Post
    I just found what was bothering me: wrong oscillator fuse setting.

    Couldn't see this for hours.....
    It seems the more simple the problem is, the better it's ability to hide.
    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. 2x16 lcd not working with pic16f72
    By vu2iia in forum Schematics
    Replies: 4
    Last Post: - 16th February 2011, 14:59
  2. My LCD code is not working...
    By kvrajasekar in forum mel PIC BASIC
    Replies: 2
    Last Post: - 7th December 2008, 05:41
  3. Migrating from PIC16F690 to PIC18F4525 and having LCD issues
    By jblackann in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 6th June 2008, 20:05
  4. Simple LCD code not working..
    By davewanna in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 28th April 2008, 13:55
  5. SOUND makes LCD quit working
    By jderson in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 18th April 2008, 14:12

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