abhishekdixit
Full Member level 2
hi,
i am using LPC2138 in my programming. i want to use a simple 16X2 LCD in my programming in which i want to initilize my LCD by LPC2138 micro controller. but my LCD is not working when i simulate my program on proteus. i am adding my program & connection of LCD with my controller on proteus. please help me to initilize my LCD.
Thanks.
and the simulating diagram of my project is:
View attachment New Picture.bmp
with regards,
Abhishek Dixit
i am using LPC2138 in my programming. i want to use a simple 16X2 LCD in my programming in which i want to initilize my LCD by LPC2138 micro controller. but my LCD is not working when i simulate my program on proteus. i am adding my program & connection of LCD with my controller on proteus. please help me to initilize my LCD.
Thanks.
Code:
#include <LPC213X.H>
#define RS 4
#define RW 5
#define EN 6
void lcd_cmd(unsigned char);
void lcd_data(unsigned char);
void shift(int);
void delay(int);
unsigned char array[11]="ESSEL SHYAM";
unsigned char array1[12]="WELCOMES U";
unsigned char array2[10]="booting...";
int main(void)
{
int i;
{
lcd_cmd(0x38);
delay(1000);
lcd_cmd(0x0e);
delay(1000);
lcd_cmd(0x06);
delay(1000);
lcd_cmd(0x01);
delay(1000);
while(1)
{
for(i=0;i<11;i++)
{
lcd_data(array[i]);
delay(1000);
}
lcd_cmd(0x0c0);
delay(1000);
for(i=0;i<12;i++)
{
lcd_data(array1[i]);
delay(1000);
}
lcd_cmd(0x01);
delay(1000);
for(i=0;i<10;i++)
{
lcd_data(array2[i]);
delay(1000);
}
lcd_cmd(0x0c0);
delay(1000);
for(i=0;i<16;i++)
{
lcd_data(0x0ff);
delay(2000);
}
}
}
return 0;
}
void lcd_cmd(unsigned char value)
{
IOSET0|=1<<RS;
IOCLR0|=1<<RW;
shift(value);
IOSET0|=1<<EN;
delay(1000);
IOCLR0|=1<<EN;
}
void lcd_data(unsigned char value)
{
IOCLR0|=1<<RS;
IOCLR0|=1<<RW;
shift(value);
IOSET0|=1<<EN;
delay(1000);
IOCLR0|=1<<EN;
}
void shift(int value1)
{
unsigned int j;
for(j=0;j<8;j++)
{
if(value1 & 0x01)
{
IOSET0|=1<<(j+7);
}
else
{
IOCLR0|=1<<(j+7);
}
value1=value1>>1;
}
}
void delay(int a)
{
unsigned int i,j;
for(i=0;i<a;i++);
for(j=0;j<a;j++);
}
and the simulating diagram of my project is:
View attachment New Picture.bmp
with regards,
Abhishek Dixit