Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

lcd displaying black boxes only with at89c51

Status
Not open for further replies.

Muhammad Faran

Newbie level 4
Newbie level 4
Joined
Apr 2, 2014
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
36
i am using lcd jhd 162A and using microcontroller AT89c51
lcd only shows black boxes in the second line...

dont know whats the problem is it initialization problem or something else in coding???

plz plz help

CODE:


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include<reg51.h>
#define port2 P2
sbit rs = P1^0;
sbit rw = P1^1;
sbit e = P1^2;
 
//DELAY FUNCTION
void delay(unsigned int msec)
{
int i,j ;
for(i=0;i<msec;i++)
for(j=0;j<1275;j++); 
}
 
// LCD COMMAND SENDING FUNCTION
void lcd_cmd(unsigned char item)
{
port2 = item;
rs= 0;
rw=0;
e=1;
delay(1);
e=0;
return;
} 
 
// LCD DATA SENDING FUNCTION
void lcd_data(unsigned char item)
{
port2 = item;
rs= 1;
rw=0;
e=1;
delay(1);
e=0;     
return;
}
 
 // LCD STRING SENDING FUNCTION 
void lcd_string(unsigned char *str)
{
int i=0;
while(str[i]!='\0')
{
        lcd_data(str[i]);
        i++;
        delay(10);
   }
        return;
}
 
void main()
{
 
lcd_cmd(0x38);         //2 LINE, 5X7 MATRIX
lcd_cmd(0x0e);         //DISPLAY ON, CURSOR BLINKING
 
lcd_string(unsigned char “working”);
}
}

 

When this happened to me it was either a contrast problem or a compiler setting problem (i think it was something along the lines of floating point). I would verify those are set correctly first.
 

what you mean by floating lines

- - - Updated - - -

what you meant by floating lines
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top