Discussion in "8051 Discussion Forum" started by    KT    Jan 4, 2009.
Sun Jan 04 2009, 11:01 AM
#1
Hi there,

I am trying to display data on 20x4 LCD, i bought this JHD 204A LCD. I used the library in the download section to write the program. I am using Atmel 89C51. I have uploaded the datasheet of JHD 204A, and the data sheet of the controller on this display as well, KS0070B. Now my problem start with the program working fine with 16x2 display which again is JHD's product only. But when i connect 20x4 display, the characters are mixed up,

eg: I put ABCDEFGHIJK
it displays - @BBCCDDEE

But the same thing works fine with 16x2, it displays it properly. Infact anything I display on the 20x4 shows garbage values

Another issue is that the data sheet tell DDRAM address as starting from 00H, but if use this it does not display on the screen properly. But if i use 80H as in the library it works fine.

I dont understand where I have gone wrong with 20x4. Please help me out with this.

Attachment
Sun Jan 04 2009, 11:30 AM
#2


Infact anything I display on the 20x4 shows garbage values




To begin, you can carefully see if there is any "short" between data bus, it may happen that the solder is very close to neighbouring pads. wipe the excess solder flux /paste between the data pins.


from addressing point, the 3rd line is a continuation of 1st line and 4th line is that of 2nd line, thats all, no big deal !



Arun
Sun Jan 04 2009, 07:47 PM
#3
First Line : 0x80
Second Line: 0xC0
Third Line: 0x94
Fourth Line: 0xD4

more information about this, read Basics of LCD.
http://www.8051projects.net/lcd-interfacing/basics.php
Mon Jan 05 2009, 09:38 AM
#4
Hi Arun,

Well I did check it up, but that was not the problem coz I have another 20x4 LC display and the same thing is happening with it. But if i switch it with 16x2 it works fine

Ajay, that data sheet got me confused. In fact the LCD controller data sheet also mentions that.
Mon Jan 05 2009, 01:19 PM
#5
so is it working fine now?
Mon Jan 05 2009, 05:38 PM
#6
No Ajay, its not working properly. The 20x4 LCD is driving me crazy. There was no problem with the soldering or the connections. The same program and connections are working fine with a 16x2 display but not with 20x4
Tue Jan 06 2009, 01:29 PM
#7
can you paste the code here?
Tue Jan 06 2009, 02:53 PM
#8
here is the code. its the same code which u had written. I have Pictures put which shows the 20x4 LCD and the 16x2 LCD. the 16x2 displays properly and the 20x4 does not. I have just changed the x & y in set cursor function

void lcd_init()
{
delayms(500);

LCD_PORT=0x38;
rs=0;
rw=0;
en=1;
en=0;
delayms(50);
LCD_PORT=0x0C;
rs=0;
rw=0;
en=1;
en=1;
en=0;
delayms(50);
LCD_PORT=0x06;
rs=0;
rw=0;
en=1;
en=1;
en=0;
delayms(50);
LCD_PORT=0x01;
rs=0;
rw=0;
en=1;
en=1;
en=0;
delayms(50);


}

void busy()
{
flag=1;
rs=0;
rw=1;
while(flag!=0)
{
en=0;
en=1;
}
}

void wrt_cmd(bit_8 val)
{
busy();
LCD_PORT=val;
rs=0;
rw=0;
en=1;
en=1;
en=0;
delayms(10);
}


void wrt_string(bit_8 *string)
{
busy();
while(*string)
wrt_data(*string++);
}


void wrt_data(bit_8 ch)
{
busy();
LCD_PORT = ch;
rs=1;
rw=0;
en=1;
en=1;
en=0;
delayms(100);
}


void wrt_value(bit_8 x)
{
wrt_data(x+0x30);
}


/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Bringing Cursor to (X,Y) location of LCD
X -> 1 to 20
Y -> 1,2,3,4
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

void cursorxy(bit_8 x, bit_8 y)
{
if((x<1||x>20)&&(y<1||y>4))
{
x=1;
y=1;
}
if(y == 1)
wrt_cmd(0x7F+x); //0x7F+x
else if(y == 2)
wrt_cmd(0xBF+x); //0xBF+x

else if(y == 3)
wrt_cmd(0x93+x); //0x93+x

else if (y == 4)
wrt_cmd(0xD3+x); //0xD3+x

}





