//#include "LCD.h"
void init_port(void);
void lcd_init(void);
void cmd(unsigned char a);
void dat(unsigned char b);
void show(unsigned char *s);
void lcd_delay();
//port-F Lcd D0-D7
volatile unsigned char *lcd_data =(char *)0x31;
//port-K rs and E
volatile unsigned char *portK_E_rs =(char *)0x108;
void init_port(){
volatile unsigned char *DDR_F = (char *) 0x30;
volatile unsigned char *DDR_K = (char *) 0x107;
*DDR_F = 0xFF;
*DDR_K = 0x03;
}
void lcd_init()
{
cmd(0x38);
cmd(0x0e);
cmd(0x01);
cmd(0x06);
cmd(0x0c);
cmd(0x80);
}
void cmd(unsigned char a)
{
*lcd_data=a;
*portK_E_rs = 0x01;
lcd_delay();
*portK_E_rs = 0x00;
}
void dat(unsigned char b)
{
*lcd_data=b;
*portK_E_rs = 0x03;
lcd_delay();
*portK_E_rs = 0x00;
Serial.print(b);
}
void show(unsigned char *s)
{
while(*s != 0) {
dat(*s);
s++;
}
}
void lcd_delay()
{
volatile long d;
for(d=0;d<=6000;d++);
}
void setup() {
volatile unsigned int j;
init_port();
lcd_init();
Serial.begin(9600);
while(1) {
cmd(0x80);
show("Welcome To");
cmd(0xc0);
show(" EMBETRONICX.COM");
for(j=0; j<3000; j++);
cmd(0x01);
for(j=0; j<3000; j++);
}
}
void loop() {
// put your main code here, to run repeatedly:
}