SLAZ218P October 2012 – May 2021 MSP430F46161
RTC Module
Functional
Incorrect RTCDAY count in BCD mode
When using the RTC in BCD mode, RTCDAY will count from 0x29 to 0x31 instead of counting to 0x30 in the month of December (RTCMON=0x12). Furthermore, due to a malfunction in the leap year detection logic, RTCMON/RTCDAY may incorrectly count from 0x02/0x28 to 0x03/0x01 instead of 0x02/0x29, or it may incorrectly count from 0x02/0x28 to 0x02/0x29 instead of 0x03/0x01.
Do not operate the RTC module in BCD mode. Use the RTC in hexadecimal format mode (RTCBCD = 0) instead. Convert RTC registers to BCD on demand using software.
NOTE: The CPU instruction DADD.B/.W can be used to efficiently implement a hex to BCD conversion. An Assembly language example of such an optimized 8-bit conversion is shown below:
mov.b #8,R14 // Loop counter, process 8 bits
clr.b R12 // Result will get assembled in R12
loop rlc.b R13 // Get MSB from input variable in R13
dadd.b R12,R12
dec.b R14
jnz loop