LCD Display not working - PIC heating...


Closed Thread
Results 1 to 33 of 33

Hybrid View

  1. #1
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    938

    Default LCD Display not working - PIC heating...

    Hi there,

    I'm using a 16F88 and try to get an 2x16 LCD display working.

    I found some examples on how to connect the display to the PIC but when I switch on the programmer (AN589), the display switches on all 1st lines character's pixels (see attachment); nothing else happens. Worse, the PIC is heating (maybe up to 50°C). The circuit is powered by the programmer.

    I don't think that this has something to do with the PIC since I erased it and the same phenomenon happened again.

    According to the documentation I could find, I connected:
    Code:
    PIC ports Symbol           LCD pin
    PORTA.0	  DB4	           11
    PORTA.1	  DB5	           12
    PORTA.2	  DB6	           13
    PORTA.3	  DB7	           14
    PORTA.4	  RS	            4
    PORTB.3	  E	            6
    -	  Vss - GND	    1
    -	  Vdd / Vcc +5V	    2
    -	  Vee / Contrast    3
    -	  R/W	            5
    I double checked my wiring (used different colours) and don't see what's wrong. Appart the 10k pull-up on MCLR, there are no other components (display DIRECTLY connected to PIC).

    The code is here:
    Code:
    'LCDOUT PBP command
    'It assumes the LCD will be used with a 4-bit bus with
    ' data lines DB4 - DB7 connected to PICmicro PORTA.0 - PORTA.3,
    ' Register Select to PORTA.4 and Enable to PORTB.3.
    ' It is also preset to initialize the LCD to a 2 line display.
    
    OSCCON = %01100000                   'Internal RC set to 4MHZ
    
    Pause 1000                           'Wait for display to initialise
    
    Main:
        lcdout $FE, 1                    'Clear LCD
        lcdout $FE, 2                    'Position cursor at home
        lcdout "Hello World"             'Send "Hello World" to LCD on line 1
        lcdout $FE, $C0                  'Position cursor second line
        lcdout "Second line"             'Send "Second line" to LCD on line 2
        pause 1000                       'Pause 1 second to see it
        goto Main
    end
    What am I doing wrong?
    Attached Images Attached Images  
    Roger

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Do a search on the comparator, you'll see what I mean.
    JDG

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


    Did you find this post helpful? Yes | No

    Default Datasheet

    Quote Originally Posted by skimask
    Do a search on the comparator, you'll see what I mean.
    JDG
    Datasheets are a wonderful place to get lost, I looked at it and knowing what to do it didn't make sense.
    flotulopex,

    ADCON1 = 7 ' turns off adc
    CMCON = 7 'turns off comparators
    Last edited by Archangel; - 11th September 2006 at 23:56.

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


    Did you find this post helpful? Yes | No

    Smile

    Hi Flotulopex,

    Where are your DEFINES for the LCD?

    Your program should start like this:
    OSCCON = %01100000 'Internal RC set to 4MHZ

    DEFINE LCD_DREG PortA
    DEFINE LCD_DBIT 0
    DEFINE LCD_RSREG PORTA
    DEFINE LCD_RSBIT 4
    DEFINE LCD_EREG PORTB
    DEFINE LCD_EBIT 4
    DEFINE LCD_BITS 4
    DEFINE LCD_LINES 2

    TRISA = %00000000 'make Port A outputs
    TRISB = %00000000 'make Port B outptuts

    ADCON1 = 7 ' turns off adc
    CMCON = 7 'turns off comparators

    Pause 1000 'Wait for display to initialise

    Main:
    lcdout $FE, 1 'Clear LCD
    lcdout $FE, 2 'Position cursor at home
    lcdout "Hello World" 'Send "Hello World" to LCD on line 1
    lcdout $FE, $C0 'Position cursor second line
    lcdout "Second line" 'Send "Second line" to LCD on line 2
    pause 1000 'Pause 1 second to see it
    goto Main
    end


    The next problem I believe you have is you don't power your circuit from the programmer power. I'm assuming you are using ICSP programming. You should power the circuit from its own separate power supply. Do you have capacitors on the power supply lines? 10uF and .1uF on the 5 volt side of the voltage regulator going to the PIC. Make sure you have a .1uF across the PICs power leads as close as possible. Have a 100uF or 10uF and a .1uf across the input side of the voltage regulator also.

    If you don't have a copy of the PBP manual then download one! There is a real nice example of how LCDOUT is suppose to be connected and programmed. Also the contrast pin of the LCD display is suppose to be connected to the wiper or center pin of a 5K potentiometer with one of the two remaining pins connected to +5vdc and the other side to ground. After you have all of this setup, if you are still getting blocks on the screen, then adjust the pot until the blocks are just barely seen. Then try your program.

    This should help you get going!

    BobK

  5. #5
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    938


    Did you find this post helpful? Yes | No

    Default

    Thank you All.

    I'll try to turn off ADCs and COMPARATORs as soon as I'm back home.

    Yes, I compared the PBP manual with other documents I have found on the net. The difference I see with the PBP manual's shematic and others is the pull-up resistor on RA4. I'll try this too.

    Yes, I'm using ICSP. Is it a problem to use the programmer's power source? It has 1A source and is very stable. I have installed a 3 pole switch to interrupt the MCLR, DATA and CLOCK lines once the PIC is programmed and I just keep Vdd and Vss.

    I'm using the MICROCHIP AN589 programmer and there are capacitors in this circuit. I will add a 0.1µF close to the PIC.

    About the defines, as far as I understood the PBP help file (in MicroCode Studio), I'm using the default settings so I thought the defines were not mandatory (am I wrong?).
    Roger

  6. #6
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    938


    Did you find this post helpful? Yes | No

    Default

    Well,

    I did all what you suggested and unfortunately it didn't work.

    The last thing may be... the display itself?

    I have three displays doing the same thing when connected to the PIC. The first is an ELECTROFONT 98301 (MK620NY-LY) and the second (I have 2 of them) is a VL 16265SS3 R2. I couldn't find their data sheets so I can only assume they are like almost all other displays "Hitachi 44780" compatible.

    These displays come from HP servers made around 2000.

    When adjusting the contrast, the display flickers a little.

    During the programming, the display stays always on.

    I even changed the PIC and still the same happens.

    I then tried to remove one-by-one the wires from the display hoping for a change. Unfortunately, until Vcc and GND are removed, the display stays like the picture I sent in a previous post.

    One more thing I just tested -which can sound really stupid- WITHOUT the PIC. Guess what, still the same.

    Any other idea?
    Last edited by flotulopex; - 12th September 2006 at 17:16.
    Roger

  7. #7
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by flotulopex
    According to the documentation I could find, I connected:
    Code:
    PIC ports Symbol           LCD pin
    PORTA.0	  DB4	           11
    PORTA.1	  DB5	           12
    PORTA.2	  DB6	           13
    PORTA.3	  DB7	           14
    PORTA.4	  RS	            4
    PORTB.3	  E	            6
    -	  Vss - GND	    1
    -	  Vdd / Vcc +5V	    2
    -	  Vee / Contrast    3
    -	  R/W	            5
    Pin 5 of the LCD display is READ/_WRITE which should be tied LOW for WRITING to the display. If this pin is floating then the LCD could well be in read mode hence why you cant initialise it or write to it.

    In addition to that, if it is in READ mode the databus to the PIC will have two active drivers on it, the one in the PIC and the one in the LCD.

    This could be why the PIC is getting cooked.

    Regards

    Keith
    Keith

    www.diyha.co.uk
    www.kat5.tv

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


    Did you find this post helpful? Yes | No

    Smile

    Hi again Flotul,

    "I highly appreciate your help and I won't make you waste your time anymore until I am sure about the display I use. I cannot believe it still doesn't work after all your suggestions."

    You are not wasting my time. I have been a troubleshooter for a long time and I enjoy challenges. That's why I'm here. AND I also learn from what we are doing here. I can't believe it's not working either so we should go back to square one.

    Do you even know if you are able to get a program into the PIC and that the PIC is even working?

    Disconnect the LCD completely and put a simple Switch/LED program into the PIC and see if it works. First put a program into one of the PORTA pins and if that works now you know your programmer is working and you can get PORTA to respond to activity. Then re-wire the PIC to get it to work with PORTB.

    Example:
    Hardware setup:
    Put a 10K pullup between PortA.0 and +5vdc
    Put a 10K pullup between PortB.0 and +5vdc
    Put a normally open switch between ground and PortA.0
    Put an LED between PortA.1 and a 470 ohm resistor to ground (remember
    the LED is polarity sensitive so plus side to PortA.1)
    Make sure you have a 4.7K or 1K resistor between MCLR and +5vdc

    Software setup:
    TRISA = %00000001 'All pins on PortA are outputs except PortA.0
    PortA = 0
    TRISB = %00000001 'All pins on PortB are outputs except PortB.0
    PortB = 0

    SwitchA var PortA.0
    LEDA var PortA.1
    SwitchB var PortB.0
    LEDB var PortB.1

    Start:
    If SwitchA = 0 then LEDA = 1
    LEDA = 0
    Pause 1000

    If SwitchB = 0 then LEDB = 1
    LEDB = 0
    Pause 1000
    goto Start

    This little program will cause the LEDA to lightup only if SwitchA is pressed.

    If this works then disconnect the switch wire from PortA.0 and put it on PortB.0, then disconnect the LED/Resistor from PortA.1 and put it on PortB.1.
    Retest the program.

    If this little test setup doesn't work on either port then perhaps your problem is in your programmer. You'll have to check it out then.

    I use commercially produced programmers, MELabs USB programmer and their EPIC parallel port programmeralong with their software and Microcode Studio IDE. There's nothing wrong with making your own but by buying a commercial product you get their support.

    Perhaps you could post the code you were using so we can see if there's a problem there also.

    I was looking back at my collection of notes from this site and found other people that have gone through the same problem. That's why I think we need to go back to square one and start troubleshooting the basics. Let me know!

    HTH,

    BobK

    I just got to thinking about something Mister E has brought up alot. If you are using a breadboard where you just plug things into the little holes then you could possibly have a problem with the crystal and its capacitors. Sometimes the contacts on the breadboard put too much of a load on the crystal so try removing the capacitors. Thanks Mister E!!
    Last edited by BobK; - 14th September 2006 at 11:45.

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


    Did you find this post helpful? Yes | No

    Default

    The crystal stuff is true for high value on some breadboard and on some circumstances. Wires must be keep short between crystal and PIC. Crystal pins must be as short as possible, capacitor too. On breadboard i usually use ceramic resonnator with built-in caps. In this case Flotulopex use the internal OSC so it's not the main cause.

    If the PIC heat.. it's probably because he's burn, died, Kaput. I would try to remove all extra hardware attach to, check the Vd/Vss wiring (maybe it's reverted) and see if it's still heat. If not, do a led blink on all i/o to be sure every i/o are still working.

    Maybe the config fuses are bad, maybe the LCD need special timing/start up delay. LCD_COMMANDUS, LCD_DATAUS could help.

    When you do ICSP, PGM pin should be pulled low to prevent interference caused by the high voltage on MCLR pin. Place a 1-10K resistor between this pin and GND. Also, have a look bellow
    http://www.melabs.com/support/icsp.htm

    Once you have program your PIC, you MUST remove at least, the MCLR/Vpp wire from your board as the programmer hold the pin to GND at the end of the process. a While back i did a ICSP switch box like...
    <img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=163&d=1104851398">

    It's pretty handy!

    Be sure the Low Voltage Programming mode is disable in your config fuses. Try
    Code:
        '
        '    Pic Configuration
        '    =================
        '    Program Configuration Register 1
        @	__CONFIG    _CONFIG1, _CP_OFF & _CCP1_RB0 & _DEBUG_OFF & _WRT_PROTECT_OFF & _CPD_OFF & _LVP_OFF & _BODEN_ON & _MCLR_ON & _PWRTE_ON & _WDT_ON & _INTRC_IO		    		 
    
        '    Program Configuration Register 2
        @   __CONFIG    _CONFIG2, _IESO_OFF & _FCMEN_OFF
    Also allow the internal OSC to settle (stabilise). Give a 50mSec (or more) delay at the top may help.
    Last edited by mister_e; - 14th September 2006 at 14:52.
    Steve

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

  10. #10
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    938


    Did you find this post helpful? Yes | No

    Default

    Hi BobK,

    I have the same kind of approach as you have. When nothing works = restart from scratch step by step.

    Now, to your suggestions, here are my answers:
    - Yes, I can easely program all my PICs without any trouble. That's the reason why I built different programmers before I really started programming.

    - Yes, I have checked my PICs ( I have 16F84A, 16F88 and 12F675 - actually I'm working with the 16F88) almost as you suggest and everything is fine; the PICs are all okay.

    - My code is is the 1st post of this thread and I corrected it according to your informations (DEFINES).

    - Mister_e is right; the breadboard my be a source of contact problems and this is why I have made test on my second breadboard too (the BasicStamp Pro Developpement Board).

    - Yes, I disconnect MCLR, DATA and CLOCK wires after programming the PIC (see a previous post).

    - I use the internal oscillator on pic 16F88 (no external crystal or resonator).

    - The fuses look to be set correctly; LPV is disabled.

    - In my code, I have made a 1 second pause to let the PIC and the LCD stabilise (may not be mandatory but I thought it would be better so).

    Mister_e, your schematic is great. Is your "Program/Run" switch automated (kind of monitoring the signal on MCLR)?

    I'm still in the office now and should have a new display waiting for me in my mailbox. I'll give you an update asap. Please wait until I have connected my knew display... I'm confused to see you working on lots of possibilities and me not able to provide reliable informations.
    Roger

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


    Did you find this post helpful? Yes | No

    Default

    Mister_e, your schematic is great. Is your "Program/Run" switch automated (kind of monitoring the signal on MCLR)?
    Hehe funny that you talk about that. Few days ago, i did an automated version to do the switching with a VB application. When the focus is set to the device programer software, the ICSP interface switch to the Program mode, when i close or return to the code editor it goes to the Run Mode. it's on testing.. pretty good as now
    Steve

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

  12. #12
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    938


    Did you find this post helpful? Yes | No

    Default

    Finally

    !!! IT WORKS !!!

    I got my new display and connected it to my 16F88. Nothing :-(

    I changed to my 16F84A and now it is okay.

    I will try again with the 16F88 but I will use other ports than ports A.

    I'll come back asap.
    Roger

Similar Threads

  1. Simple LCD code not working!...WHY?
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 29th November 2009, 19:48
  2. Replies: 2
    Last Post: - 5th November 2009, 17:07
  3. PIC16f690 LCD Not Working
    By hhosteam in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 3rd June 2009, 06:26
  4. Replies: 3
    Last Post: - 27th November 2007, 08:56
  5. A/D display result on LCD
    By winsthon in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 10th January 2004, 10:09

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