LCD will not start


Results 1 to 40 of 50

Threaded View

  1. #26
    Join Date
    May 2007
    Posts
    14


    Did you find this post helpful? Yes | No

    Question New to HD44780, MCU & PBP. - Need LCD Help

    Hello, everyone.

    I am new to this forum. I am so happy to see so many people helping out others. I wish I could be of help myself in the future.

    I have been tracking problems in HD44780. I think this could be the closest problem solved that is relevant to my problem.

    I have two HD44780 that I am currently getting to work. One is a 16x2 and another 20x4. I am using Pic Basic Pro & PIC16F627A. I pick this chip because I would like to simplify without the External Osc components. I am currently using a solderless breadboard.

    Currently,
    for the 16x2, I got 16 blocks on first line and blank on 2nd line.
    for the 20x4, I am getting 20 blocks of 1st & 3rd lines, rest are blank.



    So far, my code is

    ' 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 ' RA0-RA3 are digital I/O
    TRISA = 0 ' PORT A is output
    TRISB = 0 ' PORT B is output


    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


    I think based on code below. It appear that I am missing

    define osc 20
    define loader_used 1
    @ Device pic16F877A, HS_OSC, BOD_ON, LVP_OFF, PWRT_ON, WDT_ON, PROTECT_OFF

    for 16F627, what should my parameters be?
    define osc 4 ? for pic16f627a
    What is the usage for all these statements? Are they all required?
    Can someone kindly explain? And show me where these material (an perhaps more) are documented?

    Also, do I still need the following three PBP statements. Are they redundant with the DEFINE statements?
    CMCON = 7 ' RA0-RA3 are digital I/O
    TRISA = 0 ' PORT A is output
    TRISB = 0 ' PORT B is output

    What is the best way to test if my internal OSC function is working?

    Since I am so new to all the elements, can someone tell me where how to pin down my LCD problem(s). Any help would be greatly appreciated.



    Hello, everyone.

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

    define osc 4 ' Internal OSC 4 MHZ
    define loader_used 1 ' ?
    @ Device pic16F627A, HS_OSC, BOD_ON, LVP_OFF, PWRT_ON, WDT_ON, PROTECT_OFF


    I am also new to both pic chip and LCD module. I have used voltmeter to check the voltages at each point. How do I conduct proper hardware check. I have been through many times on regarding the pin / wiring connection. How do I know if my chip is defective? How do I know if my LCD is defective? Thank you for reading.

    John Paul
    Michigan

    Quote Originally Posted by btaylor View Post
    Problem solved.

    I originally had my TRIS statements immediately following the port definitions. By making the first line of my code a PAUSE 2500 statement followed by the TRIS etc, the system now works.

    It seems the LCD wants to see floating drive for something more than one second before it is happy. With this approach I can eliminate all my initialise code and just rely on LCDOUT $FE, $01 to somehow do it for me.

    The following code now works on both slow start and fast start power supplies as well as a direct MCLR.

    define osc 20
    define loader_used 1
    Define LCD_DREG PORTD
    Define LCD_DBIT 0
    Define LCD_RSREG PORTD
    Define LCD_RSBIT 5
    Define LCD_EREG PORTD
    Define LCD_EBIT 4
    DEFINE LCD_LINES 2
    DEFINE LCD_BITS 4
    DEFINE LCD_RWREG PORTD 'LCD read/write port
    DEFINE LCD_RWBIT 6 'LCD read/write bit
    DEFINE LCD_COMMANDUS 2000 'Command delay time in us
    DEFINE LCD_DATAUS 100 'Data delay time in us
    define char_pacing 200
    DEFINE SHIFT_PAUSEUS 100

    @ Device pic16F877A, HS_OSC, BOD_ON, LVP_OFF, PWRT_ON, WDT_ON, PROTECT_OFF
    '@__config_HS_OSC &_BOD_OFF &_PWRT_ON &_WDT_ON &_PROTECT_OFF &_LVP_OFF
    Last edited by JohnPaul; - 21st May 2007 at 01:48. Reason: Update & Typos

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 : 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