ds1302
The DS1302 will not correct data that is written to its registers; it has certain ranges, for example for months (0-30, 0-31, 0-28 or 0-29 with leap year correction) and some bits in registers are just 0, so you can not wite a 1 to them ..
But, this will not prevent attempts of writing wrong numbers ..
This has to be done in your software ..
One option in writing DATE, for example, is to star with YEAR then MONTH and then DAY ..
As soon as you type as MONTH --> 02=FEB allow only 2 for tens of days and then 8 or 9, depending on the year.
For that you can use LeapYears_LookUpTable (00h, 04h, 08h , ....)
For other months use Months_LookUpTable (31h, 28h, 31h, 30h, ...) and verify, or not allow wrong numbers ..
Regards,
IanP