#include <stdio.h>
#include <stdlib.h>
#include <p18f26k22.h>
#include <delays.h>
#include <string.h>
#include "oscillator.h"
#define RS LATBbits.LATB0
#define RW LATBbits.LATB1
#define E LATBbits.LATB2
#define lcd PORTC
void data(char *value1);
void cmd(unsigned short);
void main()
{
set_freq(f8Mhz); // 8Mhz frequency Set.
ANSELB=0;
TRISB=0;
ANSELC=0;
TRISC=0;
Delay100TCYx(100); //5ms delay
cmd(0x38);
cmd(0x0C);
cmd(0x01);
cmd(0x06);
cmd(0x80);
data("Hello");
while(1);
}
void cmd(unsigned short value)
{
lcd = value;
RS=0;
RW=0;
E=1;
Delay10TCYx(2); //10us delay
E=0;
Delay100TCYx(20); //1ms delay
}
void data(char *value1)
{
unsigned short i;
for(i=0;i<strlen(value1);i++)
{
lcd = value1[i];
RS=1;
RW=0;
E=1;
Delay10TCYx(2); //10us delay
E=0;
Delay100TCYx(20); //1ms delay
}
}