void LCD_data(unsigned char data )
{
volatile char* portf_dir=(volatile char*)0x30;
volatile char* portk_dir=(volatile char*)0x107;
volatile char* portf_data=(volatile char*)0x31;
volatile char* portk_data=(volatile char*)0x108;
*portf_dir=0xff;
*portk_dir=0x03;
*portf_data=data;
*portk_data=0x02;
*portk_data=0x01;
delay(1);
*portk_data=0x00;
}
void LCD_cmd(unsigned char data)
{
volatile char* portf_dir=(volatile char*)0x30;
volatile char* portk_dir=(volatile char*)0x107;
volatile char* portf_data=(volatile char*)0x31;
volatile char* portk_data=(volatile char*)0x108;
*portf_dir=0xff;
*portk_dir=0x03;
*portf_data=data;
*portk_data=0x00;
*portk_data=0x01;
delay(1);
*portk_data=0x00;
}
void LCD_string(char *ptr,char length)
{
for(volatile char i=0;i<length;i++)
{
LCD_data(ptr[i]);
}
}
void LCD_init()
{
LCD_cmd(0x38);
LCD_cmd(0x0f);
LCD_cmd(0x06);
LCD_cmd(0x01);
LCD_cmd(0x83);
}
void setup()
{
LCD_init();
LCD_string("Welcome To",10);
LCD_cmd(0xc1);
LCD_string("ECEN Academy",12);
}
void loop()
{
}