RP2350-Touch-LCD-2.8


Author Message
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 3144
Posted: 09:38pm 23 Oct 2025      

  Quote  It seems to be a problem with the RTC-chip implemented to the board (that mmBasic officially does not support)
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
  Quote  The command OPTION RTC AUTO ENABLE can also be used to set an automatic update of the TIME$ and DATE$ read only variables from the real time clock chip on boot and every hour.
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