22.5.4 Error Checking when Programming
Verification on user interface data is performed when accessing the century, year, month, date, day, hours, minutes, seconds and alarms. A check is performed on illegal BCD entries such as illegal date of the month with regard to the year and century configured.
If one of the time fields is not correct, the data is not loaded into the register/counter and a flag is set in the Valid Entry register (RTC_VER). The user cannot reset this flag. It is reset as soon as an acceptable value is programmed. This avoids any abnormal behavior in the system (non-BCD format read by software). The same procedure is followed for the alarm.
The following checks are performed:
- Century (check if it is 20 in Gregorian mode or 13-14 in Persian mode)
- Year (BCD entry check)
- Date (check range 01–31)
- Month (check if it is in BCD range 01–12, check validity regarding “date”)
- Day (check range 1–7)
- Hour (BCD checks: in 24-hour mode, check range 00–23 and check that AM/PM flag is not set if RTC is set in 24-hour mode; in 12-hour mode check range 01–12)
- Minute (check BCD and range 00–59)
- Second (check BCD and range 00–59)
