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

Wed Nov 08 2017, 01:35 PM
Anirudh jain
I want to burn code in atmel 89s51 24pc 0329 but cannot get the connection with the burner. Can somebody provide me with the circuit diagram for connecting controller to burner. I'm using usb burner
Thu Nov 02 2017, 11:44 AM
karpal
write a program to exchange the content of b register with external RAM address 02CFH help me
Wed Nov 01 2017, 05:47 PM
sanae
i am using the DHT11 but i'm getting some errors in the simulate the programe in proteus 8 professional,: 1)cannot find model file 'DHTXX.MDF'.2)simulation failed due to netlist linker error(s).
Fri Sep 29 2017, 02:45 AM
Maaz
i am doing the same project on verilog please contact me [email protected]
Wed Sep 20 2017, 12:36 AM
Ted
In a missing pulse detector using a 555 timer connected as a monostable vibrator with a PNP transistor,how does the positve input pulse turn on the PNP transistor?
Sun Sep 03 2017, 02:29 PM
martymarty
How do I connect an <NOKIA 1100 LCD > to an atmega328P ?
poojab51296
Sun Aug 20 2017, 10:23 AM
i am intending to interface sd card with STM32F4 and want to write a file in sd card using SPI protocol but using HAL only. Can anyone help me PLEASE!!!!
poojab51296
Sun Aug 20 2017, 10:22 AM
hello
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

Downloads

Comments

PANDIKOTESWARARAO
Mon Nov 20 2017, 07:40 PM
Hemantika
Sun Nov 19 2017, 07:34 PM
Wed Nov 15 2017, 10:46 AM
Ansh12
Sat Nov 11 2017, 03:43 AM
AngelGT93
Fri Nov 10 2017, 06:53 AM
JardCrocker
Wed Nov 08 2017, 05:27 PM
vivitern
Tue Nov 07 2017, 09:08 AM
catrons
Sat Nov 04 2017, 10:46 PM

Online

Guests: 54, Members: 0 ...

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

Members: 37918
Newest member: PANDIKOTESWARARAO
Forum Activity
ExperimenterUK Avatar
Posted By ExperimenterUK
Mon Nov 20 2017, 10:18 PM
Here is a version of the tutorial that reads a key...
Ansh12 Avatar
Posted By Ansh12
Mon Nov 20 2017, 02:15 AM
As a starting point, can you tell us how much of t...
ExperimenterUK Avatar
Posted By ExperimenterUK
Sun Nov 19 2017, 08:35 PM
As a starting point, can you tell us how much of t...
Ansh12 Avatar
Posted By Ansh12
Fri Nov 17 2017, 04:07 AM
I am looking keypad interfacing program. I was rea...
JardCrocker Avatar
Posted By JardCrocker
Wed Nov 08 2017, 05:29 PM
Hi...i am a new user here. I was also facing the s...
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Nov 07 2017, 07:13 PM
> It employs a fairly advanced technique to detect...
vivitern Avatar
Posted By vivitern
Tue Nov 07 2017, 09:33 AM
I own a used Clavia ddrum4 SE drum module. It empl...
bvdb Avatar
Posted By bvdb
Wed Oct 18 2017, 01:50 AM
I purchased the RKitL51 8051 C compiler from Raiso...
ExperimenterUK Avatar
Posted By ExperimenterUK
Mon Oct 16 2017, 11:44 PM
That looks complicated.Is 8051_BLK a standard 80...
ExperimenterUK Avatar
Posted By ExperimenterUK
Sun Oct 15 2017, 07:29 PM
According to this, gmail should support POP3.https...