void initport()
{
volatile char *dirf,*dirk;
dirf=0x30;
*dirf=0xFF;
dirk=0x107;
*dirk=0x03;
}
void outputf(char data)
{
volatile char *outf;
outf=0x31;
*outf=data;
}
void outputk(char data2)
{
volatile char *outk;
outk=0x108;
*outk=data2;
}
void enable_pulse()
{
outputk(0x01);
delayMicroseconds(1000);
outputk(0x00);
delayMicroseconds(1000);
}
void LCD_setup()
{
outputf(0x38);//function mode set DL=8,n=2;font=5X8
enable_pulse();
outputf(0x0C);//no cursor,display on,no cursor blink
enable_pulse();
}
void write_lcd(unsigned char data3)
{
outputf(data3);
outputk(0x02);//RS is high
delayMicroseconds(100);
outputk(0x01);//en is high
delayMicroseconds(100);
outputk(0x02);//en is low
}
void clear_disp()
{
outputf(0x01);
enable_pulse();
}
void DRAM_address(unsigned char data4)
{
outputf(data4);
enable_pulse();
}
/*void string1(unsigned char *ptr)
{
while(*ptr !='\0')
{
write_lcd(*ptr);
ptr++;
}
}
void entrymode(unsigned char data5)
{
outputk(0x00);
outputf(data5);
enable_pulse();
}*/
void setup() {
// put your setup code here, to run once:
initport();
LCD_setup();
DRAM_address(0x89);
write_lcd('h');
delay(1000);
write_lcd('e');
delay(1000);
}
void loop() {
// put your main code here, to run repeatedly:
}