LCD not working

Thread Starter

AaraAbdas

Joined Dec 11, 2012
5
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

Rich (BB code):
// LCD module connections
sbit LCD_RS at RD4_bit;
sbit LCD_EN at RD5_bit;
sbit LCD_D4 at RD0_bit;
sbit LCD_D5 at RD1_bit;
sbit LCD_D6 at RD2_bit;
sbit LCD_D7 at RD3_bit;

sbit LCD_RS_Direction at TRISD4_bit;
sbit LCD_EN_Direction at TRISD5_bit;
sbit LCD_D4_Direction at TRISD0_bit;
sbit LCD_D5_Direction at TRISD1_bit;
sbit LCD_D6_Direction at TRISD2_bit;
sbit LCD_D7_Direction at TRISD3_bit;
// End LCD module connections

void main()
     {

      TRISB = 0xFF;
      PORTB = 0x00;

      TRISC=0x00;
      PORTC=0x00;
      
          Lcd_Init();
      Lcd_Cmd(_LCD_CLEAR);
      Lcd_Cmd(_LCD_CURSOR_OFF);

     Lcd_Out(1, 1, "Waiting..");
      Delay_ms(100);
       Lcd_Cmd(_LCD_CLEAR);
      while(1)
      {
         
         Lcd_Out(1, 1, "Project");
       }
 }
 

Attachments

Last edited by a moderator:

spinnaker

Joined Oct 29, 2009
7,830
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.
 

ErnieM

Joined Apr 24, 2011
8,415
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.
 
Top