0% found this document useful (0 votes)
5 views1 page

Display 'Welcome' on LCD with Code

This code displays the string "WELCOME" on an LCD screen. It initializes the LCD, sets the cursor position, then uses a while loop to send each character in the string to the LCD data port. It includes functions to initialize the LCD, send commands, send character data, and delay between operations.

Uploaded by

Rohit Kshirsagar
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views1 page

Display 'Welcome' on LCD with Code

This code displays the string "WELCOME" on an LCD screen. It initializes the LCD, sets the cursor position, then uses a while loop to send each character in the string to the LCD data port. It includes functions to initialize the LCD, send commands, send character data, and delay between operations.

Uploaded by

Rohit Kshirsagar
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

TO DISPLAY WELCOME STRING ON LCD

#include<lpc21xx.h>
void main(void)
{
char str[10] = "WELCOME";
int i = 0;
lcd_init();
delay();
lcd_cmd(0x80);
delay();
while(str[i]!='\0')
{
lcd_data(str[i]);
i ++;
}
delay();
}
void lcd_init(void)
{
IODIR1 = 0x00FF0000;
IODIR0 = (1 << 11)|(1 << 12);
lcd_cmd(0x38);
lcd_cmd(0x0c);
lcd_cmd(0x06);
lcd_cmd(0x01);
}
void lcd_cmd (int cmd)
{
IOCLR0 = 0x800;
IOCLR1 = 0x00FF0000;
IOSET1 = cmd << 16;
IOSET0 = 0x01000;
delay();
IOCLR0 = 0x01000;
delay();
}
void lcd_data (int data)
{
IOSET0=0x0800;
IOCLR1=0x0FF0000;
IOSET1=data<<16;
IOSET0=0x01000;
delay();
IOCLR0=0x01000;
delay();
}
void delay(void)
{
unsigned int i;
for (i=0;i<65535;i++);
}

//P1.16-P1.23 as output
//RS, EN as output

// clear RS

// set RS

You might also like