sec and minutes both vary from decimal 0 to 59 and bcd 0x00 to 0x59. Then why is the formula for sec and time bcd to decimal transformation is different?
For seconds it is *sec = ((*sec & 0x70 ) >> 4)*10 + (*sec & 0x0F);
For minutes it is *min = ((*min & 0xF0 ) >> 4)*10 + (*min & 0x0F);
1. Don't start multiple therads on the same topic.
2. The necessity of masking out some RTC register bits (e.g. seconds.bit7) becomes obvious if you read the datasheet.