how to read from i2c bus a rtcc PCF8523

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times

how to read from i2c bus a rtcc PCF8523

Post by stefan.erni »

how to read the time from RTCC PCF8523 with i2c-bus (NXP8523)

I know the adress for reading (D1) and writing (D0) from the IC and I know the Register for seconds 0x04

But there is addrH and addrL
and some start and stop and acknowledge
hmm I need a litle help
bus_read.PNG
(25.1 KiB) Downloaded 2481 times
fc7_maske.PNG
(13.1 KiB) Downloaded 2481 times

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times

Re: how to read from i2c bus a rtcc PCF8523

Post by LeighM »

Ignoring any checks for Slave Ack/Nak, you would need the following:

Code: Select all

Initialise()
Start()
TransmitByte(0xD0)
TransmitByte(0x04)
Stop()
Start()
TransmitByte(0xD1)
data = ReceiveByte(1) // 1 = Last byte, no more requested
Stop()

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times

Re: how to read from i2c bus a rtcc PCF8523

Post by stefan.erni »

Hi Leigh

Sometimes life is easy...

Thank you for the help. This way it's working fine.

Post Reply