#include<htc.h>
#include<string.h>
#define rs RC0
#define en RC1
#define rw RC2
void intlcd();
void lcd_cmd(int cmd);
void lcddisp(char z);
void delay(int s);
void delay(int s)
{
while(s--);
}
void intlcd()
{
lcd_cmd(0x38);
lcd_cmd(0x01);
lcd_cmd(0x0E);
lcd_cmd(0x80);
lcd_cmd(0x06);
}
void lcddisp(char z)
{
rs=1;
rw=0;
PORTD=z;
en=1;
delay(100);
en=0;
}
void lcd_cmd(int cmd)
{
rw=0;
rs=0;
en=1;
PORTD=cmd;
delay(100);
en=0;
}
void main()
{
TRISD=0X00;
TRISC=0X00;
intlcd();
int i;
char str[]={"LCD IN PIC"};
for(i=0;i<=11;i++)
{
lcddisp(str[i]);
lcd_cmd(0x06);
}
delay(1500);
while(1)
{
}
}
#include<string.h>
#define rs RC0
#define en RC1
#define rw RC2
void intlcd();
void lcd_cmd(int cmd);
void lcddisp(char z);
void delay(int s);
void delay(int s)
{
while(s--);
}
void intlcd()
{
lcd_cmd(0x38);
lcd_cmd(0x01);
lcd_cmd(0x0E);
lcd_cmd(0x80);
lcd_cmd(0x06);
}
void lcddisp(char z)
{
rs=1;
rw=0;
PORTD=z;
en=1;
delay(100);
en=0;
}
void lcd_cmd(int cmd)
{
rw=0;
rs=0;
en=1;
PORTD=cmd;
delay(100);
en=0;
}
void main()
{
TRISD=0X00;
TRISC=0X00;
intlcd();
int i;
char str[]={"LCD IN PIC"};
for(i=0;i<=11;i++)
{
lcddisp(str[i]);
lcd_cmd(0x06);
}
delay(1500);
while(1)
{
}
}
No comments:
Post a Comment