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
  • You want to know the meaning of:

    RTC_CTIME0 & 0x00003F00)>>8
    

    Did you notice the full text:

    // Minute value [0-59] Local_time.RTC_Min = ((RTC_CTIME0 & 0x00003F00)>>8);
    


    A value 0..59 requires 6 bits of storage (0..63).
    The comment claims that the minutes (0..59) are stored in 6 bits in the second byte of RTC_CTIME0, which is the reason it extracts the 6 bits and then shifts the result down 8 bits since the low-order byte did contain the seconds part of the time.

    By the way - if you selected to create a new thread instead of replying to an existing, then now would be a good time to post a message containing a link to the original thread. Remember that other people who find this thread will not know what original thread you did read.

Reply
  • You want to know the meaning of:

    RTC_CTIME0 & 0x00003F00)>>8
    

    Did you notice the full text:

    // Minute value [0-59] Local_time.RTC_Min = ((RTC_CTIME0 & 0x00003F00)>>8);
    


    A value 0..59 requires 6 bits of storage (0..63).
    The comment claims that the minutes (0..59) are stored in 6 bits in the second byte of RTC_CTIME0, which is the reason it extracts the 6 bits and then shifts the result down 8 bits since the low-order byte did contain the seconds part of the time.

    By the way - if you selected to create a new thread instead of replying to an existing, then now would be a good time to post a message containing a link to the original thread. Remember that other people who find this thread will not know what original thread you did read.

Children