LCD will not start


Closed Thread
Results 1 to 40 of 50

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by JohnPaul View Post
    Code:
    ' HD44780 LCD MODULE
    ' Pin 1: VSS 0V(Ground)
    ' Pin 2: VDD Power Supply for logic
    ' Pin 3: V0 Power Supply for LCD Driver (5k Potentiometer for Contrast)
    ' Pin 4: RS Data / Instruction register select (10k Resistor)
    ' Pin 5: R/W Read/Write select
    ' Pin 6: E Read/Write enable strobe
    ' Pin 11-14: DB0-7 Data bus (LSB)
    ' Pin 15: LED Backlight (5.0v)
    ' Pin 16: LED Backlight (0v)
    '
    ' PIC16F627A
    ' Pin 1: RA2 LCD DB6
    ' Pin 2: RA3 LCD DB7
    ' Pin 3: RA4 LCD RS (10k Voltage Pullup to +5v)
    ' Pin 5: VSS Ground
    ' Pin 9: RB3 LCD E
    ' Pin 14: VDD
    ' Pin 17: RA0 LCD DB4
    ' Pin 18: RA1 LCD DB5
    '
    ' LCD Definition
    DEFINE LCD_DREG PORTA ' Set LCD Data port
    DEFINE LCD_DBIT 0 ' Set starting Data bit (0 or 4) if 4-bit bus
    DEFINE LCD_RSREG PORTB ' 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 3 ' 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
    ' DEFINE LCD_LINES 4 ' Set number of lines on LCD
    DEFINE LCD_COMMANDUS 2000 ' Set command delay time in us
    DEFINE LCD_DATAUS 50 ' Set data delay time in us
    
    CMCON = 7 ' <font color=red>disable analog comparators</font color>RA0-RA3 are digital I/O
    TRISA = 0 ' PORT A is output
    TRISB = 0 ' PORT B is output
    <font color = red> Pause 1000</font color>
    
    RPT:
    LCDOUT $FE,1 ' Clear LCD
    LCDOUT $FE, $0C 'Cursor off
    LCDOUT $FE, $0F ' Blinking cursor on
    PAUSE 500 ' Wait 0.5 second for LCD to startup
    
    ' For 16x2 LCD
    LCDOUT $FE,2, "Hello." ' Display 1st Line
    LCDOUT $FE,$C0, "World." ' Display 2nd Line
    ' For 20x4 LCD
    ' LCDOUT $FE,2, "Hello." ' Display 1st Line
    ' LCDOUT $FE,$C0, "World." ' Display 2nd Line
    ' LCDOUT $FE,$94, "Line 3" ' Display 3rd Line
    ' LCDOUT $FE,$D4, "Line 4" ' Display 4th Line
    
    PAUSE 10000 ' Wait 10 second
    
    GOTO RPT ' Repeat
    
    END ' End of program

    After I posted, I just added following statements to my code. Still no help.

    define osc 4 ' Internal OSC 4 MHZ<font color=red> add intrc</font color>
    define loader_used 1 ' <font color=red> makes bootloader work</font color>?
    @ Device pic16F627A, BOD_ON, LVP_OFF, PWRT_ON, WDT_ON, PROTECT_OFF,<font color=red> INTRC_OSC_NOCLKOUT </font color>

    Hello John Paul,
    I made some minor tweaks in red above, also be advised RA4 is an open drain output..edit: Oh I see the resistor in your comments, so you got that covered.
    JS
    Last edited by Archangel; - 21st May 2007 at 09:55.
    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.

  2. #2
    Join Date
    May 2007
    Posts
    14


    Did you find this post helpful? Yes | No

    Default

    Ski,
    I am still using the same chip PIC16F627A.
    I failed the LED test. I hook up an LED to the Ground then in series to 330 ohm Resistor and a cable at the end. I tap the cable to +5V and tested the LED polarity. Then I tap each of the pin. I tried one LED then also tried all of the output pins. Program below.
    How could I have damaged my chip? It is new. How could I be certain my chip is damaged before I toss it to the trash can?

    LED6 VAR PORTB.0 ' Pin LED Test
    TRISB = 0 ' PORT B is output
    RPT:
    PAUSE 2000 ' WAIT 1 SECOND
    LED6 = 1 ' Turn Pin LED ON

    PAUSE 2000 ' WAIT 1 SECOND
    LED6 = 0 ' Turn Pin LED OFF

    GOTO RPT ' Repeat

    END ' End of program

    Also tried them all and none of the LED turned on.

    LED1 VAR PORTA.2 ' Pin LED Test
    LED2 VAR PORTA.3 ' Pin LED Test
    LED3 VAR PORTA.4 ' Pin LED Test
    LED4 VAR PORTA.5 ' Pin LED Test
    LED6 VAR PORTB.0 ' Pin LED Test
    LED7 VAR PORTB.1 ' Pin LED Test
    LED8 VAR PORTB.2 ' Pin LED Test
    LED9 VAR PORTB.3 ' Pin LED Test
    LED10 VAR PORTB.4 ' Pin LED Test
    LED11 VAR PORTB.5 ' Pin LED Test
    LED12 VAR PORTB.6 ' Pin LED Test
    LED13 VAR PORTB.7 ' Pin LED Test
    LED15 VAR PORTA.6 ' Pin LED Test
    LED16 VAR PORTA.7 ' Pin LED Test
    LED17 VAR PORTA.0 ' Pin LED Test
    LED18 VAR PORTA.1 ' Pin LED Test

    TRISA = 0 ' PORT A is output
    TRISB = 0 ' PORT B is output


    RPT:
    PAUSE 1000 ' WAIT 1 SECOND
    LED1 = 1 ' Turn Pin LED ON
    LED2 = 1 ' Turn Pin LED ON
    LED3 = 1 ' Turn Pin LED ON
    LED4 = 1 ' Turn Pin LED ON
    LED6 = 1 ' Turn Pin LED ON
    LED7 = 1 ' Turn Pin LED ON
    LED8 = 1 ' Turn Pin LED ON
    LED9 = 1 ' Turn Pin LED ON
    LED10 = 1 ' Turn Pin LED ON
    LED11 = 1 ' Turn Pin LED ON
    LED13 = 1 ' Turn Pin LED ON
    LED15 = 1 ' Turn Pin LED ON
    LED16 = 1 ' Turn Pin LED ON
    LED17 = 1 ' Turn Pin LED ON
    LED18 = 1 ' Turn Pin LED ON
    PAUSE 1000 ' WAIT 1 SECOND

    LED1 = 0 ' Turn Pin LED OFF
    LED2 = 0 ' Turn Pin LED OFF
    LED3 = 0 ' Turn Pin LED OFF
    LED4 = 0 ' Turn Pin LED OFF
    LED6 = 0 ' Turn Pin LED OFF
    LED7 = 0 ' Turn Pin LED OFF
    LED8 = 0 ' Turn Pin LED OFF
    LED9 = 0 ' Turn Pin LED OFF
    LED10 = 0 ' Turn Pin LED OFF
    LED11 = 0 ' Turn Pin LED OFF
    LED13 = 0 ' Turn Pin LED OFF
    LED15 = 0 ' Turn Pin LED OFF
    LED16 = 0 ' Turn Pin LED OFF
    LED17 = 0 ' Turn Pin LED OFF
    LED18 = 0 ' Turn Pin LED OFF

    GOTO RPT ' Repeat

    END ' End of program

  3. #3
    Join Date
    May 2007
    Posts
    14


    Did you find this post helpful? Yes | No

    Default

    JoeS,

    Your posts noted and changes made. I am pondering why my chip is not working. If the chip is damaged, won't the programmer verify step resulted in an error? What's next after LED test failed? I have another pci16gf627A chip. I am afraid that I might damage it too.

    Regards,
    JohnPaul

  4. #4
    Join Date
    May 2007
    Posts
    14


    Did you find this post helpful? Yes | No

    Default

    ski,

    I like your 'heartbeat' practice. I would adapt it as my practice too.

    Regards,
    JohnPaul

  5. #5
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by JohnPaul View Post
    ski,

    I like your 'heartbeat' practice. I would adapt it as my practice too.

    Regards,
    JohnPaul
    Put a voltmeter on the OSCx pins. You should get around 2.5v with an external oscillator, or if you've got OSC2 setup as an Fosc/4 output.
    I wouldn't think you smoked a chip...as has been noted before, PICs are fairly tough chips, not unbreakable, but tough.
    And if for some reason, your PIC is running on the 48khz internal clock, your program will run about 83 times slower than it should...in other words it'll take 166 seconds for your LEDs to blink.

  6. #6
    Join Date
    May 2007
    Posts
    14


    Did you find this post helpful? Yes | No

    Smile

    Ski,

    Hmm. I am not yet familiar with the OSC parameter settings.
    I did the LED test without any of the additional DEFINE and @ statements beside the ones that I posted.
    I waited 5-10 minutes for the LED to light up on pin 6. But the chip and bottom of the bread board were getting hot so I pulled the power off.


    I just checked again. I think that I might have really burned my chip this time.
    I placed the voltmeter on 0 and +5V, and I would read +5v. But the moment I connect my +5v cable to VDD (pin 14). The voltmeter reading would drop to 1.67v?


    Regards,
    JohnPaul

  7. #7
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Ok, get rid of everything but the power supply (connect a light bulb across it, verify 5v under a small load, use 3 alkalines or 4 NiCads instead of a power supply), the PIC16F627A, an LED with a 300-ish ohm resistor in series, 10K pullup to +5v on MCLR, and some sort of crystal/oscillator setup on OSC1... and put a small cap across Vdd and Vss on the PIC (very important step here!)

    Double check your pin 1 on the PIC and plug it in.
    Break it down...break it WAY down to bare bones.

    Rewrite the program, simplify it as far as you can, one LED or a group of LEDs, doesn't matter, same thing, blink the LED...

    Let us know what you've got after you get it broke down...

    I don't think you've fried anything (although it's entirely possible), I think you're just forgetting something basic, and when that gets figured out, everything else will fall into place faster than you can spend money on it

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by JohnPaul View Post
    JoeS,

    Your posts noted and changes made. I am pondering why my chip is not working. If the chip is damaged, won't the programmer verify step resulted in an error? What's next after LED test failed? I have another pci16gf627A chip. I am afraid that I might damage it too.

    Regards,
    JohnPaul
    Hi JohnPaul,
    You would think so wouldn't you, but the short answer is no, I have killed a few PICs and had programs verify fine, I think I killed the output transistors while the core of the pic remained undamaged. You would do well if using an old breadboard to either replace it or use an ohmmeter to verify all connections, I have been led to the land of little hair as a result of these.
    JS
    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.

  9. #9
    Join Date
    May 2007
    Posts
    14


    Did you find this post helpful? Yes | No

    Default

    Joes & Ski,
    Thank you for the help.

    JoeS,
    Using an Ohmeter, which pins do I tap, what to expect and why? I would also do the Ohmeter test on a new chip alongside with this chip in question.

    Regards,
    JohnPaul

  10. #10
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    MCLR / Vdd - 5v (if running a 5v power supply, otherwise, take all these reading and divide them down accordingly)

    Vss - 0v

    OSC1 / OSC2 - with an external oscillator/crystal, somewhere around 2.5v give or take, because the meter is really reading DC, it's catching the average of the DC, which since it's going high/low/high/etc, is around 2.5v.

    Pins set to an input will most likely read about 2.5v, or a suitable fraction of the main power supply voltage.

    Pins set to output and logic low will be between 0v and about .6v

    Pins set to output and logic high will be around 7/10 of the main power voltage.

    All interconnects on your breadboard should be practically a dead short, like less than about 10 ohms or so. Don't forget to check your multimeter leads themselves for resistance.

    Hopefully this is what you were asking about. Sounds a tad bit basic to me, but that's just me...

    By checking the new chip against the old chip alongside it in identical circuits, you are doing what I call a 'signature check', good troubleshooting technique, but it really only works if you've got a couple of known good working setups to verify another bad setup.

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by JohnPaul View Post
    Joes & Ski,
    Thank you for the help.

    JoeS,
    Using an Ohmeter, which pins do I tap, what to expect and why? I would also do the Ohmeter test on a new chip alongside with this chip in question.

    Regards,
    JohnPaul
    Hi JP,
    Pretty much as skimask said, just check from the leads of the components to where they are supposed to be connected ( the other component ). These breadboards get really spooky over time. Darrel told me he only uses them once. That's too rich for my blood but my time is perhaps less valuable. Certainly I do not do this for a living. I dissasembled my old breadboards and was very surprised at what I found in the way of wear and corrosion. This is especially important on the VSS & VDD connections so power flows through the device in the way it's designers intended, otherwise very strange current paths can exist and FRY something.
    JS
    Last edited by Archangel; - 22nd May 2007 at 22:55.
    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.

  12. #12
    Join Date
    May 2007
    Posts
    14


    Did you find this post helpful? Yes | No

    Smile Howdy, partners.

    Hey, folks. No progress today... Hehehe... I actually mean I slacked off. I could not find my other 627A. Use of magnifier did not helped. I would try the 84A but have to use OSC chip or I have to use my 40 pins. I could not wait for the weekend to come.

    What is the most advanced PIC chip one could wish for? I like my 627A since it has internal OSC.

    I am reserving my 40 pins for more complexed project in the future.


    Cheers!

    John Paul

  13. #13
    Join Date
    May 2007
    Posts
    14


    Did you find this post helpful? Yes | No

    Default

    JohnS,
    I bought this regulated variable PS. They go by 1.5, 3, 4.5, 6, 9v, 12v.
    No +5v! I like it because it's so portable than those high Amp PS. So I was playing with the PIC with 4.5v and ocassionally switching to 6v. Could I have caused the untimely dead of my PIC?
    Later, I retrieve one of my breadboard with a T7805. Just to make sure the LCD and Chip now has the recommended (or was it REQUIRED) voltage?
    Hahaha...

    Regards,
    JohnPaul

Similar Threads

  1. 16f688 LCD what have I done wrong
    By spitfiredriver in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 8th August 2009, 19:54
  2. Play with LCD on PICDEM
    By The IceMan in forum mel PIC BASIC
    Replies: 5
    Last Post: - 22nd August 2008, 16:56
  3. Need help with LCD number display.
    By Steve Matson in forum mel PIC BASIC
    Replies: 8
    Last Post: - 26th June 2007, 23:07
  4. Gps with 16f628
    By dragons_fire in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 8th June 2006, 03:38
  5. Dedicated LCD Controller question
    By chuckles in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 27th February 2006, 14:44

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