{"id":113017,"date":"2022-02-15T21:35:20","date_gmt":"2022-02-15T15:35:20","guid":{"rendered":"http:\/\/rcl-radio.ru\/?p=113017"},"modified":"2022-02-19T08:54:46","modified_gmt":"2022-02-19T02:54:46","slug":"%d1%87%d0%b0%d1%81%d1%8b-%d1%80%d0%b5%d0%b0%d0%bb%d1%8c%d0%bd%d0%be%d0%b3%d0%be-%d0%b2%d1%80%d0%b5%d0%bc%d0%b5%d0%bd%d0%b8-%d0%bd%d0%b0-stm32f103c8t6-arduino","status":"publish","type":"post","link":"http:\/\/rcl-radio.ru\/?p=113017","title":{"rendered":"\u0427\u0430\u0441\u044b \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0430 STM32F103C8T6 (Arduino)"},"content":{"rendered":"<p>\u0412 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435 STM32 \u0435\u0441\u0442\u044c \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u0447\u0430\u0441\u044b \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043e\u0442 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0433\u043e \u043d\u0438\u0437\u043a\u043e\u0441\u043a\u043e\u0440\u043e\u0441\u0442\u043d\u043e\u0433\u043e RC-\u0440\u0435\u0437\u043e\u043d\u0430\u0442\u043e\u0440\u0430 (LSI), \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043d\u0438\u0437\u043a\u043e\u0441\u043a\u043e\u0440\u043e\u0441\u0442\u043d\u043e\u0433\u043e \u043a\u0432\u0430\u0440\u0446\u0435\u0432\u043e\u0433\u043e \u0440\u0435\u0437\u043e\u043d\u0430\u0442\u043e\u0440\u0430 (LSE) \u0438\u043b\u0438 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u0432\u044b\u0441\u043e\u043a\u043e\u0441\u043a\u043e\u0440\u043e\u0441\u0442\u043d\u043e\u0433\u043e \u0440\u0435\u0437\u043e\u043d\u0430\u0442\u043e\u0440\u0430 \u0441 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u0435\u043c (HSE\/128). \u0412\u043d\u0435\u0448\u043d\u0438\u0439 \u043d\u0438\u0437\u043a\u043e\u0441\u043a\u043e\u0440\u043e\u0441\u0442\u043d\u043e\u0439 \u043a\u0432\u0430\u0440\u0446\u0435\u0432\u044b\u0439 \u0440\u0435\u0437\u043e\u043d\u0430\u0442\u043e\u0440, \u0441 \u0447\u0430\u0441\u0442\u043e\u0442\u043e\u0439 32768 \u0413\u0446, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0438\u0442\u0435\u043b\u044c\u043d\u0435\u0435, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u0445\u043e\u0434\u0430 \u0447\u0430\u0441\u043e\u0432 \u0438 \u0443\u0436\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u043d\u0430 \u043e\u0442\u043b\u0430\u0434\u043e\u0447\u043d\u043e\u0439 \u043f\u043b\u0430\u0442\u0435 STM32.<\/p>\n<p>\u0427\u0430\u0441\u044b \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043c\u043e\u0433\u0443\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u043e\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u043f\u0438\u0442\u0430\u043d\u0438\u044f, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430 \u0432\u0445\u043e\u0434 vbat \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0434\u0430\u0442\u044c \u043f\u0438\u0442\u0430\u043d\u0438\u0435 \u043d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0435\u043c 3 \u0412 (\u0431\u0430\u0442\u0430\u0440\u0435\u0439\u043a\u0430).<\/p>\n<div id=\"marketWidget\"><\/div>\n<p>\u041d\u0438\u0436\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d \u0441\u043a\u0435\u0442\u0447 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0438 \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0432\u0440\u0435\u043c\u044f \u0432 \u043c\u043e\u043d\u0438\u0442\u043e\u0440 \u043f\u043e\u0440\u0442\u0430. \u0420\u0430\u0431\u043e\u0442\u0430 \u0447\u0430\u0441\u043e\u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 RTClock, \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043e\u043d\u0430 \u0432\u0445\u043e\u0434\u0438\u0442 \u0432 \u0441\u043e\u0441\u0442\u0430\u0432 \u043d\u0430\u0431\u043e\u0440\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a Arduino_STM32-master \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u043f\u043b\u0430\u0442\u044b STM32F103C8T6 (\u043a\u0430\u043a \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u043f\u043b\u0430\u0442\u044b \u0432 Arduino IDE &#8212; <a href=\"http:\/\/rcl-radio.ru\/?p=68376\">http:\/\/rcl-radio.ru\/?p=68376<\/a>).<\/p>\n<pre class=\"actionscript\" style=\"font-family: monospace; font-size: 10px;\"><span style=\"color: #808080; font-style: italic;\">#include &lt;RTClock.h&gt;<\/span>\r\n\u00a0\r\nRTClock rtclock <span style=\"color: #66cc66;\">(<\/span>RTCSEL_LSE, <span style=\"color: #cc66cc;\">32768<\/span><span style=\"color: #66cc66;\">)<\/span>; <span style=\"color: #808080; font-style: italic;\">\/\/ \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u0432\u0430\u0440\u0446 32768 \u0413\u0446<\/span>\r\ntime_t tt, tt1;\r\ntm_t mtt;\r\nconst char <span style=\"color: #66cc66;\">*<\/span> delim = <span style=\"color: #ff0000;\">\" :\"<\/span>;\r\nchar s<span style=\"color: #66cc66;\">[<\/span><span style=\"color: #cc66cc;\">128<\/span><span style=\"color: #66cc66;\">]<\/span>; \r\nconst char <span style=\"color: #66cc66;\">*<\/span> weekdays<span style=\"color: #66cc66;\">[<\/span><span style=\"color: #66cc66;\">]<\/span> = <span style=\"color: #66cc66;\">{<\/span><span style=\"color: #ff0000;\">\"Mon\"<\/span>, <span style=\"color: #ff0000;\">\"Tue\"<\/span>, <span style=\"color: #ff0000;\">\"Wed\"<\/span>, <span style=\"color: #ff0000;\">\"Thu\"<\/span>, <span style=\"color: #ff0000;\">\"Fri\"<\/span>, <span style=\"color: #ff0000;\">\"Sat\"<\/span>, <span style=\"color: #ff0000;\">\"Sun\"<\/span><span style=\"color: #66cc66;\">}<\/span>;\r\nconst char <span style=\"color: #66cc66;\">*<\/span> months<span style=\"color: #66cc66;\">[<\/span><span style=\"color: #66cc66;\">]<\/span> = <span style=\"color: #66cc66;\">{<\/span><span style=\"color: #ff0000;\">\"Dummy\"<\/span>, <span style=\"color: #ff0000;\">\"Jan\"<\/span>, <span style=\"color: #ff0000;\">\"Feb\"<\/span>, <span style=\"color: #ff0000;\">\"Mar\"<\/span>, <span style=\"color: #ff0000;\">\"Apr\"<\/span>, <span style=\"color: #ff0000;\">\"May\"<\/span>, <span style=\"color: #ff0000;\">\"Jun\"<\/span>, <span style=\"color: #ff0000;\">\"Jul\"<\/span>, <span style=\"color: #ff0000;\">\"Aug\"<\/span>, <span style=\"color: #ff0000;\">\"Sep\"<\/span>, <span style=\"color: #ff0000;\">\"Oct\"<\/span>, <span style=\"color: #ff0000;\">\"Nov\"<\/span>, <span style=\"color: #ff0000;\">\"Dec\"<\/span> <span style=\"color: #66cc66;\">}<\/span>;\r\nbyte sec_time;\r\n\u00a0\r\n\u00a0\r\n<span style=\"color: #0066cc;\">void<\/span> setup<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>\r\n  Serial.<span style=\"color: #006600;\">begin<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">9600<\/span><span style=\"color: #66cc66;\">)<\/span>;\r\n  ParseBuildTimestamp<span style=\"color: #66cc66;\">(<\/span>mtt<span style=\"color: #66cc66;\">)<\/span>;  <span style=\"color: #808080; font-style: italic;\">\/\/  Unix \u0432\u0440\u0435\u043c\u044f, \u043e\u0442\u0441\u0447\u0435\u0442 \u043e\u0442 00:00:00 1 \u044f\u043d\u0432\u0430\u0440\u044f 1970<\/span>\r\n  tt = rtclock.<span style=\"color: #006600;\">makeTime<\/span><span style=\"color: #66cc66;\">(<\/span>mtt<span style=\"color: #66cc66;\">)<\/span> + <span style=\"color: #cc66cc;\">25<\/span>; <span style=\"color: #808080; font-style: italic;\">\/\/ +25 \u0441\u0435\u043a \u043a\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0434\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0446\u0438\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0441\u043a\u0435\u0442\u0447\u0430<\/span>\r\n <span style=\"color: #808080; font-style: italic;\">\/\/ rtclock.setTime(tt); <\/span>\r\n  tt1 = tt;\r\n<span style=\"color: #66cc66;\">}<\/span>\r\n\u00a0\r\n<span style=\"color: #0066cc;\">void<\/span> loop<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>\r\n    tt1 = tt;\r\n    rtclock.<span style=\"color: #006600;\">breakTime<\/span><span style=\"color: #66cc66;\">(<\/span>rtclock.<span style=\"color: #006600;\">now<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>, mtt<span style=\"color: #66cc66;\">)<\/span>;\r\n    <span style=\"color: #b1b100;\">if<\/span><span style=\"color: #66cc66;\">(<\/span>mtt.<span style=\"color: #006600;\">second<\/span><span style=\"color: #66cc66;\">!<\/span>=sec_time<span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>   \r\n    sprintf<span style=\"color: #66cc66;\">(<\/span>s, <span style=\"color: #ff0000;\">\"RTC timestamp: %s %u %u, %s, %02u:%02u:%02u<span style=\"color: #000099; font-weight: bold;\">\\n<\/span>\"<\/span>,months<span style=\"color: #66cc66;\">[<\/span>mtt.<span style=\"color: #006600;\">month<\/span><span style=\"color: #66cc66;\">]<\/span>, mtt.<span style=\"color: #006600;\">day<\/span>, mtt.<span style=\"color: #006600;\">year<\/span>+<span style=\"color: #cc66cc;\">1970<\/span>, weekdays<span style=\"color: #66cc66;\">[<\/span>mtt.<span style=\"color: #006600;\">weekday<\/span><span style=\"color: #66cc66;\">]<\/span>, mtt.<span style=\"color: #006600;\">hour<\/span>, mtt.<span style=\"color: #006600;\">minute<\/span>, mtt.<span style=\"color: #006600;\">second<\/span><span style=\"color: #66cc66;\">)<\/span>;\r\n    Serial.<span style=\"color: #006600;\">println<\/span><span style=\"color: #66cc66;\">(<\/span>s<span style=\"color: #66cc66;\">)<\/span>;\r\n    sec_time = mtt.<span style=\"color: #006600;\">second<\/span>;\r\n  <span style=\"color: #66cc66;\">}<\/span>\r\n<span style=\"color: #66cc66;\">}<\/span>\r\n\u00a0\r\nuint8_t str2month<span style=\"color: #66cc66;\">(<\/span>const char <span style=\"color: #66cc66;\">*<\/span> d<span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>uint8_t i = <span style=\"color: #cc66cc;\">13<\/span>;<span style=\"color: #b1b100;\">while<\/span> <span style=\"color: #66cc66;\">(<\/span> <span style=\"color: #66cc66;\">(<\/span>--i<span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">&amp;&amp;<\/span> strcmp<span style=\"color: #66cc66;\">(<\/span>months<span style=\"color: #66cc66;\">[<\/span>i<span style=\"color: #66cc66;\">]<\/span>, d<span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">!<\/span>=<span style=\"color: #cc66cc;\">0<\/span> <span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #b1b100;\">return<\/span> i;<span style=\"color: #66cc66;\">}<\/span>\r\n\u00a0\r\n<span style=\"color: #0066cc;\">void<\/span> ParseBuildTimestamp<span style=\"color: #66cc66;\">(<\/span>tm_t <span style=\"color: #66cc66;\">&amp;<\/span> mt<span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>\r\n    sprintf<span style=\"color: #66cc66;\">(<\/span>s, <span style=\"color: #ff0000;\">\"Timestamp: %s, %s<span style=\"color: #000099; font-weight: bold;\">\\n<\/span>\"<\/span>, __DATE__, __TIME__<span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #808080; font-style: italic;\">\/\/ \u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438: \"Dec  8 2017, 22:57:54\"<\/span>\r\n    Serial.<span style=\"color: #0066cc;\">print<\/span><span style=\"color: #66cc66;\">(<\/span>s<span style=\"color: #66cc66;\">)<\/span>;\r\n    char <span style=\"color: #66cc66;\">*<\/span> token = strtok<span style=\"color: #66cc66;\">(<\/span>s, delim<span style=\"color: #66cc66;\">)<\/span>; <span style=\"color: #808080; font-style: italic;\">\/\/ get first token<\/span>\r\n    <span style=\"color: #808080; font-style: italic;\">\/\/ walk through tokens<\/span>\r\n    <span style=\"color: #b1b100;\">while<\/span><span style=\"color: #66cc66;\">(<\/span> token <span style=\"color: #66cc66;\">!<\/span>= <span style=\"color: #000000; font-weight: bold;\">NULL<\/span> <span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">{<\/span>\r\n        uint8_t m = str2month<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">(<\/span>const char<span style=\"color: #66cc66;\">*<\/span><span style=\"color: #66cc66;\">)<\/span>token<span style=\"color: #66cc66;\">)<\/span>;\r\n        <span style=\"color: #b1b100;\">if<\/span> <span style=\"color: #66cc66;\">(<\/span> m<span style=\"color: #66cc66;\">&gt;<\/span><span style=\"color: #cc66cc;\">0<\/span> <span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">{<\/span>\r\n            mt.<span style=\"color: #006600;\">month<\/span> = m;\r\n            token = strtok<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #000000; font-weight: bold;\">NULL<\/span>, delim<span style=\"color: #66cc66;\">)<\/span>; <span style=\"color: #808080; font-style: italic;\">\/\/ get next token<\/span>\r\n            mt.<span style=\"color: #006600;\">day<\/span> = atoi<span style=\"color: #66cc66;\">(<\/span>token<span style=\"color: #66cc66;\">)<\/span>;\r\n            token = strtok<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #000000; font-weight: bold;\">NULL<\/span>, delim<span style=\"color: #66cc66;\">)<\/span>; <span style=\"color: #808080; font-style: italic;\">\/\/ get next token<\/span>\r\n            mt.<span style=\"color: #006600;\">year<\/span> = atoi<span style=\"color: #66cc66;\">(<\/span>token<span style=\"color: #66cc66;\">)<\/span> - <span style=\"color: #cc66cc;\">1970<\/span>;\r\n            token = strtok<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #000000; font-weight: bold;\">NULL<\/span>, delim<span style=\"color: #66cc66;\">)<\/span>; <span style=\"color: #808080; font-style: italic;\">\/\/ get next token<\/span>\r\n            mt.<span style=\"color: #006600;\">hour<\/span> = atoi<span style=\"color: #66cc66;\">(<\/span>token<span style=\"color: #66cc66;\">)<\/span>;\r\n            token = strtok<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #000000; font-weight: bold;\">NULL<\/span>, delim<span style=\"color: #66cc66;\">)<\/span>; <span style=\"color: #808080; font-style: italic;\">\/\/ get next token<\/span>\r\n            mt.<span style=\"color: #006600;\">minute<\/span> = atoi<span style=\"color: #66cc66;\">(<\/span>token<span style=\"color: #66cc66;\">)<\/span>;\r\n            token = strtok<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #000000; font-weight: bold;\">NULL<\/span>, delim<span style=\"color: #66cc66;\">)<\/span>; <span style=\"color: #808080; font-style: italic;\">\/\/ get next token<\/span>\r\n            mt.<span style=\"color: #006600;\">second<\/span> = atoi<span style=\"color: #66cc66;\">(<\/span>token<span style=\"color: #66cc66;\">)<\/span>;\r\n        <span style=\"color: #66cc66;\">}<\/span>\r\n        token = strtok<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #000000; font-weight: bold;\">NULL<\/span>, delim<span style=\"color: #66cc66;\">)<\/span>;\r\n    <span style=\"color: #66cc66;\">}<\/span>\r\n<span style=\"color: #66cc66;\">}<\/span><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0438 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u0432 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0435 \u043f\u043e\u0440\u0442\u0430 \u0412\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<p><a href=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/02\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-02-15-212800.png\" class=\"highslide-image\" onclick=\"return hs.expand(this);\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-113018\" src=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/02\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-02-15-212800.png\" alt=\"\" width=\"353\" height=\"357\" srcset=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/02\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-02-15-212800.png 353w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/02\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-02-15-212800-200x202.png 200w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/02\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-02-15-212800-45x45.png 45w\" sizes=\"auto, (max-width: 353px) 100vw, 353px\" \/><\/a><\/p>\n<p>\u0414\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0440\u0430\u0441\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u0441\u0442\u0440\u043e\u043a\u0443:<\/p>\n<blockquote><p><strong>rtclock.setTime(tt); <\/strong><\/p><\/blockquote>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u043b\u0438\u0432\u043a\u0438 \u0441\u043a\u0435\u0442\u0447\u0430, \u0437\u0430\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u044d\u0442\u0443 \u0441\u0442\u0440\u043e\u0447\u043a\u0443 \u0438 \u043f\u043e \u043d\u043e\u0432\u043e\u0439 \u0437\u0430\u043b\u0435\u0439\u0442\u0435 \u0441\u043a\u0435\u0442\u0447:<\/p>\n<blockquote><p><strong>\/\/ rtclock.setTime(tt); <\/strong><\/p><\/blockquote>\n<p>\u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0447\u0430\u0441\u044b, \u0434\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043c\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0430 LCD1602\u00a0 \u0441 \u043c\u043e\u0434\u0443\u043b\u0435\u043c I2C.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter\" src=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2019\/12\/%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA-%D1%8D%D0%BA%D1%80%D0%B0%D0%BD%D0%B0-%D0%BE%D1%82-2019-12-14-164937.png\" \/><\/p>\n<p>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 LCD1602 \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0448\u0438\u043d\u044b I2C \u043a \u043f\u043b\u0430\u0442\u0435 STM32 \u043c\u0430\u043b\u043e \u0447\u0435\u043c \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a Arduino Nano, \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043c\u0435\u0441\u0442\u043e A4 A5 \u0434\u043b\u044f Nano, \u0432 STM32 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0432\u044b\u0432\u043e\u0434\u044b B6 (SCL) B7 (SDA). \u041f\u0440\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u043f\u043b\u0430\u0442\u044b STM32 \u043a USB \u043f\u043e\u0440\u0442\u0443 LCD1602 \u0441 I2C \u043c\u043e\u0434\u0443\u043b\u0435\u043c \u043f\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u0432\u044b\u0445\u043e\u0434\u0430 5V. \u041f\u0440\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u043f\u0438\u0442\u0430\u043d\u0438\u044f 5 \u0412, \u044d\u0442\u043e \u043d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0430 VCC I2C \u043c\u043e\u0434\u0443\u043b\u044f \u0438 \u043d\u0430 \u0432\u0445\u043e\u0434 5V \u043f\u043b\u0430\u0442\u044b STM32.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2019\/09\/368632862389.png\" width=\"455\" height=\"223\" \/><\/p>\n<p><a href=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/02\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-02-15-213411.png\" class=\"highslide-image\" onclick=\"return hs.expand(this);\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-113019\" src=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/02\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-02-15-213411.png\" alt=\"\" width=\"782\" height=\"219\" srcset=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/02\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-02-15-213411.png 782w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/02\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-02-15-213411-200x56.png 200w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/02\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-02-15-213411-500x140.png 500w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/02\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-02-15-213411-768x215.png 768w\" sizes=\"auto, (max-width: 782px) 100vw, 782px\" \/><\/a><\/p>\n<pre class=\"actionscript\" style=\"font-family: monospace; font-size: 10px;\"><span style=\"color: #808080; font-style: italic;\">#include &lt;RTClock.h&gt;<\/span>\r\n<span style=\"color: #808080; font-style: italic;\">#include &lt;Wire.h&gt; <\/span>\r\n<span style=\"color: #808080; font-style: italic;\">#include &lt;LiquidCrystal_I2C.h&gt; \/\/ http:\/\/rcl-radio.ru\/wp-content\/uploads\/2019\/12\/liquidcrystali2c-9.zip<\/span>\r\nLiquidCrystal_I2C lcd<span style=\"color: #66cc66;\">(<\/span>0x27,<span style=\"color: #cc66cc;\">16<\/span>,<span style=\"color: #cc66cc;\">2<\/span><span style=\"color: #66cc66;\">)<\/span>;  <span style=\"color: #808080; font-style: italic;\">\/\/ \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0434\u0438\u0441\u043f\u043b\u0435\u0439<\/span>\r\n\u00a0\r\nRTClock rtclock <span style=\"color: #66cc66;\">(<\/span>RTCSEL_LSE, <span style=\"color: #cc66cc;\">32765<\/span><span style=\"color: #66cc66;\">)<\/span>; <span style=\"color: #808080; font-style: italic;\">\/\/ \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u0432\u0430\u0440\u0446 32768 \u0413\u0446 (\u043a\u043e\u0440\u0440\u0435\u043a\u0446\u0438\u044f \u043f\u043e\u0433\u0440\u0435\u0448\u043d\u043e\u0441\u0442\u0438 \u043a\u0432\u0430\u0440\u0446\u0430)<\/span>\r\ntime_t tt, tt1;\r\ntm_t mtt;\r\nconst char <span style=\"color: #66cc66;\">*<\/span> delim = <span style=\"color: #ff0000;\">\" :\"<\/span>;\r\nchar s<span style=\"color: #66cc66;\">[<\/span><span style=\"color: #cc66cc;\">128<\/span><span style=\"color: #66cc66;\">]<\/span>; \r\nconst char <span style=\"color: #66cc66;\">*<\/span> weekdays<span style=\"color: #66cc66;\">[<\/span><span style=\"color: #66cc66;\">]<\/span> = <span style=\"color: #66cc66;\">{<\/span><span style=\"color: #ff0000;\">\"Mon\"<\/span>, <span style=\"color: #ff0000;\">\"Tue\"<\/span>, <span style=\"color: #ff0000;\">\"Wed\"<\/span>, <span style=\"color: #ff0000;\">\"Thu\"<\/span>, <span style=\"color: #ff0000;\">\"Fri\"<\/span>, <span style=\"color: #ff0000;\">\"Sat\"<\/span>, <span style=\"color: #ff0000;\">\"Sun\"<\/span><span style=\"color: #66cc66;\">}<\/span>;\r\nconst char <span style=\"color: #66cc66;\">*<\/span> months<span style=\"color: #66cc66;\">[<\/span><span style=\"color: #66cc66;\">]<\/span> = <span style=\"color: #66cc66;\">{<\/span><span style=\"color: #ff0000;\">\"Dummy\"<\/span>, <span style=\"color: #ff0000;\">\"Jan\"<\/span>, <span style=\"color: #ff0000;\">\"Feb\"<\/span>, <span style=\"color: #ff0000;\">\"Mar\"<\/span>, <span style=\"color: #ff0000;\">\"Apr\"<\/span>, <span style=\"color: #ff0000;\">\"May\"<\/span>, <span style=\"color: #ff0000;\">\"Jun\"<\/span>, <span style=\"color: #ff0000;\">\"Jul\"<\/span>, <span style=\"color: #ff0000;\">\"Aug\"<\/span>, <span style=\"color: #ff0000;\">\"Sep\"<\/span>, <span style=\"color: #ff0000;\">\"Oct\"<\/span>, <span style=\"color: #ff0000;\">\"Nov\"<\/span>, <span style=\"color: #ff0000;\">\"Dec\"<\/span> <span style=\"color: #66cc66;\">}<\/span>;\r\nbyte sec_time;\r\n\u00a0\r\n\u00a0\r\n<span style=\"color: #0066cc;\">void<\/span> setup<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>\r\n  Serial.<span style=\"color: #006600;\">begin<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">9600<\/span><span style=\"color: #66cc66;\">)<\/span>;\r\n  lcd.<span style=\"color: #006600;\">init<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;                     \r\n  lcd.<span style=\"color: #006600;\">backlight<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #808080; font-style: italic;\">\/\/ \u0412\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043f\u043e\u0434\u0441\u0432\u0435\u0442\u043a\u0443 \u0434\u0438\u0441\u043f\u043b\u0435\u044f<\/span>\r\n  ParseBuildTimestamp<span style=\"color: #66cc66;\">(<\/span>mtt<span style=\"color: #66cc66;\">)<\/span>;  <span style=\"color: #808080; font-style: italic;\">\/\/  Unix \u0432\u0440\u0435\u043c\u044f, \u043e\u0442\u0441\u0447\u0435\u0442 \u043e\u0442 00:00:00 1 \u044f\u043d\u0432\u0430\u0440\u044f 1970<\/span>\r\n  tt = rtclock.<span style=\"color: #006600;\">makeTime<\/span><span style=\"color: #66cc66;\">(<\/span>mtt<span style=\"color: #66cc66;\">)<\/span> + <span style=\"color: #cc66cc;\">25<\/span>; <span style=\"color: #808080; font-style: italic;\">\/\/ +25 \u0441\u0435\u043a \u043a\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0434\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0446\u0438\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0441\u043a\u0435\u0442\u0447\u0430<\/span>\r\n <span style=\"color: #808080; font-style: italic;\">\/\/ rtclock.setTime(tt); <\/span>\r\n  tt1 = tt;\r\n<span style=\"color: #66cc66;\">}<\/span>\r\n\u00a0\r\n<span style=\"color: #0066cc;\">void<\/span> loop<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>\r\n    tt1 = tt;\r\n    rtclock.<span style=\"color: #006600;\">breakTime<\/span><span style=\"color: #66cc66;\">(<\/span>rtclock.<span style=\"color: #006600;\">now<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>, mtt<span style=\"color: #66cc66;\">)<\/span>;\r\n    <span style=\"color: #b1b100;\">if<\/span><span style=\"color: #66cc66;\">(<\/span>mtt.<span style=\"color: #006600;\">second<\/span><span style=\"color: #66cc66;\">!<\/span>=sec_time<span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>   \r\n    sprintf<span style=\"color: #66cc66;\">(<\/span>s, <span style=\"color: #ff0000;\">\"RTC timestamp: %s %u %u, %s, %02u:%02u:%02u<span style=\"color: #000099; font-weight: bold;\">\\n<\/span>\"<\/span>,months<span style=\"color: #66cc66;\">[<\/span>mtt.<span style=\"color: #006600;\">month<\/span><span style=\"color: #66cc66;\">]<\/span>, mtt.<span style=\"color: #006600;\">day<\/span>, mtt.<span style=\"color: #006600;\">year<\/span>+<span style=\"color: #cc66cc;\">1970<\/span>, weekdays<span style=\"color: #66cc66;\">[<\/span>mtt.<span style=\"color: #006600;\">weekday<\/span><span style=\"color: #66cc66;\">]<\/span>, mtt.<span style=\"color: #006600;\">hour<\/span>, mtt.<span style=\"color: #006600;\">minute<\/span>, mtt.<span style=\"color: #006600;\">second<\/span><span style=\"color: #66cc66;\">)<\/span>;\r\n    Serial.<span style=\"color: #006600;\">println<\/span><span style=\"color: #66cc66;\">(<\/span>s<span style=\"color: #66cc66;\">)<\/span>;\r\n    sec_time = mtt.<span style=\"color: #006600;\">second<\/span>;\r\n    lcd.<span style=\"color: #006600;\">setCursor<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">4<\/span>, <span style=\"color: #cc66cc;\">0<\/span><span style=\"color: #66cc66;\">)<\/span>;\r\n    lcd.<span style=\"color: #0066cc;\">print<\/span><span style=\"color: #66cc66;\">(<\/span>mtt.<span style=\"color: #006600;\">hour<\/span><span style=\"color: #66cc66;\">\/<\/span><span style=\"color: #cc66cc;\">10<\/span><span style=\"color: #66cc66;\">)<\/span>;lcd.<span style=\"color: #0066cc;\">print<\/span><span style=\"color: #66cc66;\">(<\/span>mtt.<span style=\"color: #006600;\">hour<\/span><span style=\"color: #66cc66;\">%<\/span>10<span style=\"color: #66cc66;\">)<\/span>;lcd.<span style=\"color: #0066cc;\">print<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #ff0000;\">\":\"<\/span><span style=\"color: #66cc66;\">)<\/span>;lcd.<span style=\"color: #0066cc;\">print<\/span><span style=\"color: #66cc66;\">(<\/span>mtt.<span style=\"color: #006600;\">minute<\/span><span style=\"color: #66cc66;\">\/<\/span><span style=\"color: #cc66cc;\">10<\/span><span style=\"color: #66cc66;\">)<\/span>;lcd.<span style=\"color: #0066cc;\">print<\/span><span style=\"color: #66cc66;\">(<\/span>mtt.<span style=\"color: #006600;\">minute<\/span><span style=\"color: #66cc66;\">%<\/span>10<span style=\"color: #66cc66;\">)<\/span>;lcd.<span style=\"color: #0066cc;\">print<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #ff0000;\">\":\"<\/span><span style=\"color: #66cc66;\">)<\/span>;lcd.<span style=\"color: #0066cc;\">print<\/span><span style=\"color: #66cc66;\">(<\/span>mtt.<span style=\"color: #006600;\">second<\/span><span style=\"color: #66cc66;\">\/<\/span><span style=\"color: #cc66cc;\">10<\/span><span style=\"color: #66cc66;\">)<\/span>;lcd.<span style=\"color: #0066cc;\">print<\/span><span style=\"color: #66cc66;\">(<\/span>mtt.<span style=\"color: #006600;\">second<\/span><span style=\"color: #66cc66;\">%<\/span>10<span style=\"color: #66cc66;\">)<\/span>;\r\n    lcd.<span style=\"color: #006600;\">setCursor<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">0<\/span>, <span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">)<\/span>;\r\n    <span style=\"color: #b1b100;\">if<\/span><span style=\"color: #66cc66;\">(<\/span>mtt.<span style=\"color: #006600;\">day<\/span><span style=\"color: #66cc66;\">&lt;<\/span><span style=\"color: #cc66cc;\">10<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>lcd.<span style=\"color: #0066cc;\">print<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #ff0000;\">\" \"<\/span><span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #66cc66;\">}<\/span>lcd.<span style=\"color: #0066cc;\">print<\/span><span style=\"color: #66cc66;\">(<\/span>mtt.<span style=\"color: #006600;\">day<\/span><span style=\"color: #66cc66;\">)<\/span>;lcd.<span style=\"color: #0066cc;\">print<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #ff0000;\">\" \"<\/span><span style=\"color: #66cc66;\">)<\/span>;lcd.<span style=\"color: #0066cc;\">print<\/span><span style=\"color: #66cc66;\">(<\/span>months<span style=\"color: #66cc66;\">[<\/span>mtt.<span style=\"color: #006600;\">month<\/span><span style=\"color: #66cc66;\">]<\/span><span style=\"color: #66cc66;\">)<\/span>;lcd.<span style=\"color: #0066cc;\">print<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #ff0000;\">\" \"<\/span><span style=\"color: #66cc66;\">)<\/span>;lcd.<span style=\"color: #0066cc;\">print<\/span><span style=\"color: #66cc66;\">(<\/span>mtt.<span style=\"color: #006600;\">year<\/span>+<span style=\"color: #cc66cc;\">1970<\/span><span style=\"color: #66cc66;\">)<\/span>;lcd.<span style=\"color: #0066cc;\">print<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #ff0000;\">\" \"<\/span><span style=\"color: #66cc66;\">)<\/span>;lcd.<span style=\"color: #0066cc;\">print<\/span><span style=\"color: #66cc66;\">(<\/span>weekdays<span style=\"color: #66cc66;\">[<\/span>mtt.<span style=\"color: #006600;\">weekday<\/span><span style=\"color: #66cc66;\">]<\/span><span style=\"color: #66cc66;\">)<\/span>;\r\n  <span style=\"color: #66cc66;\">}<\/span>\r\n<span style=\"color: #66cc66;\">}<\/span>\r\n\u00a0\r\nuint8_t str2month<span style=\"color: #66cc66;\">(<\/span>const char <span style=\"color: #66cc66;\">*<\/span> d<span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>uint8_t i = <span style=\"color: #cc66cc;\">13<\/span>;<span style=\"color: #b1b100;\">while<\/span> <span style=\"color: #66cc66;\">(<\/span> <span style=\"color: #66cc66;\">(<\/span>--i<span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">&amp;&amp;<\/span> strcmp<span style=\"color: #66cc66;\">(<\/span>months<span style=\"color: #66cc66;\">[<\/span>i<span style=\"color: #66cc66;\">]<\/span>, d<span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">!<\/span>=<span style=\"color: #cc66cc;\">0<\/span> <span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #b1b100;\">return<\/span> i;<span style=\"color: #66cc66;\">}<\/span>\r\n\u00a0\r\n<span style=\"color: #0066cc;\">void<\/span> ParseBuildTimestamp<span style=\"color: #66cc66;\">(<\/span>tm_t <span style=\"color: #66cc66;\">&amp;<\/span> mt<span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>\r\n    sprintf<span style=\"color: #66cc66;\">(<\/span>s, <span style=\"color: #ff0000;\">\"Timestamp: %s, %s<span style=\"color: #000099; font-weight: bold;\">\\n<\/span>\"<\/span>, __DATE__, __TIME__<span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #808080; font-style: italic;\">\/\/ \u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438: \"Dec  8 2017, 22:57:54\"<\/span>\r\n    Serial.<span style=\"color: #0066cc;\">print<\/span><span style=\"color: #66cc66;\">(<\/span>s<span style=\"color: #66cc66;\">)<\/span>;\r\n    char <span style=\"color: #66cc66;\">*<\/span> token = strtok<span style=\"color: #66cc66;\">(<\/span>s, delim<span style=\"color: #66cc66;\">)<\/span>; <span style=\"color: #808080; font-style: italic;\">\/\/ get first token<\/span>\r\n    <span style=\"color: #808080; font-style: italic;\">\/\/ walk through tokens<\/span>\r\n    <span style=\"color: #b1b100;\">while<\/span><span style=\"color: #66cc66;\">(<\/span> token <span style=\"color: #66cc66;\">!<\/span>= <span style=\"color: #000000; font-weight: bold;\">NULL<\/span> <span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">{<\/span>\r\n        uint8_t m = str2month<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">(<\/span>const char<span style=\"color: #66cc66;\">*<\/span><span style=\"color: #66cc66;\">)<\/span>token<span style=\"color: #66cc66;\">)<\/span>;\r\n        <span style=\"color: #b1b100;\">if<\/span> <span style=\"color: #66cc66;\">(<\/span> m<span style=\"color: #66cc66;\">&gt;<\/span><span style=\"color: #cc66cc;\">0<\/span> <span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">{<\/span>\r\n            mt.<span style=\"color: #006600;\">month<\/span> = m;\r\n            token = strtok<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #000000; font-weight: bold;\">NULL<\/span>, delim<span style=\"color: #66cc66;\">)<\/span>; <span style=\"color: #808080; font-style: italic;\">\/\/ get next token<\/span>\r\n            mt.<span style=\"color: #006600;\">day<\/span> = atoi<span style=\"color: #66cc66;\">(<\/span>token<span style=\"color: #66cc66;\">)<\/span>;\r\n            token = strtok<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #000000; font-weight: bold;\">NULL<\/span>, delim<span style=\"color: #66cc66;\">)<\/span>; <span style=\"color: #808080; font-style: italic;\">\/\/ get next token<\/span>\r\n            mt.<span style=\"color: #006600;\">year<\/span> = atoi<span style=\"color: #66cc66;\">(<\/span>token<span style=\"color: #66cc66;\">)<\/span> - <span style=\"color: #cc66cc;\">1970<\/span>;\r\n            token = strtok<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #000000; font-weight: bold;\">NULL<\/span>, delim<span style=\"color: #66cc66;\">)<\/span>; <span style=\"color: #808080; font-style: italic;\">\/\/ get next token<\/span>\r\n            mt.<span style=\"color: #006600;\">hour<\/span> = atoi<span style=\"color: #66cc66;\">(<\/span>token<span style=\"color: #66cc66;\">)<\/span>;\r\n            token = strtok<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #000000; font-weight: bold;\">NULL<\/span>, delim<span style=\"color: #66cc66;\">)<\/span>; <span style=\"color: #808080; font-style: italic;\">\/\/ get next token<\/span>\r\n            mt.<span style=\"color: #006600;\">minute<\/span> = atoi<span style=\"color: #66cc66;\">(<\/span>token<span style=\"color: #66cc66;\">)<\/span>;\r\n            token = strtok<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #000000; font-weight: bold;\">NULL<\/span>, delim<span style=\"color: #66cc66;\">)<\/span>; <span style=\"color: #808080; font-style: italic;\">\/\/ get next token<\/span>\r\n            mt.<span style=\"color: #006600;\">second<\/span> = atoi<span style=\"color: #66cc66;\">(<\/span>token<span style=\"color: #66cc66;\">)<\/span>;\r\n        <span style=\"color: #66cc66;\">}<\/span>\r\n        token = strtok<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #000000; font-weight: bold;\">NULL<\/span>, delim<span style=\"color: #66cc66;\">)<\/span>;\r\n    <span style=\"color: #66cc66;\">}<\/span>\r\n<span style=\"color: #66cc66;\">}<\/span><\/pre>\n<p>\u0424\u043e\u0440\u0443\u043c &#8212; <a href=\"http:\/\/forum.rcl-radio.ru\/viewtopic.php?pid=5416#p5416\">http:\/\/forum.rcl-radio.ru\/viewtopic.php?pid=5416#p5416<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0412 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435 STM32 \u0435\u0441\u0442\u044c \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u0447\u0430\u0441\u044b \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043e\u0442 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0433\u043e \u043d\u0438\u0437\u043a\u043e\u0441\u043a\u043e\u0440\u043e\u0441\u0442\u043d\u043e\u0433\u043e RC-\u0440\u0435\u0437\u043e\u043d\u0430\u0442\u043e\u0440\u0430 (LSI), \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043d\u0438\u0437\u043a\u043e\u0441\u043a\u043e\u0440\u043e\u0441\u0442\u043d\u043e\u0433\u043e \u043a\u0432\u0430\u0440\u0446\u0435\u0432\u043e\u0433\u043e \u0440\u0435\u0437\u043e\u043d\u0430\u0442\u043e\u0440\u0430 (LSE) \u0438\u043b\u0438 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u0432\u044b\u0441\u043e\u043a\u043e\u0441\u043a\u043e\u0440\u043e\u0441\u0442\u043d\u043e\u0433\u043e \u0440\u0435\u0437\u043e\u043d\u0430\u0442\u043e\u0440\u0430 \u0441 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u0435\u043c (HSE\/128). \u0412\u043d\u0435\u0448\u043d\u0438\u0439 \u043d\u0438\u0437\u043a\u043e\u0441\u043a\u043e\u0440\u043e\u0441\u0442\u043d\u043e\u0439 \u043a\u0432\u0430\u0440\u0446\u0435\u0432\u044b\u0439 \u0440\u0435\u0437\u043e\u043d\u0430\u0442\u043e\u0440, \u0441 \u0447\u0430\u0441\u0442\u043e\u0442\u043e\u0439 32768 \u0413\u0446, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0438\u0442\u0435\u043b\u044c\u043d\u0435\u0435, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u0445\u043e\u0434\u0430 \u0447\u0430\u0441\u043e\u0432 \u0438 \u0443\u0436\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u043d\u0430 \u043e\u0442\u043b\u0430\u0434\u043e\u0447\u043d\u043e\u0439 \u043f\u043b\u0430\u0442\u0435 STM32. \u0427\u0430\u0441\u044b \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":113018,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[239,17,21],"tags":[],"class_list":["post-113017","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-arduino","category-17","category-21"],"views":9951,"_links":{"self":[{"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/posts\/113017","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=113017"}],"version-history":[{"count":3,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/posts\/113017\/revisions"}],"predecessor-version":[{"id":113039,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/posts\/113017\/revisions\/113039"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/media\/113018"}],"wp:attachment":[{"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=113017"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=113017"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=113017"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}