void init_lcd(void);
void init_port(void);
void portf(char);
void portk(char);
void setlcd(void);
void writedisplay(char);
void Display(char);
void setup() {
// put your setup code here, to run once:
init_port();
init_lcd();
write_lcd("lakshmanan");
}
void write_lcd(char *ptr){
while(*ptr!=0){
writedisplay(*ptr);
ptr++;
}
}
void Delay(char a){
volatile long j;
while(a){
for(j=0;j<1000;j++);
a--;
}
}
void init_port(){
volatile char *dirf=(volatile char*)0x30;
*dirf=0xff;
volatile char *dirk=(volatile char*)0x107;
*dirk=0x03;
}
void portf(char a){
volatile char *outf=(volatile char*)0x31;
*outf=a;
}
void portk(char t){
volatile char *outk=(volatile char*)0x108;
*outk=t;
}
void setlcd(){
portk(0x01);
Delay(1);
portk(0x00);
Delay(1);
}
void init_lcd(){
portf(0x01);
setlcd();
portf(0x06);
setlcd();
portf(0x0f);
setlcd();
portf(0x38);
setlcd();
}
void writedisplay(char r){
portf(r);
portk(0x02);
Delay(1);
portk(0x03);
Delay(1);
portk(0x02);
Delay(1);
}
void loop() {
// put your main code here, to run repeatedly:
}