Microcontroller › 8051 › 16×2 LCD Skipping Alphabetic Letters (b,d,f,h,j etc.) – AT89C5131A
- This topic has 9 replies, 4 voices, and was last updated 11 years, 11 months ago by Syed Aameer.
-
AuthorPosts
-
December 21, 2012 at 3:05 pm #2031guydParticipant
Hello,
I connected my lcd as directed in “How to display text on 16×2 LCD using 8051 microcontroller”.
I used at89C5131A.
The code is working properly, however there is one problem:
For every 2nd alphabetic letter, it will skip to the next letter. that means if I write ABC it will show ACC
A = A
B = C
C = C
D = E
E = E
F = G
G = G
H = I
I = I
J = K
K = K
[space] = !
: = ;
and so on..
Whats wrong with my LCD? Please help
Thank you!
December 21, 2012 at 6:05 pm #8865AJISH ALFREDParticipantInteresting! I guess there is nothing wrong with the LCD. Could you please post the code which you are using.
December 21, 2012 at 7:27 pm #8869guydParticipantHey,
Thanks for the reply, I managed to debug it, seems like port 2.0 did not change it value, so D0 on LCD was getting ‘1’ all the time.
Thanks again for taking your time trying to help!
December 21, 2012 at 8:50 pm #8870guydParticipantWell, in theory that is the problem…
but for some reason, the problem still extist.
the code:
//Program to display String on LCD
#include<reg52.h>
#define lcd_data_pin P2
sbit rs=P3^0; // Register select pin
sbit rw=P3^1; // Read write pin
sbit en=P3^2; // Enable pin
void delay(unsigned int msec) //delay function
{
int i,j;
for(i=0;i<msec;i++)
for(j=0;j<1275;j++);
}
void lcd_command(unsigned char comm) // function to send command to LCD
{
lcd_data_pin=comm;
en=1;
rs=0;
rw=0;
delay(1);
en=0;
}
void lcd_data(unsigned char disp) // function to send data on LCD
{
lcd_data_pin=disp;
en=1;
rs=1;
rw=0;
delay(20);
en=0;
}lcd_dataa(unsigned char *disp) // function to send string to LCD
{
int x;
for(x=0;disp[x]!=0;x++)
{
lcd_data(disp[x]);}
}void lcd_ini() //Function to inisialize the LCD
{
lcd_command(0x38);
delay(5);
lcd_command(0x0F);
delay(5);
lcd_command(0x80);
delay(5);
}
void main()
{
while(1){
lcd_ini();
lcd_dataa(“A B :a;a”);}
}Result: LCD Displays “A!C!;a;a”
December 22, 2012 at 7:25 am #8872AJISH ALFREDParticipantHi,
I found the following things that could be the reason
You are calling lcd_ini() each time before writing a data.
I can’t find where you’ve set the port P2 and P3 bits as output
Now Check your port settings again, keep the lcd_ini() and lcd_dataa(“A B :a;a”); before the beginig of the infinite while loop and not inside it.
Try and please don’t forget to update the result.
December 31, 2012 at 2:31 pm #8887guydParticipantSorry I did not write for a while.
No, it did not help.
I tried another methods to send data to LCD, more delays,
trying to send a single letter, “B” which is 0x42, or 01000010, port on the card is on the right data, also port on the lcd is on the right data, but still the display show “C”.
maybe LCD is defective?
January 2, 2013 at 1:59 pm #8893AJISH ALFREDParticipantMay be! Lot of sample codes are available from the net for LCD interfacing. Test any of the simpleset code and find whether the problem persist.
January 12, 2013 at 5:27 pm #8937guydParticipant4bit communication with LCD passed successfully.
Thanks.
January 18, 2013 at 9:59 am #8974prajwalParticipanthi…
I am interfacing LCD with the circuit and code provided in “ENGINEERS GARAGE” the only change i have made is i have used AT89S52 instead of AT89C51 as used in the tutorials.. Im not getting any output on the LCD.. where actually the problem is being occurred? help please..
Thanks in advance.
February 14, 2013 at 7:30 am #9131Syed AameerParticipantcheck the rs, rw and en pin correctly set…………….
-
AuthorPosts
- You must be logged in to reply to this topic.