Touch not working on WaveShare RP2350-Touch-LCD-3.5-C module


Author Message
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 3268
Posted: 10:27pm 28 Apr 2026      

  Quote   I’m going to try getting the RTC working next.  It’s a PCF85063 rather than a PCF8563 that is listed in the User Manual.

You may be able to adapt this Sub for a PCF85063A. It reads the values of Date$ and Time$ and loads them into the RTC.
Your LIST SYSTEM I2C shows the RTC is at address &H51 which this sub is also uses so it might work without modification, however it was written from the datasheet but not tested on an actual PCF85063A.
If you need to modify it RTCs use binary coded decimal, 2 digits per byte, for the date and time values.

Sub PCF85063A.Set 'Set Date$ and Time$ first then call PCF85063A.Set to set the RTC
  Local T$=Time$+" "+Date$ ' "hh:mm:ss dd-mm-20yy"
  Local integer dt(7), n
  dt(0)=4 : dt(1)=Val(Mid$(T$,7,2)) : dt(2)=Val(Mid$(T$,4,2)) : dt(3)=Val(Left$(T$,2))
  dt(4)=Val(Mid$(T$,10,2)) : dt(5)=0 : dt(6)=Val(Mid$(T$,13,2)) : dt(7)=Val(Right$(T$,2))
  'Start at register address 4, seconds, minutes, hours, day, DoW=0, month, year (2 digit)
  For n = 1 To 7 : dt(n) = (dt(n)\10 << 4)+(dt(n) Mod 10) : Next 'convert integer bytes to BCD
  I2C WRITE &H51,0,8,dt() 'send data to RTC
  Print "PCF85063A RTC time and date have been set to "+T$ ' : Math v_print dt()
End Sub

It's from this thread
At the end of the thread @Arne has provided his Set and Get programs for the PCF85063A.

In the manual Apendix B, I2C Communication, Examples, there is a program to read the time from a PCF8563.
It could be adapted by changing:-
I2C2 WRITE &H51, 0, 1, 3
to
I2C2 WRITE &H51, 0, 1, 5

Adding seconds and date.
DIM AS INTEGER RData(6) ' this will hold received data
'SETPIN GP6, GP7, I2C2 ' assign the I/O pins for I2C2 - skip for SYSTEM I2C
'I2C2 OPEN 100, 1000 ' open the I2C channel - skip for SYSTEM I2C
I2C2 WRITE &H51, 0, 1, 4 ' set the first register to 4
I2C2 READ &H51, 0, 7, RData() ' read 7 registers
'I2C2 CLOSE ' close the I2C channel - skip for SYSTEM I2C
PRINT "Time is " hex$(RData(2),2) ":" hex$(RData(1),2) ":" hex$(RData(0),2) 'display the BCD coded data
PRINT "Date is " hex$(RData(3),2) "-" hex$(RData(5),2) "-20" hex$(RData(6),2) 'display the BCD coded data

Edited 2026-04-30 11:05 by phil99