Tony STArk
New Member
C:
#include<pic.h>
#define rs RC0
#define rw RC1
#define en RC2
void delay();
void lcd1();
void cmd(unsigned char a);
void data(unsigned char b);
void lcd1() //Function to prepare the LCD and get it ready
{
cmd(0x38); // for using 2 lines and 5X7 matrix of LCD
cmd(0x0F); // turn display ON, cursor blinking
cmd(0x01); //clear scree
cmd(0x81); // bring cursor to position 1 of line 1
}
void cmd(unsigned char a) //Function to send command instruction to LCD
{
PORTB = a;
rs= 0;
rw=0;
en=1;
delay();
en=0;
}
void data(unsigned char b) //Function to send display data to LCD
{
PORTB = b;
rs= 1;
rw=0;
en=1;
delay();
en=0;
}
void delay()
{
int i;
for( i=0;i<=1000;i++);
}
void main()
{
TRISB=0x00;
TRISC=0x00;
char c[]="JARVIS";
lcd1();
int d=0;
while(c[d]=='\0')
{
data(c[d]);
d++;
}
}
Last edited by a moderator: