saidutt
Member level 2
hi,
i am new to ARM .
i have t o interface to LCD with LPC2129.
i have written the code. LCD is not displaying.
please help me out
thank you
i am new to ARM .
i have t o interface to LCD with LPC2129.
i have written the code. LCD is not displaying.
Code:
#include<lpc21xx.h>
unsigned int rs=0x00000010;
unsigned int rw=0x00000020;
unsigned int e=0x00000040;
void MSDelay(unsigned int itime) //delay function
{
unsigned int i,j;
for(i=0;i<itime;i++)
for(j=0x00;j<0x00FFFFF;j++);
}
void lcd_cmd(unsigned int d)
{
IOPIN1=d;
IOSET1=d;
IOCLR0=rs;
IOCLR0=rw;
IOSET0=e;
MSDelay(1);
IOCLR0=e;
}
void lcd_data(unsigned int d)
{
d<<=16;
IOPIN1=d;
IOSET1=d;
IOSET0=rs;
IOCLR0=rw;
IOSET0=e;
MSDelay(1);
IOCLR0=e;
}
void lcd_init()
{
lcd_cmd(0x00300000);
// MSDelay(25);
lcd_cmd(0x000C0000);
// MSDelay(25);
lcd_cmd(0x00060000);
// MSDelay(25);
lcd_cmd(0x000E0000);
// MSDelay(25);
lcd_cmd(0x00800000);
// MSDelay(25);
}
int main(void)
{
PINSEL0&=0xFFFFFF00;
PINSEL2&=0x00000000;
IODIR0&=0xFFFFFFFF;
IODIR1&=0xFFFF0000;
{
lcd_init();
lcd_data('a');
MSDelay(1);
// lcd_cmd(0x00060000);
lcd_data('s');
MSDelay(1);
// lcd_cmd(0x00060000);
lcd_data('i');
MSDelay(1);
// lcd_cmd(0x00060000);
}
while(1);
return 0;
}
please help me out
thank you