#include<p18f4580.h>
#include<string.h>
#include<delays.h>
#pragma config WDT=OFF
#pragma config OSC=HS
#pragma config PWRT=ON
#pragma config DEBUG=OFF
#pragma config LVP=OFF
#define rs PORTBbits.RB4
#define rw PORTBbits.RB1
#define en PORTBbits.RB5
void lcddata(unsigned char D);
void lcdcmd(unsigned char D);
void main(void)
{
ADCON0=0x01;
ADCON1=0x0b;
ADCON2=0xbc;
TRISD=0;
TRISB=0;
PORTB=0;
PORTD=0;
while(1)
{
lcdcmd(0x38);
lcdcmd(0x01);
lcdcmd(0x0C);
lcdcmd(0x80);
lcddata('K');
Delay10KTCYx(225);
lcddata('A');
Delay10KTCYx(225);
lcddata('M');
Delay10KTCYx(225);
lcdcmd(0xC0);
lcddata('I');
Delay10KTCYx(225);
}
}
void lcddata(unsigned char D)
{
PORTD=D;
rs=1;
rw=0;
en=1;
Delay100TCYx(1);
en=0;
Delay100TCYx(100);
}
void lcdcmd(unsigned char D)
{
PORTD=D;
rs=0;
rw=0;
en=1;
Delay100TCYx(1);
en=0;
Delay100TCYx(100);
}
#include<string.h>
#include<delays.h>
#pragma config WDT=OFF
#pragma config OSC=HS
#pragma config PWRT=ON
#pragma config DEBUG=OFF
#pragma config LVP=OFF
#define rs PORTBbits.RB4
#define rw PORTBbits.RB1
#define en PORTBbits.RB5
void lcddata(unsigned char D);
void lcdcmd(unsigned char D);
void main(void)
{
ADCON0=0x01;
ADCON1=0x0b;
ADCON2=0xbc;
TRISD=0;
TRISB=0;
PORTB=0;
PORTD=0;
while(1)
{
lcdcmd(0x38);
lcdcmd(0x01);
lcdcmd(0x0C);
lcdcmd(0x80);
lcddata('K');
Delay10KTCYx(225);
lcddata('A');
Delay10KTCYx(225);
lcddata('M');
Delay10KTCYx(225);
lcdcmd(0xC0);
lcddata('I');
Delay10KTCYx(225);
}
}
void lcddata(unsigned char D)
{
PORTD=D;
rs=1;
rw=0;
en=1;
Delay100TCYx(1);
en=0;
Delay100TCYx(100);
}
void lcdcmd(unsigned char D)
{
PORTD=D;
rs=0;
rw=0;
en=1;
Delay100TCYx(1);
en=0;
Delay100TCYx(100);
}