Microcontroller › 8051 › Interfacing 16×2 LCD Character Problem
- This topic has 3 replies, 3 voices, and was last updated 13 years, 2 months ago by nikhiljain.
-
AuthorPosts
-
October 26, 2011 at 1:52 pm #1340AdeelParticipant
Hello guys,
I am using AT89C51 IC with 16×2 LCD after so much research i got how to display text on LCD but now i stuck with a character problem.
i was making this project: http://www.engineersgarage.com/microcontroller/8051projects/interfacing-adc0831-circuit a
nd was done 90% only the problem is that the Characters on my LCD are not correct:
lets say i m sending “ADC OUTPUT”
in my LCD its showing me “A?C OQPPQP2”
even if i send only single character which is ‘d’ its show me ” ?` ”
i dont know how to fix this issue can anyone help me in that ? any c example fixing this issue ??
October 26, 2011 at 5:37 pm #6751Ashish AnguralParticipanthey try this
#include<reg51.h>
#include<intrins.h>
#define data P1
sbitS1=P1^0;
sbitS2=P1^2;
sbit RS=P2^0;
sbit RW=P2^1;
sbit E=P2^2;sbit A1=P0^0;
sbit B1=P0^1;
sbit C1=P0^2;
sbit D1=P0^3;void ms_delay(unsigned int a)
{
unsigned int i,j;
for(i=0;i<a;i++)
{
for(j=0;j<70;j++)
{
_nop_();
}
}
}void sec_delay(unsigned int a)
{
unsigned int i,j;
for(i=0;i<a;i++)
{
for(j=0;j<1000;j++)
{
ms_delay(1);
}
}
}void lcd_cmd()
{
data=ACC;
RS=0;
RW=0;
E=1;
ms_delay(10);
E=0;
}void lcd_data()
{
data=ACC;
RS=1;
RW=0;
E=1;
ms_delay(10);
E=0;
}void lcd_initialize()
{
ACC=0x38;
lcd_cmd();
ACC=0x38;
lcd_cmd();
ACC=0x38;
lcd_cmd();
ACC=0x06;
lcd_cmd();
ACC=0x0C;
lcd_cmd();
}void lcd_puts(unsigned char *a)
{
while(*a!=’