RTC API Methods | Cypress Semiconductor
RTC API Methods
I am trying to use the RTC in order to keep track of time but I am having some difficulties with a few methods regarding the extraction of the values.
RTC_SetDateAndTime(0x00000000, 0x14000101); Trying to start the values for the time to be 00;00;00 (HH;MM;SS) and the year as 2000;01;01 (YYYY;MM;DD).
and for extraction and control I simply use the GattDatabase + CySmart (windows).
time = dateTime.time;
date = dateTime.date;
dataTimeDate = RTC_GetSecond(time);
dataTimeDate = RTC_GetMinutes(time);
dataTimeDate = RTC_GetHours(time);
dataTimeDate = RTC_GetDay(date);
dataTimeDate = RTC_GetMonth(date);
//dataTimeDate = (((RTC_GetYear(date)<<0)&0xff));
//dataTimeDate = (((RTC_GetYear(date)<<8)&0xff));
The two rows above is an attempt to extract the two first digits and the last two digits of the YYYY
The values I succesfully write to the database and read with CySmart are 00;00;00 followed by 01;01;B2;00.
From this I conclude: Time Values are correct (the value for "seconds" of course start to move) but as for the date value, only day and month are correct. The Year always write B2, regardless of the value I set it to start with.