[SOLVED] some problem to my 16x2 LCD (second row always black)

Status
Not open for further replies.

vinodstanur

Advanced Member level 3
Joined
Oct 31, 2009
Messages
751
Helped
114
Reputation
234
Reaction score
114
Trophy points
1,333
Location
Kerala (INDIA)
Activity points
7,054
i bought a new 16X2 LCD (JHD 162A) .I connected it as follows.
VCC=5V
VSS=0V
VEE=0V
DATA NOT CONNECTED
RS NOT CONNECTED
R/W =0V
E NOT CONNECTED
LED CONNECTED


BUT, NOW WHEN I SWITCH ON THE 5V power supply, then the 2nd row displays all black!
and i then connected it to a pic16f877a with a "hello world" program...but still no change!!
what should i do now?
 
Last edited:

There is a possibility that the LCD is bad. You can try with disconnecting the RW and VEE pins.

Hope this helps you.
 

if you just connect 1 ,3 to gnd and 2 to positive same result will come did you try
did you try in proteus same circuit
fake Chinese part is our headache
 

actually..it not second row..it first row..i also have that black box..but when you program..it will work..
 
thanks for the information...actually i thought it was the second row because there it written JHD 162A. At first i concluded my LCD was bad...now i will check my code ...
 

yes..at the first time..i thought it second row too..
 

try to program first. easier to just use a working example to check whether the LCD is broken or not. assuming u are going to ground the R/W, make sure the example program is also configured for that.
 

MY PROGRAM: WORKING IN OSHONSOFT EMULATOR.

#include <htc.h>
#define _XTAL_FREQ 4e6 // 4MHz
__CONFIG(0x3F3A);
#define RS RD0
#define RW RD1
#define EN RD2

void display(unsigned char c)
{
RS=1;
PORTB=c;EN=1;EN=0;
__delay_us(200);
}

void init()
{
PORTB=0;PORTD=0;TRISD=0;TRISB=0;
command(0x30);
command(0x30);
command(0x30);
command(0x38 ); //8) is a smiley, so i had given a space here)//
command(0x08 ); //8) is a smiley, so i had given a space here)//
command(0x01);
command(0x06);
command(0x0C);

__delay_ms(20);
}



void command(int k)
{
RS=0;
PORTB=k;EN=1;EN=0;
__delay_ms(15);
}
void message(const char *s)
{
while(*s)
display(*s++);
}



void main()
{ __delay_ms(200);
init();

while(1)
{
message("hello world");
while(1){};
}

}

BUT STILL SAME PROBLEM!!
 

it is not a serious problem..i was having this but in my board there was a regulator that makes thoes boxes light and dark to show the display clearly.......if you can figure out the regulator then it will be great...and i hope so that it will work....

---------- Post added at 23:37 ---------- Previous post was at 23:33 ----------


try to use this code it is built in code in mikro c compiler and this ode will run in 4 bit mode..i was having the same problem but it figured out...

Code:
sbit LCD_RS at RB4_bit;
sbit LCD_EN at RB5_bit;
sbit LCD_D4 at RB0_bit;
sbit LCD_D5 at RB1_bit;
sbit LCD_D6 at RB2_bit;
sbit LCD_D7 at RB3_bit;

sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;
// End LCD module connections

char txt1[] = "mikroElektronika";    
char txt2[] = "EasyPIC5";
char txt3[] = "Lcd4bit";
char txt4[] = "example";

char i;                              // Loop variable

void Move_Delay() {                  // Function used for text moving
  Delay_ms(500);                     // You can change the moving speed here
}

void main(){
  TRISB = 0;
  PORTB = 0xFF;
  TRISB = 0xff;
  ANSEL  = 0;                        // Configure AN pins as digital I/O
  ANSELH = 0;
  Lcd_Init();                        // Initialize LCD

  Lcd_Cmd(_LCD_CLEAR);                // Clear display
  Lcd_Cmd(_LCD_CURSOR_OFF);           // Cursor off
  Lcd_Out(1,6,txt3);                 // Write text in first row

  Lcd_Out(2,6,txt4);                 // Write text in second row
  Delay_ms(2000);
  Lcd_Cmd(_LCD_CLEAR);                // Clear display

  Lcd_Out(1,1,txt1);                 // Write text in first row
  Lcd_Out(2,5,txt2);                 // Write text in second row

  Delay_ms(2000);

  // Moving text
  for(i=0; i<4; i++) {               // Move text to the right 4 times
    Lcd_Cmd(_LCD_SHIFT_RIGHT);
    Move_Delay();
  }

  while(1) {                         // Endless loop
    for(i=0; i<8; i++) {             // Move text to the left 7 times
      Lcd_Cmd(_LCD_SHIFT_LEFT);
      Move_Delay();
    }

    for(i=0; i<8; i++) {             // Move text to the right 7 times
      Lcd_Cmd(_LCD_SHIFT_RIGHT);
      Move_Delay();
    }
  }
}
 

SUCCESS!!!!! I used my micro C sample program...its working ! So what may be the problem in my program?
 

i think u should change the configuration..
try use the configuration from sample and just edit certain part..
 

SUCCESS!!!!! I used my micro C sample program...its working ! So what may be the problem in my program?

the problem is you were using the delay_ms(200) which means delay 200 milli seconds...which a normal eye can not even see it when you use it on the hardware...and the delay_ms(15) also...ans as lockman said there is problem in confguring the bits of the lcd u didnt defined the data ports of the lcd...how can the display should be shown......
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…