LCD not working

Discussion in 'The Projects Forum' started by AaraAbdas, Jan 1, 2013.

  1. AaraAbdas

    Thread Starter New Member

    Dec 11, 2012
    5
    0
    In my project, i am interfacing LCD with PIC18F452. It is working fine in proteus but not on bread board? :(
    I made a program in mikroC using LCD library .. is there some problem with using built in commads or i m using wrong port for LCD??
    Please help me out .. here is the code of the program

    Code ( (Unknown Language)):
    1.  
    2. // LCD module connections
    3. sbit LCD_RS at RD4_bit;
    4. sbit LCD_EN at RD5_bit;
    5. sbit LCD_D4 at RD0_bit;
    6. sbit LCD_D5 at RD1_bit;
    7. sbit LCD_D6 at RD2_bit;
    8. sbit LCD_D7 at RD3_bit;
    9.  
    10. sbit LCD_RS_Direction at TRISD4_bit;
    11. sbit LCD_EN_Direction at TRISD5_bit;
    12. sbit LCD_D4_Direction at TRISD0_bit;
    13. sbit LCD_D5_Direction at TRISD1_bit;
    14. sbit LCD_D6_Direction at TRISD2_bit;
    15. sbit LCD_D7_Direction at TRISD3_bit;
    16. // End LCD module connections
    17.  
    18. void main()
    19.      {
    20.  
    21.       TRISB = 0xFF;
    22.       PORTB = 0x00;
    23.  
    24.       TRISC=0x00;
    25.       PORTC=0x00;
    26.      
    27.           Lcd_Init();
    28.       Lcd_Cmd(_LCD_CLEAR);
    29.       Lcd_Cmd(_LCD_CURSOR_OFF);
    30.  
    31.      Lcd_Out(1, 1, "Waiting..");
    32.       Delay_ms(100);
    33.        Lcd_Cmd(_LCD_CLEAR);
    34.       while(1)
    35.       {
    36.          
    37.          Lcd_Out(1, 1, "Project");
    38.        }
    39.  }
    40.  
     
    • esd.png
      esd.png
      File size:
      54 KB
      Views:
      24
    Last edited by a moderator: Jan 1, 2013
  2. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,887
    1,016
    Verify all of your connections. Step through your code and watch that pins on the LCD change as expected, using a logic probe, scope etc.

    Also it looks like you are using PortD that is connected to your LCD but you are not initialized the TRIS register for D.
     
  3. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    Try using the internal oscillator. Are also your configuration bits properly set
     
  4. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,394
    1,606
    I will not comment on the code as I am not familiar with MikroC libraries.

    D1 and D2 will probably need series resistors to limit current. Do not turn them on unless you know this not to be true in your case.
     
Loading...