Posted: 09:38pm 23 Oct 2025 Copy link to clipboard
phil99 Guru
The issue may not only be writing the year to the RTC but also reading it back with RTC GETTIME if it is using different registers to the regular RTCs.
I guess there are a number of ways forward. 1) As the months and days appear ok the easiest and crudest method is to substitute the correct year at bootup with something like:-
Sub MM.STARTUP RTC GETTIME Date$ = Left$(Date$,6) + "2025" End Sub
So to avoid the year being overwritten don't use OPTION RTC AUTO ENABLE.
2) The Waveshare example programs presumably manage to set the PCF85063A RTC correctly so see if you can convert that section to MMBasic Subs for writing and reading the chip.
3) From the PCF85063A datasheet create your own RTC Subs.
4) If enough people use this chip perhaps it can be added to the firmware.
Edit. Haven't got a PCF85063A but have been having a play with a DS3231 to see if there is a simple way to set and read the year. This might work for the PCF85063A
RTC SetReg &H0A, &H25 'first nibble is BCD decade, second is BCD year
Sub MM.STARTUP Local year% RTC GETTIME RTC GetReg &H0A, year% 'read the year register year% = (year%>>4)*10 + (year% and 7) 'convert BCD nibbles to decimal Date$ = Left$(Date$,8) + Str$(year%) 'add the year to the date. End Sub
The DS3231 test. change the register address from &h06 to &h0A to try on the PCF85063A
> Dim year%, newYear% > newYear%=&h42 : RTC SetReg &H06, newYear% 'set year to 2042 > RTC GetReg &H06, year% : year% = (year%>>4)*10 + (year% and 7) : date$ = Left$(Date$,8) + Str$(year%) > ? date$ 24-10-2042 >
Edited 2025-10-24 12:55 by phil99
Footnote added 2025-10-26 17:46 by phil99 Red Face Time! Did not test long enough, replace BCD to decimal converter with this.
year% = (year%>>4)*10 + (year% and 15) 'convert BCD nibbles to decimal
Posted: 06:57am 24 Oct 2025 Copy link to clipboard
Mixtel90 Guru
It wouldn't be so bad if there was a good reason to use that particular RTC chip other than cost. :( It's not as if you can rely on its accuracy. Setting the year seems to be a bit superfluous on a chip that will need to be corrected monthly (if you're lucky).