Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
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:
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);