9 years, 1 month ago.

how i set an read year

Hi, i want to know how to set and read year, thanks.

Question relating to:

A library to read/write the various registers of the PCF8583 Real Time Clock/Calendar including the 240 bytes of non-volatile ram. Includes a printf like date/time formatting routine. I2C, PCF8583, RTC

1 Answer

9 years, 1 month ago.

Hi Pedro,

You set the date parts (day, month, year, century) using the Date_t structure within a DateTime_t and using the call write(TIME, DateTime_t dti); To read the date and time use the "read()" cal which returns a DateTime_t. See the PCF8583_rtc.h file.

e.g. Read Date and Time

struct DateTime_t dtr;

dtr = rtc.read(TIME); i2c.write(ADDR_8574_1, &dtr.time.hours, 1); i2c.write(ADDR_8574_1, &dtr.date.year, 1);

Set Date and Time dtr.date.year = 15; rtc.write(TIME, dtr);