#include <io.h>

#include <delay.h>


#define RS PORTD.5

#define RW PORTD.6

#define LCD_EN PORTD.7

#define LCD_DATA PORTC 


#define OFF 0

#define ON  1


interrupt [TIM1_COMPA] void timer1_isr(void);


unsigned int year;

unsigned char month, date, second, minute, hour;


void LCD_comm(char c);

void LCD_data(char c); 

void LCD_position(unsigned char row, unsigned char col);

void LCD_initialize(void);

void LCD_cursor(unsigned char cur);

void CGRAM_write(void);

void CGRAM_LCD_display(void);

void CAL_LCD_display(void);

unsigned char Leap_month(void);


void main(void){

    

    year = 3000;

    month = 2;

    date = 28;

    hour = 23;

    minute = 59;

    second = 58;


    TCCR1A = 0x00; //CTC mode(4), don't output OC1A

    TCCR1B = 0x0C; //16Mhz/256/62500 = 1Hz  0000 1100

    TCCR1C = 0x00;

    OCR1A = 62500 - 1;

    TIMSK = 0x10; //TIMSK = 1 << OCIE1A; //enable OC1A interrupt

    

    #asm("sei"); //enable global interrupt

    

    DDRD = 0xE0; // LCD RS : PD.5, R/W : PD.6, EN : PD.7

    DDRC = 0xFF; // LCD DATA : PC 

    

    LCD_initialize(); //LCD 초기화 

    

    CGRAM_write(); //년, 월, 일, 시, 분, 초 폰트 생성(고정된 값)

    

    CGRAM_LCD_display();  //년, 월, 일, 시, 분, 초 LCD 표시

    

    CAL_LCD_display();  //시간 LCD 출력(2014 12 31 / 23 59 55)

    

    while(1){

        

    }   

}


interrupt [TIM1_COMPA] void timer1_isr(void){

    second++;

    if(second == 60){

        second = 0;

        minute++;

        if(minute == 60){

            minute = 0;

            hour++;

            if(hour == 24){

                hour = 0; 

                if(date == 28 && month == 2 && !Leap_month()){

                    date = 1;

                    month++;}

                else if(date == 29 && month == 2 && Leap_month()){

                    date = 1;

                    month++;

                    }

                else if(date == 30 && (month == 4 || month == 6 || month == 9 || month == 11)){

                    date = 1;

                    month++; }

                else if(date == 31 && (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10)) {

                    date = 1;

                    month++; }

                else if(date == 31 && month == 12) {

                    date = 1;

                    month = 1;

                    year++; }  

                else date++;                     

            }                             

        }

    } 

    CAL_LCD_display();

void LCD_initialize(void){

    delay_ms(20);

    

    LCD_comm(0x38);

    delay_ms(5);

    

    LCD_comm(0x38);

    delay_us(150);

    

    LCD_comm(0x38);

    delay_us(150);

    

    LCD_comm(0x0e); //화면 ON

    delay_us(50);

    

    LCD_comm(0x01); //화면 초기화

    delay_ms(2);

    

    LCD_comm(0x06); //엔트리 모드

    delay_us(50);

}

void CGRAM_write(void){

    unsigned char i; 

    unsigned char yr[8]={0x11,0x13,0x13,0x1D,0x00,0x08,0x0F,0};

    unsigned char mon[8]={0x08,0x01,0x1D,0x0B,0x01,0x0C,0x06,0};

    unsigned char dat[8]={0x01,0x09,0x15,0x09,0x01,0x0C,0x06,0};

    unsigned char hr[8]={0x01,0x09,0x09,0x09,0x15,0x15,0x01,0};

    unsigned char min[8]={0x0A,0x0E,0x0E,0x1F,0x04,0x08,0x0F,0};

    unsigned char sec[8]={0x04,0x1F,0x0A,0x11,0x04,0x04,0x1F,0}; 

    

    LCD_comm(0x40); 

    for (i=0;i<8;i++) {

        LCD_data(yr[i]);

    };

    for (i=0;i<8;i++) {

        LCD_data(mon[i]);

    };

    for (i=0;i<8;i++) {

        LCD_data(dat[i]);

    };

    for (i=0;i<8;i++) {

        LCD_data(hr[i]);

    };

    for (i=0;i<8;i++) {

        LCD_data(min[i]);

    };

    for (i=0;i<8;i++) {

        LCD_data(sec[i]);

    };

}

void CGRAM_LCD_display(void){

    LCD_comm(0x80);

    LCD_position(0,5);

    LCD_data(0); //년

    

    LCD_position(0,9);

    LCD_data(1); //월

    

    LCD_position(0,13);

    LCD_data(2); //일 

    

    LCD_position(1,4);

    LCD_data(3); //시


    LCD_position(1,8);

    LCD_data(4); //분

    

    LCD_position(1,12);

    LCD_data(5); //초 

}

void CAL_LCD_display(void){ //달력 LCD 표시 

    LCD_position(0,1);

    LCD_data(year/1000 + '0'); //'~년' 천의자리

    LCD_data(year00/100 + '0'); //'~년' 백의자리

    LCD_data(year0/10 + '0'); //'~년' 십의자리

    LCD_data(year + '0'); //'~년' 일의자리

        

    LCD_position(0,7);

    LCD_data(month/10 + '0'); //'~월' 십의자리

    LCD_data(month + '0'); //'~월' 일의자리 

        

    LCD_position(0,11);

    LCD_data(date/10 + '0'); //'~일' 십의자리

    LCD_data(date + '0'); //'~일' 일의자리

        

    LCD_position(1,2);

    LCD_data(hour/10 + '0'); //'~시' 십의자리

    LCD_data(hour + '0'); //'~시' 일의자리

        

    LCD_position(1,6);

    LCD_data(minute/10 + '0'); //'~분' 십의자리

    LCD_data(minute + '0'); //'~분' 일의자리

        

    LCD_position(1,10);

    LCD_data(second/10 + '0'); //'~초' 십의자리

    LCD_data(second + '0'); //'~초' 일의자리 

    

    LCD_cursor(OFF);            //커서 off

}

void LCD_data(char c){

    RS = 1;

    RW = 0;

    

    LCD_EN = 1;

    delay_us(50);

    

    LCD_>

&nbsp   delay_us(50);

    

    LCD_EN = 0;

}

void LCD_comm(char c){

    RS = 0;

    RW = 0;

    

    LCD_EN = 1;

    delay_us(50); //지연시간

    

    LCD_>

    delay_us(50);

    

    LCD_EN = 0; 

}

void LCD_position(unsigned char row, unsigned char col){

    LCD_comm(0x80|(row*0x40 + col));  

}

void LCD_cursor(unsigned char cur){

   if(cur == 0)

   LCD_comm(0x0c); 

   else 

   LCD_comm(0x0e);

   delay_us(50);

}

unsigned char Leap_month(void){

    unsigned char LM;

    if((year % 400 == 0) || (( year0 != 0 ) && (year %4 == 0)))

        LM = 1;

    else LM = 0;   

    return LM;

}







lcd로 날짜시간표시하는 프로그램인데



recipe for target 'main.o' failed

io.h: no such file or directory


이런 에러가 떠요


고쳐주시면 1칰...제발..