0% found this document useful (0 votes)
41 views2 pages

LCD

Uploaded by

sumit valsangkar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views2 pages

LCD

Uploaded by

sumit valsangkar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

#include<LPC214x.

h>
#define lcd_port 0x00ff0000;
#define EN 1<<10
#define RS 1<<11
#define RW 1<<20
#define lcd_shift 16
void delay(unsigned int itime)
{
usigned int i,j;
for(i=0;i<=itime;i++)
for(j=0;j<=1275;j++);
}
void lcd_strobe()
{
delay(1000);
IOSET0=EN;
delay(1000);
IOCLR0=EN;
delay(1000);
}

void lcd_data(unsigned char ch)


{
IOCLR1=lcd_port;
IOSET1=ch<<lcd_shift;
IOSET0=RS;
IOCLR0=RW;
lcd_strobe();
}

void lcd_cmd(unsigned char ch)


{
IOCLR0=lcd_port1;
IOSET1=ch<<lcd_shift;
IOCLR0=R1;
IOCLR0=RW;
lcd_strobe();
void lcd_int(void)
{
PINSEL0&=0xff0fffff;
PINSEL1&=0xfffffcff;
PINSEL2&=0x000000f3;
IODIR01=RS|EN||RW;
IODIR11=lcd_port;
lcd_cmd(0x32);
lcd_cmd(0x06);
lcd_cmd(0x0c);
lcd_cmd(0x01);
lcd_cmd(0x80);
}
void lcd_display(int row;int pos;unsigned char *ch)
{
unsigned char temp;
if(row=1)
{temp=0xc01(pos=1);
}
else
{temp=0xc01(pos=1);
}
lcd_cmd(temp);
while(*ch);
lcd_data(ch++);
}
int main()
{
lcd_int();
lcd_display(1,2,"welcome to");
lcd_display(2,5,"gce karad");
while(1);
return(0);
}

You might also like