2018-06-22 05:06 PM
Hi,
Why the RTC Year is a uint8_t and value must be b/w 0 and 99? How do we map to real year? Thx
/**
* @brief RTC Date structure definition */ typedef struct { uint8_t WeekDay; /*!< Specifies the RTC Date WeekDay. This parameter can be a value of @ref RTC_WeekDay_Definitions */uint8_t Month; /*!< Specifies the RTC Date Month (in BCD format).
This parameter can be a value of @ref RTC_Month_Date_Definitions */uint8_t Date; /*!< Specifies the RTC Date.
This parameter must be a number between Min_Data = 1 and Max_Data = 31 */uint8_t Year; /*!< Specifies the RTC Date Year.
This parameter must be a number between Min_Data = 0 and Max_Data = 99 */}RTC_DateTypeDef;
Note: this post was migrated and contained many threaded conversations, some content may be missing.2018-06-23 01:41 AM
Hello,
add 2000 in your calculations.
Best regards,
Tilen
2018-06-23 04:09 AM
>2-digit years
somebody didnt learn anything from Y2K.
2018-06-23 07:39 AM
with the ever shorter life span of equipment, Y2K wont affect the next 10 generation's of computers.
2018-06-23 11:03 AM
>>somebody didnt learn anything from Y2K.
I learned that some people have unrealistic ideas about how many decades electronic equipment is expected to function, or contain parts that can be sourced indefinitely. Probably still a warehouse somewhere still filled with Z80 and 68000 parts.
That a lot of organizations in the late part of the 20th century fired their engineering staff, and then expected to manufacture the designed equipment for 30-40 years with zero investment in design update or maintenance work.
That very few people can write calendaring software properly, and even fewer that actually test that they can.
Between 2000-2099 every forth year is a leap, this is not true for 1900-1999 or 2100-2199. The RTC implementation is simplistic/naive, as this has less gates, and less likelihood of being designed wrong.
2018-06-25 11:54 AM
That's what I thought after posted - add 2000. Thx
2018-06-25 12:14 PM
Interesting. I got minutes over 59. Not sure what's happening...
Name : Minutes
Details:67 'C' Default:67 'C' Decimal:67 Hex:0x43 Binary:1000011 Octal:01032018-06-25 12:18 PM
In BCD there are 0x59 minutes in an hour...
2018-06-25 12:34 PM
I don't see there is any issue to have minutes over 59 no matter what format we are using. Here is from user's manual.
STM32L4S9xx HAL User Manual: RTC_TimeTypeDef Struct Reference
uint8_t
Specifies the RTC Time Minutes. This parameter must be a number between Min_Data = 0 and Max_Data = 59
2018-06-25 12:36 PM
Typo - I don't see there is any reason to have minutes over decimal 59.