# Problem with lcd - pic interface

I wrote the following code to display a blinking text on an lcd. The code works properly on the simulator but the real lcd doesn't display anything. I attached the circuit diagram I used to connect the lcd. I would really appreciate it if someone could tell me what did I do wrong.

[![// LCD module connections
sbit LCD_RS at PORTD.B2;
sbit LCD_EN at PORTD.B3;
sbit LCD_D4 at PORTD.B4;
sbit LCD_D5 at PORTD.B5;
sbit LCD_D6 at PORTD.B6;
sbit LCD_D7 at PORTD.B7;

sbit LCD_RS_Direction at TRISD.B2;
sbit LCD_EN_Direction at TRISD.B3;
sbit LCD_D4_Direction at TRISD.B4;
sbit LCD_D5_Direction at TRISD.B5;
sbit LCD_D6_Direction at TRISD.B6;
sbit LCD_D7_Direction at TRISD.B7;
// End LCD module connections][1]][1]

char MyFirstText[] = "Hello ";

void main(){
Lcd_Init();

Lcd_Cmd(_LCD_CURSOR_OFF);
while(1)
{
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1,6,"Hello ");
Lcd_Out(2,6,"World");
Delay_ms(100);
}
}


P.S: I don't have a 10k potentiometer so I connected a 5k instead.

• You forgot to attach the schematic. Also, where do you configure your pins? – Armandas Mar 14 '16 at 18:41
• I think that you should put the "LCD_CLEAR" command outside of the loop (i.e. before while(1)) or increase the delay to few seconds. – Roger C. Mar 14 '16 at 18:43
• @Armandas Sorry, it's attached now. – Nemo Mar 14 '16 at 18:49
• @RogerC. I have to keep the Lcd_Cmd(_LCD_CLEAR); because I need the text to blink. I could increase the delay though but the things is my lcd doesn't respond at all so I think it might be connection problem. – Nemo Mar 14 '16 at 18:51
• @Nemo you might use the command LCD_DISPLAYON plus delay followed by LCD_DISPLAYOFF plus delay to produce the blinking effect. – Roger C. Mar 14 '16 at 20:08

   while(1){