Interface lcd with pic16f877a microcontroller

Status
Not open for further replies.

svinoth86

Newbie level 6
Joined
Nov 13, 2010
Messages
12
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,420
how to Interface lcd with pic16f877a microcontroller?

---------- Post added at 13:47 ---------- Previous post was at 13:46 ----------

#include<htc.h>
#define rs RC0
#define rw RC1
#define en RC2
delay(unsigned char d)
{
while(d--);
}
lcd_data(unsigned char c)
{
PORTD=c;
rs=1;
rw=0;
en=1;
delay(50);
en=0;
}

lcd_cmd(unsigned char c)
{
PORTD=c;
rs=0;
rw=0;
en=1;
delay(50);
en=0;
}
lcd_str(unsigned char *s)
{
while(*s)
{
lcd_data(*s);
s++;
}
}

lcd_init()
{
lcd_cmd(0x38);
lcd_cmd(0x0c);
lcd_cmd(0x80);

}
void main()
{
TRISC=0x00;
PORTC=0x00;
TRISD=0x00;
PORTD=0x00;
lcd_init();
//lcd_data('a');
lcd_str(" PIC ");
lcd_cmd(0xc0);
lcd_str(" 16F877A ");
while(1);

}
 

**broken link removed**
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…