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

MC Lab 8

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

MC Lab 8

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

CODE:

#include <p18f4550.h> LCD_command(0x38);


#include "vector_relocate.h" msdelay(15);
#define LCD_DATA PORTD LCD_command(0x01);
#define ctrl PORTE msdelay(15);
#define rs PORTEbits.RE0 LCD_command(0x0C);
#define rw PORTEbits.RE1 msdelay(15);
#define en PORTEbits.RE2 LCD_command(0x80);
void init_LCD(void); msdelay(15);
void LCD_command(unsigned char cmd); }
void LCD_data(unsigned char data); void LCD_command(unsigned char cmd)
void LCD_write_string(static char *str); { LCD_DATA = cmd;
void msdelay (unsigned int time); rs = 0;
void main(void) rw = 0;
{ char var1[] = " Wel-Come"; en = 1;
char var2[] = "Smart Logic Tech"; msdelay(15);
ADCON1 = 0x0F; en = 0;
TRISD = 0x00; }
TRISE = 0x00; void LCD_data(unsigned char data)
init_LCD(); { LCD_DATA = data;
msdelay(50); rs = 1;
LCD_write_string(var1); rw = 0;
msdelay(15); en = 1;
LCD_command(0xC0); msdelay(15);
LCD_write_string(var2); en = 0;
while (1); }
} void LCD_write_string(static char *str)
void msdelay (unsigned int time) { int i = 0;
{ while (str[i] != 0)
unsigned int i, j; {
for (i = 0; i < time; i++) LCD_data(str[i]);
for (j = 0; j < 710; j++); msdelay(15);
i++;
}
void init_LCD(void) }
{

You might also like