This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Question

Dear Shyam , Hello.

Can you explain me about Read_RTC function ?

Parents
  • oh oh....
    I'm so sorry , i forgot to click on REPLAY button !

    somebody wrote this function to read data from RTC unit :

    RTC Read_RTC(void)
    { RTC Local_time; Local_time.RTC_Sec = ((RTC_CTIME0 & 0x0000003F)>>0); rtcdata = ((RTC_CTIME0 & 0x0000003F)>>0);
    // Minute value [0-59] Local_time.RTC_Min = ((RTC_CTIME0 & 0x00003F00)>>8);
    // Hour value [0-23] Local_time.RTC_Hour = ((RTC_CTIME0 & 0x001F0000)>>16);
    // Day of week value [0-6] Local_time.RTC_Wday = ((RTC_CTIME0 & 0x07000000)>>24) ;
    // Day of month value [1-31] Local_time.RTC_Mday = ((RTC_CTIME1 & 0x0000001F)>>0);
    // Month value [1-12] Local_time.RTC_Mon = ((RTC_CTIME1 & 0x0000FF00)>>8);
    // Year value Local_time.RTC_Year = ((RTC_CTIME1 & 0x0FFF0000)>>16);
    // Day of year value [1-365] Local_time.RTC_Yday = RTC_DOY; RTC_CCR |= 0x01; return (Local_time);
    }

    it's working , and my question is about this statment : RTC_CTIME0 & 0x00003F00)>>8

    give me a favor : please write your answer simple.
    thanks.

Reply
  • oh oh....
    I'm so sorry , i forgot to click on REPLAY button !

    somebody wrote this function to read data from RTC unit :

    RTC Read_RTC(void)
    { RTC Local_time; Local_time.RTC_Sec = ((RTC_CTIME0 & 0x0000003F)>>0); rtcdata = ((RTC_CTIME0 & 0x0000003F)>>0);
    // Minute value [0-59] Local_time.RTC_Min = ((RTC_CTIME0 & 0x00003F00)>>8);
    // Hour value [0-23] Local_time.RTC_Hour = ((RTC_CTIME0 & 0x001F0000)>>16);
    // Day of week value [0-6] Local_time.RTC_Wday = ((RTC_CTIME0 & 0x07000000)>>24) ;
    // Day of month value [1-31] Local_time.RTC_Mday = ((RTC_CTIME1 & 0x0000001F)>>0);
    // Month value [1-12] Local_time.RTC_Mon = ((RTC_CTIME1 & 0x0000FF00)>>8);
    // Year value Local_time.RTC_Year = ((RTC_CTIME1 & 0x0FFF0000)>>16);
    // Day of year value [1-365] Local_time.RTC_Yday = RTC_DOY; RTC_CCR |= 0x01; return (Local_time);
    }

    it's working , and my question is about this statment : RTC_CTIME0 & 0x00003F00)>>8

    give me a favor : please write your answer simple.
    thanks.

Children
No data