Tue Jan 06 2009, 03:08 PM
#9
you forgot the main function
Wed Jan 07 2009, 10:29 AM
#10
Hey Ajay, thats just apart of my program all the functions, in the main i call the init first and write "ABCDEFGHIJK" on the screen. U can c it displaying, the 20x4 LCD does not do it properly but the same circuit and same program 16x2 does. I checked in 4bit mode as well same thing is happening

Get Social

Information

Powered by e107 Forum System

Conversation

rawat742
Fri Aug 18 2017, 11:37 AM
hi @ angel patel i will attach a file i hope it will be helpfull for you
ExperimenterUK
Mon Aug 14 2017, 09:57 PM
@ angel patel... just log in and post your problem
Mon Aug 14 2017, 01:45 PM
angel patel
hey any one help to make the led scrolling display
desuza6
Sat Jul 29 2017, 07:09 AM
I see the code for step motor h l 298 to rotate 45 degree, but all delay time, if I want to input sensor to h the pulses to stepmotor
rammichael
Thu Jul 27 2017, 12:05 PM
okay fine
ExperimenterUK
Wed Jul 26 2017, 07:51 PM
Please post questions in the forum, the chat box is for chat
msd007
Wed Jul 26 2017, 11:27 AM
i need code if any one have aduc706 interfacing lcd 16*2
msd007
Wed Jul 26 2017, 11:26 AM
pl help me how to write code of interfacing ADuc7026 controlleo lcd pl any one help me hoe to initializend configure the direction
rammichael
Wed Jul 26 2017, 06:04 AM
can you explain what is timer and how to use their modes ...
rammichael
Wed Jul 26 2017, 06:03 AM
ExperimenterUk thank you for your quick reply okay

Downloads

Comments

kira113
Sat Aug 19 2017, 08:40 AM
Pirateak
Thu Aug 17 2017, 02:02 PM
sathishksk71
Wed Aug 16 2017, 04:47 AM
rawat742
Sun Aug 13 2017, 05:49 PM
alparslanbagriyanik
Fri Aug 11 2017, 08:10 AM
Thanhquan
Sat Aug 05 2017, 05:17 PM
NAMRATHA
Thu Aug 03 2017, 08:32 AM
Kgj
Tue Aug 01 2017, 12:41 PM

Online

Guests: 77, Members: 0 ...

most ever online: 182184
(Members: , Guests: 182184) on 06 Aug 2010: 05:37 AM

Members: 37879
Newest member: kira113
Forum Activity
kira113 Avatar
Posted By kira113
Sat Aug 19 2017, 08:52 AM
hello everyone i write a simple program using c la...
ExperimenterUK Avatar
Posted By ExperimenterUK
Sat Aug 19 2017, 02:47 AM
else x+=0x46; //print as ascill 0x41 to 0x46 A-F ...
rawat742 Avatar
Posted By rawat742
Fri Aug 18 2017, 02:58 PM
Dear Sir, I have a another program in which I am a...
rawat742 Avatar
Posted By rawat742
Fri Aug 18 2017, 11:45 AM
LCD SCROLLING MESSAGE PROGRAM CODE AND SIMULATION...
rawat742 Avatar
Posted By rawat742
Fri Aug 18 2017, 11:24 AM
Dear Sir , I am not able to increased value by pre...
rawat742 Avatar
Posted By rawat742
Fri Aug 18 2017, 11:19 AM
Dear Sir, as per your attachment I w...
ExperimenterUK Avatar
Posted By ExperimenterUK
Thu Aug 17 2017, 10:54 PM
Try this. Attachment ...
rawat742 Avatar
Posted By rawat742
Thu Aug 17 2017, 08:24 PM
Dear Sir , Please help me for stor...
sathishksk71 Avatar
Posted By sathishksk71
Wed Aug 16 2017, 04:53 AM
Hi.. Iam refreshing c language using this useful r...
ExperimenterUK Avatar
Posted By ExperimenterUK
Mon Aug 14 2017, 10:19 PM
The original 8051 is a primitive device.Over the ...