Microcontroller › AVR › problem regarding interfacing LCD using ATMEGA16 code by CHINMAY CHINARA
- This topic has 4 replies, 4 voices, and was last updated 11 years, 5 months ago by Sagar.
July 11, 2011 at 5:45 am #1067queryParticipant
I am using the JHD162A LCD and based on the tutorial code.The connections are made as per the tutorial circuit diagram. But instead of showing an ‘A’ on the screen what I see is the backlit display is on and the first line of the screen is filled with black squares. Even if I increase or decrease the contrast pot only the black sqares become dark or light and no other output is obtained. Kindly help me out with it.July 23, 2011 at 6:15 am #6503dagakshayParticipant
this sounds some loose connection problem…December 5, 2011 at 5:10 pm #6910TuhinParticipant
You have made a worng connection. Just see the back sibe of LCD and conform which pin is no1. and so on. Then connect it. I myself suffered from this problem.I’m giving you the pin configration of LCD you connect it as per your requirment.
2.VDD(5V or 3V)
Just see the backside of lcd and make sure your connection is right or not.December 6, 2011 at 9:40 am #6912SagarParticipant
m having same problem with JHD162A ATmega16
heres the code…
//#define F_CPU 16000000
#define lcd_data PORTB
void lcdbusy() //function to monitor d7th bit (busy flag)
DDRB=0x7f;// this will make msb of portb to input
PORTD=0xfe;// rs=0 rw=1 en=1, rw=1->read from lcd
while(PINB>>7) //move the msb to lsb
PORTD |=0x04; //en-> from low to high
PORTD &=0xfb; //en-> from high to low
DDRB=0xff;//make PORTB for output
DDRD=0xff; //PORTD as output
DDRB=0xff; //portb as output
lcd_data=0x38; //8 bit,5×7 dots
PORTD=0xfc; //rs=0 rw=0 en=1, 0xfc where c=1100
PORTD=0xf8; //rs=0 rw=0 en=0, 0xf8 where 8=1000, frm en->high to low
lcdbusy(); // w8 b4 executing next command
lcd_data=0x0f; //cursor blinking display on
lcd_data=0x01; // clear lcd
lcd_data=0x06; //entry mode
void lcdcmd(unsigned char ch)
void lcdchar(unsigned char ch)
PORTD=0xfd; // 0xfd where d=1101 rs=w rw=0 en=1
PORTD=0xf9; //9=1001 rs=1 rw=0 en=0, en-> from high to low
void lcdstring(char *str)
lcdcmd(0x80);// move cursor to 1st line 1st column
lcdstring(“Welcome ATmega16 !”);
m i missing something ?December 6, 2011 at 1:34 pm #6913SagarParticipant
hey guys solved my problem…. !
this is wat i did.
added little delay betwn two instruction of enable pin.
@query : add _delay_ms(1); after each high to low pulse for enable pin.
surely this will work for you.
- You must be logged in to reply to this topic.