The RTC function adds a number of registers to the SPLat controller. These registers are used to transfer data to and from the various parts of the RTC itself, and are thus shared across a number of functions.
The registers are HH, MM, SS, DN and DM.
The HH register contains hours when the time or an event is read and the year when the date is read.
The hour is a number in the range 0-23. The year is a number in the range 0-99, representing 2000 through 2099.
The MM register contains minutes when the time or an event is read and the month when the date is read.
Minutes is a number in the range 0-59. Month is a number in the range 1-12.
The SS register contains seconds when the time or an event is read and the day of month when the date is read.
Seconds is a number in the range 0-59. Day of month is a number in the range 1-31.
The DN register contains the day of week as a number 0 to 6, where:
When the time is read the DM register is set so that just the bit that corresponds to DN is set.
| bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| value | 64 | 32 | 16 | 8 | 4 | 2 | 1 | |
| - | Sun | Sat | Fri | Thr | Wed | Tue | Mon |
For example:
DM = 8 = Thursday
When an event is read the DM register reflects the days for which the event is set. A bit set (1, True) activates the event for the corresponding day.When the date is read all bits of the DM register are set.
For example, an event set for Saturday and Sunday would be:
=> Sat = 32, Sun = 64
=> 32 + 64 = 96 (or '60 in hexadecimal)