{"id":83100,"date":"2020-08-20T20:05:54","date_gmt":"2020-08-20T14:05:54","guid":{"rendered":"http:\/\/rcl-radio.ru\/?p=83100"},"modified":"2022-01-08T16:49:11","modified_gmt":"2022-01-08T10:49:11","slug":"%d1%87%d0%b0%d1%81%d1%8b-%d0%bd%d0%b0-atmega8-arduino-ide","status":"publish","type":"post","link":"http:\/\/rcl-radio.ru\/?p=83100","title":{"rendered":"\u0427\u0430\u0441\u044b \u043d\u0430 ATmega8 (Arduino IDE)"},"content":{"rendered":"<p>Arduino IDE \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 ATmega8. \u041c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 ATmega8 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d \u043f\u043e \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438 CMOS, 8-\u0440\u0430\u0437\u0440\u044f\u0434\u043d\u044b\u0439, \u043e\u0441\u043d\u043e\u0432\u0430\u043d \u043d\u0430 AVR \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435 RISC. \u0417\u0430 \u043e\u0434\u0438\u043d \u0442\u0430\u043a\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u0430 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f, \u043d\u0430 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 ATmega8 \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432 1MIPS \u043d\u0430 \u041c\u0413\u0446, \u0438 \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u0435\u043c\u0430\u044f \u044d\u043d\u0435\u0440\u0433\u0438\u044f.<\/p>\n<p>\u041a\u0430\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u043b\u0438 \u043f\u0440\u043e\u0448\u0438\u0442\u044c \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 Atmega8 \u0432 \u0441\u0440\u0435\u0434\u0435 Arduino IDE\u00a0 \u043c\u043e\u0436\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c \u0438\u0437 &#8212; <a href=\"http:\/\/rcl-radio.ru\/?p=82486\">http:\/\/rcl-radio.ru\/?p=82486<\/a><\/p>\n<p>\u0427\u0430\u0441\u044b \u043d\u0430 ATmega8 \u0432 \u0441\u0432\u043e\u0435\u043c \u0441\u043e\u0441\u0442\u0430\u0432\u0435 \u0438\u043c\u0435\u044e\u0442 \u0438\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440 TM1637(\u043c\u043e\u0434\u0443\u043b\u044c), \u0447\u0430\u0441\u044b \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 DS3231(\u043c\u043e\u0434\u0443\u043b\u044c) \u0438 \u0434\u0432\u0435 \u043a\u043d\u043e\u043f\u043a\u0438 \u0434\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/p>\n<p><a href=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2020\/08\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2020-08-20-191911.png\" class=\"highslide-image\" onclick=\"return hs.expand(this);\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-83101\" src=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2020\/08\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2020-08-20-191911.png\" alt=\"\" width=\"450\" height=\"357\" srcset=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2020\/08\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2020-08-20-191911.png 450w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2020\/08\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2020-08-20-191911-200x159.png 200w\" sizes=\"auto, (max-width: 450px) 100vw, 450px\" \/><\/a><\/p>\n<p>\u0412 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435 ATmega8\u00a0 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 RC \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0439 \u043d\u0430 \u0447\u0430\u0441\u0442\u043e\u0442\u0435 \u043e\u0442 1 \u0434\u043e 8 \u041c\u0413\u0446, \u0435\u0441\u043b\u0438 \u0412\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u0432\u0430\u0436\u043d\u0430 \u0447\u0430\u0441\u0442\u043e\u0442\u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 delay), \u0442\u043e \u0432\u043e \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u0432\u0430\u0440\u0446\u0435\u0432\u044b\u0439 \u0440\u0435\u0437\u043e\u043d\u0430\u0442\u043e\u0440 \u043c\u043e\u0436\u043d\u043e \u043d\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c. \u0412 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u0431\u044b\u043b \u043a\u0432\u0430\u0440\u0446 \u043d\u0430 4 \u041c\u0413\u0446 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445, \u0432 \u0447\u0430\u0441\u0430\u0445 \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u0432\u0430\u0440\u0446\u0435\u0432\u044b\u0439 \u0440\u0435\u0437\u043e\u043d\u0430\u0442\u043e\u0440 \u043c\u043e\u0436\u043d\u043e \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c.<\/p>\n<div id=\"marketWidget\"><\/div>\n<p>\u0422\u0430\u043a \u0436\u0435 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0439\u0442\u0435 \u0447\u0442\u043e\u00a0<strong>ATmega8<\/strong>\u00a0\u0438\u043c\u0435\u0435\u0442 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u043f\u0438\u0442\u0430\u044e\u0449\u0435\u0433\u043e \u043d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u044f \u043e\u0442 4.5 \u0434\u043e 5.5 \u0412 \u0438 \u0442\u0430\u043a\u0442\u043e\u0432\u0443\u044e \u0434\u043e 16 \u041c\u0413\u0446, \u0430\u00a0<strong>ATmega8L<\/strong>\u00a0\u0438\u043c\u0435\u0435\u0442 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u043f\u0438\u0442\u0430\u044e\u0449\u0435\u0433\u043e \u043d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u044f \u043e\u0442 2.7 \u0434\u043e 5.5 \u0412 \u0438 \u0442\u0430\u043a\u0442\u043e\u0432\u0443\u044e \u0447\u0430\u0441\u0442\u043e\u0442\u0443 \u0434\u043e 8 \u041c\u0413\u0446.<\/p>\n<p style=\"text-align: center;\"><strong>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0447\u0430\u0441\u0442\u043e\u0442\u044b \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432 Arduino IDE<\/strong><\/p>\n<p style=\"text-align: center;\">External &#8212; \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u0432\u0430\u0440\u0446\u0435\u0432\u044b\u0439 \u0440\u0435\u0437\u043e\u043d\u0430\u0442\u043e\u0440<\/p>\n<p style=\"text-align: center;\">Internal &#8212; \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 RC \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440<\/p>\n<p><a href=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2020\/08\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2020-08-20-195745.png\" class=\"highslide-image\" onclick=\"return hs.expand(this);\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-83102\" src=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2020\/08\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2020-08-20-195745.png\" alt=\"\" width=\"172\" height=\"351\" \/><\/a><\/p>\n<p><a href=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2020\/08\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2020-08-20-200246.png\" class=\"highslide-image\" onclick=\"return hs.expand(this);\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-83103 size-full\" src=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2020\/08\/-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2020-08-20-200246-e1597932189790.png\" alt=\"\" width=\"282\" height=\"170\" \/><\/a> <a href=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2020\/08\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2020-08-20-200241.png\" class=\"highslide-image\" onclick=\"return hs.expand(this);\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-83104 size-full\" src=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2020\/08\/-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2020-08-20-200241-e1597932199335.png\" alt=\"\" width=\"281\" height=\"165\" \/><\/a> <a href=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2020\/08\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2020-08-20-200235.png\" class=\"highslide-image\" onclick=\"return hs.expand(this);\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-83105 size-full\" src=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2020\/08\/-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2020-08-20-200235-e1597932220414.png\" alt=\"\" width=\"581\" height=\"427\" srcset=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2020\/08\/-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2020-08-20-200235-e1597932220414.png 581w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2020\/08\/-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2020-08-20-200235-e1597932220414-200x147.png 200w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2020\/08\/-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2020-08-20-200235-e1597932220414-500x367.png 500w\" sizes=\"auto, (max-width: 581px) 100vw, 581px\" \/><\/a><\/p>\n<pre class=\"actionscript\" style=\"font-family: monospace; font-size: 10px;\"><span style=\"color: #808080; font-style: italic;\">#include &lt;DS3231.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;STM32_TM1637.h&gt;<\/span>\r\n  DS3231 clock;\r\n  RTCDateTime DateTime;\r\n  STM32_TM1637 tm<span style=\"color: #66cc66;\">(<\/span>PD2,PD3<span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #808080; font-style: italic;\">\/\/ CLK, DIO <\/span>\r\n  <span style=\"color: #0066cc;\">int<\/span> timer;\r\n  byte hour,minut;\r\n  bool w;\r\n\u00a0\r\n  <span style=\"color: #808080; font-style: italic;\">\/\/ PD0, PD1(2, 3) = RXD TXD<\/span>\r\n  <span style=\"color: #808080; font-style: italic;\">\/\/ PC3(26) = SQW DS3231<\/span>\r\n  <span style=\"color: #808080; font-style: italic;\">\/\/ PC2(25) = HOUR+<\/span>\r\n  <span style=\"color: #808080; font-style: italic;\">\/\/ PC1(24) = MINUTE+<\/span>\r\n  <span style=\"color: #808080; font-style: italic;\">\/\/ PC4(27) = SDA<\/span>\r\n  <span style=\"color: #808080; font-style: italic;\">\/\/ PC5(28) = SCL<\/span>\r\n  <span style=\"color: #808080; font-style: italic;\">\/\/ PD2, PD3(4, 5) = CLK DIO TM1637<\/span>\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   Wire.<span style=\"color: #006600;\">begin<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;\r\n   clock.<span style=\"color: #006600;\">begin<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;\r\n   tm.<span style=\"color: #006600;\">brig<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">7<\/span><span style=\"color: #66cc66;\">)<\/span>;\r\n   clock.<span style=\"color: #006600;\">setOutput<\/span><span style=\"color: #66cc66;\">(<\/span>DS3231_1HZ<span style=\"color: #66cc66;\">)<\/span>;\r\n   PORTC <span style=\"color: #66cc66;\">|<\/span>= <span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">1<\/span> <span style=\"color: #66cc66;\">&lt;&lt;<\/span> <span style=\"color: #cc66cc;\">2<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">|<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">1<\/span> <span style=\"color: #66cc66;\">&lt;&lt;<\/span> <span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">)<\/span>; <span style=\"color: #808080; font-style: italic;\">\/\/ INPUT_PULLUP PC1 PC2<\/span>\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  DateTime = clock.<span style=\"color: #006600;\">getDateTime<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;\r\n  hour = DateTime.<span style=\"color: #006600;\">hour<\/span>;\r\n  minut = DateTime.<span style=\"color: #006600;\">minute<\/span>;\r\n  timer = hour<span style=\"color: #66cc66;\">*<\/span><span style=\"color: #cc66cc;\">100<\/span> + minut;\r\n  tm.<span style=\"color: #006600;\">print_time<\/span><span style=\"color: #66cc66;\">(<\/span>timer, <span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">(<\/span>PINC <span style=\"color: #66cc66;\">&gt;&gt;<\/span> <span style=\"color: #cc66cc;\">3<\/span><span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">&amp;<\/span> <span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">)<\/span>;\r\n\u00a0\r\n  <span style=\"color: #b1b100;\">if<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">(<\/span>PINC <span style=\"color: #66cc66;\">&gt;&gt;<\/span> <span style=\"color: #cc66cc;\">2<\/span><span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">&amp;<\/span> <span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">)<\/span> == LOW<span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span> <span style=\"color: #808080; font-style: italic;\">\/\/\/\/\/\/\/ BUTTON PC2<\/span>\r\n    w=<span style=\"color: #cc66cc;\">1<\/span>; hour++; <span style=\"color: #b1b100;\">if<\/span><span style=\"color: #66cc66;\">(<\/span>hour<span style=\"color: #66cc66;\">&gt;<\/span><span style=\"color: #cc66cc;\">23<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>hour=<span style=\"color: #cc66cc;\">0<\/span>;<span style=\"color: #66cc66;\">}<\/span> delay<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">300<\/span><span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #66cc66;\">}<\/span>\r\n  <span style=\"color: #b1b100;\">if<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">(<\/span>PINC <span style=\"color: #66cc66;\">&gt;&gt;<\/span> <span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">&amp;<\/span> <span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">)<\/span> == LOW<span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span> <span style=\"color: #808080; font-style: italic;\">\/\/\/\/\/\/\/ BUTTON PC1<\/span>\r\n    w=<span style=\"color: #cc66cc;\">1<\/span>; minut++; <span style=\"color: #b1b100;\">if<\/span><span style=\"color: #66cc66;\">(<\/span>minut<span style=\"color: #66cc66;\">&gt;<\/span><span style=\"color: #cc66cc;\">59<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>minut=<span style=\"color: #cc66cc;\">0<\/span>;<span style=\"color: #66cc66;\">}<\/span> delay<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">300<\/span><span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #66cc66;\">}<\/span>\r\n <span style=\"color: #808080; font-style: italic;\">\/\/\/\/\/\/\/\/\/\/ SET CLOCK<\/span>\r\n <span style=\"color: #b1b100;\">if<\/span><span style=\"color: #66cc66;\">(<\/span>w == <span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>w=<span style=\"color: #cc66cc;\">0<\/span>; clock.<span style=\"color: #006600;\">setDateTime<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">2020<\/span>, <span style=\"color: #cc66cc;\">8<\/span>, <span style=\"color: #cc66cc;\">20<\/span>, hour, minut, <span style=\"color: #cc66cc;\">0<\/span><span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #66cc66;\">}<\/span>\r\n  delay<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">100<\/span><span style=\"color: #66cc66;\">)<\/span>;\r\n  <span style=\"color: #66cc66;\">}<\/span><\/pre>\n<p>\u0422\u0430\u043a \u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0447\u0430\u0441\u044b \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0431\u0443\u0434\u0438\u043b\u044c\u043d\u0438\u043a\u043e\u043c. \u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0447\u0430\u0441\u0430\u043c\u0438 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0442\u0440\u0435\u0445 \u043a\u043d\u043e\u043f\u043e\u043a, \u043a\u043d\u043e\u043f\u043a\u0430 SET \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043c\u0435\u043d\u044f\u0442\u044c \u0440\u0435\u0436\u0438\u043c\u044b:<\/p>\n<ul>\n<li>\u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0440\u0435\u0436\u0438\u043c (\u0441\u0435\u043a\u0443\u043d\u0434\u043d\u043e\u0435 \u0434\u0432\u043e\u0435\u0442\u043e\u0447\u0438\u0435 \u043c\u0438\u0433\u0430\u0435\u0442 \u0432 \u0442\u0430\u043a\u0442 \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u043c) &#8212; \u043a\u043d\u043e\u043f\u043a\u0430 + \u0438 &#8212; \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u044e\u0442 \u0438\u043b\u0438 \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442 \u0431\u0443\u0434\u0438\u043b\u044c\u043d\u0438\u043a, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0437\u0430\u0433\u043e\u0440\u0430\u0435\u0442\u0441\u044f \u0438 \u0433\u0430\u0441\u043d\u0435\u0442 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434 &#8212; \u0438\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0438\u043b\u044c\u043d\u0438\u043a\u0430<\/li>\n<li>\u0412\u0442\u043e\u0440\u043e\u0439 \u0440\u0435\u0436\u0438\u043c (\u0441\u0435\u043a\u0443\u043d\u0434\u043d\u043e\u0435 \u0434\u0432\u043e\u0435\u0442\u043e\u0447\u0438\u0435 \u0433\u043e\u0440\u0438\u0442 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e) &#8212; \u0440\u0435\u0436\u0438\u043c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 (\u043a\u043d\u043e\u043f\u043a\u0438 + \u0438 &#8212; \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u0443\u044e\u0442 \u0447\u0430\u0441\u044b \u0438 \u043c\u0438\u043d\u0443\u0442\u044b)<\/li>\n<li>\u0422\u0440\u0435\u0442\u0438\u0439 \u0440\u0435\u0436\u0438\u043c (\u0441\u0435\u043a\u0443\u043d\u0434\u043d\u043e\u0435 \u0434\u0432\u043e\u0435\u0442\u043e\u0447\u0438\u0435 \u043d\u0435 \u0433\u043e\u0440\u0438\u0442) &#8212; \u0440\u0435\u0436\u0438\u043c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0431\u0443\u0434\u0438\u043b\u044c\u043d\u0438\u043a\u0430 (\u043a\u043d\u043e\u043f\u043a\u0438 + \u0438 &#8212; \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u0443\u044e\u0442 \u0447\u0430\u0441\u044b \u0438 \u043c\u0438\u043d\u0443\u0442\u044b)<\/li>\n<\/ul>\n<p><a href=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2020\/08\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2020-08-20-201617.png\" class=\"highslide-image\" onclick=\"return hs.expand(this);\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-83110\" src=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2020\/08\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2020-08-20-201617.png\" alt=\"\" width=\"468\" height=\"554\" srcset=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2020\/08\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2020-08-20-201617.png 468w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2020\/08\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2020-08-20-201617-200x237.png 200w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2020\/08\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2020-08-20-201617-422x500.png 422w\" sizes=\"auto, (max-width: 468px) 100vw, 468px\" \/><\/a><\/p>\n<pre class=\"actionscript\" style=\"font-family: monospace; font-size: 10px;\"><span style=\"color: #808080; font-style: italic;\">#include &lt;EEPROM.h&gt;<\/span>\r\n<span style=\"color: #808080; font-style: italic;\">#include &lt;DS3231.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;STM32_TM1637.h&gt;<\/span>\r\n  DS3231 clock;\r\n  RTCDateTime DateTime;\r\n  STM32_TM1637 tm<span style=\"color: #66cc66;\">(<\/span>PD2,PD3<span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #808080; font-style: italic;\">\/\/ CLK, DIO <\/span>\r\n  <span style=\"color: #0066cc;\">int<\/span> timer;\r\n  byte hour,minut,hh,mm,sett;\r\n  bool w,ww,alarm;\r\n\u00a0\r\n  <span style=\"color: #808080; font-style: italic;\">\/\/ PD0, PD1(2, 3) = RXD TXD<\/span>\r\n  <span style=\"color: #808080; font-style: italic;\">\/\/ PC3(26) = SQW DS3231<\/span>\r\n  <span style=\"color: #808080; font-style: italic;\">\/\/ PC2(25) = HOUR+<\/span>\r\n  <span style=\"color: #808080; font-style: italic;\">\/\/ PC1(24) = MINUTE+<\/span>\r\n  <span style=\"color: #808080; font-style: italic;\">\/\/ PC0(23) = SETTING<\/span>\r\n  <span style=\"color: #808080; font-style: italic;\">\/\/ PC4(27) = SDA<\/span>\r\n  <span style=\"color: #808080; font-style: italic;\">\/\/ PC5(28) = SCL<\/span>\r\n  <span style=\"color: #808080; font-style: italic;\">\/\/ PD2, PD3(4, 5) = CLK DIO TM1637<\/span>\r\n  <span style=\"color: #808080; font-style: italic;\">\/\/ PB5(19) = LED ALARM\r\n<\/span>  <span style=\"color: #808080; font-style: italic;\">\/\/ PD6(12) = BYZZER ALARM<\/span>\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   Wire.<span style=\"color: #006600;\">begin<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;\r\n   clock.<span style=\"color: #006600;\">begin<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;\r\n   tm.<span style=\"color: #006600;\">brig<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">7<\/span><span style=\"color: #66cc66;\">)<\/span>;\r\n   clock.<span style=\"color: #006600;\">setOutput<\/span><span style=\"color: #66cc66;\">(<\/span>DS3231_1HZ<span style=\"color: #66cc66;\">)<\/span>;\r\n   PORTC <span style=\"color: #66cc66;\">|<\/span>= <span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">1<\/span> <span style=\"color: #66cc66;\">&lt;&lt;<\/span> <span style=\"color: #cc66cc;\">2<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">|<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">1<\/span> <span style=\"color: #66cc66;\">&lt;&lt;<\/span> <span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">|<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">1<\/span> <span style=\"color: #66cc66;\">&lt;&lt;<\/span> <span style=\"color: #cc66cc;\">0<\/span><span style=\"color: #66cc66;\">)<\/span>; <span style=\"color: #808080; font-style: italic;\">\/\/ INPUT_PULLUP PC0 PC1 PC2<\/span>\r\n   DDRB <span style=\"color: #66cc66;\">|<\/span>= <span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">1<\/span> <span style=\"color: #66cc66;\">&lt;&lt;<\/span> <span style=\"color: #cc66cc;\">5<\/span><span style=\"color: #66cc66;\">)<\/span>;\r\n   hh = EEPROM.<span style=\"color: #006600;\">read<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">0<\/span><span style=\"color: #66cc66;\">)<\/span>;mm = EEPROM.<span style=\"color: #006600;\">read<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">)<\/span>;alarm = EEPROM.<span style=\"color: #006600;\">read<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">2<\/span><span style=\"color: #66cc66;\">)<\/span>;\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  DateTime = clock.<span style=\"color: #006600;\">getDateTime<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;\r\n  hour = DateTime.<span style=\"color: #006600;\">hour<\/span>;\r\n  minut = DateTime.<span style=\"color: #006600;\">minute<\/span>;\r\n  timer = hour<span style=\"color: #66cc66;\">*<\/span><span style=\"color: #cc66cc;\">100<\/span> + minut;\r\n\u00a0\r\n <span style=\"color: #b1b100;\">if<\/span><span style=\"color: #66cc66;\">(<\/span>sett == <span style=\"color: #cc66cc;\">0<\/span><span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">{<\/span>tm.<span style=\"color: #006600;\">print_time<\/span><span style=\"color: #66cc66;\">(<\/span>timer, <span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">(<\/span>PINC <span style=\"color: #66cc66;\">&gt;&gt;<\/span> <span style=\"color: #cc66cc;\">3<\/span><span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">&amp;<\/span> <span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #66cc66;\">}<\/span>\r\n <span style=\"color: #b1b100;\">if<\/span><span style=\"color: #66cc66;\">(<\/span>sett == <span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">{<\/span>tm.<span style=\"color: #006600;\">print_time<\/span><span style=\"color: #66cc66;\">(<\/span>timer, <span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #66cc66;\">}<\/span>\r\n <span style=\"color: #b1b100;\">if<\/span><span style=\"color: #66cc66;\">(<\/span>sett == <span style=\"color: #cc66cc;\">2<\/span><span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">{<\/span>tm.<span style=\"color: #006600;\">print_time<\/span><span style=\"color: #66cc66;\">(<\/span>hh<span style=\"color: #66cc66;\">*<\/span><span style=\"color: #cc66cc;\">100<\/span>+mm, <span style=\"color: #cc66cc;\">0<\/span><span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #66cc66;\">}<\/span>\r\n\u00a0\r\n  <span style=\"color: #b1b100;\">if<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">(<\/span>PINC <span style=\"color: #66cc66;\">&gt;&gt;<\/span> <span style=\"color: #cc66cc;\">2<\/span><span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">&amp;<\/span> <span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">)<\/span> == LOW <span style=\"color: #66cc66;\">&amp;&amp;<\/span> sett == <span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span> <span style=\"color: #808080; font-style: italic;\">\/\/\/\/\/\/\/ BUTTON PC2 = HOUR+<\/span>\r\n    w=<span style=\"color: #cc66cc;\">1<\/span>; hour++; <span style=\"color: #b1b100;\">if<\/span><span style=\"color: #66cc66;\">(<\/span>hour<span style=\"color: #66cc66;\">&gt;<\/span><span style=\"color: #cc66cc;\">23<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>hour=<span style=\"color: #cc66cc;\">0<\/span>;<span style=\"color: #66cc66;\">}<\/span> delay<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">300<\/span><span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #66cc66;\">}<\/span>\r\n  <span style=\"color: #b1b100;\">if<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">(<\/span>PINC <span style=\"color: #66cc66;\">&gt;&gt;<\/span> <span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">&amp;<\/span> <span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">)<\/span> == LOW <span style=\"color: #66cc66;\">&amp;&amp;<\/span> sett == <span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span> <span style=\"color: #808080; font-style: italic;\">\/\/\/\/\/\/\/ BUTTON PC1 = MINUTE+<\/span>\r\n    w=<span style=\"color: #cc66cc;\">1<\/span>; minut++; <span style=\"color: #b1b100;\">if<\/span><span style=\"color: #66cc66;\">(<\/span>minut<span style=\"color: #66cc66;\">&gt;<\/span><span style=\"color: #cc66cc;\">59<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>minut=<span style=\"color: #cc66cc;\">1<\/span>;<span style=\"color: #66cc66;\">}<\/span> delay<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">300<\/span><span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #66cc66;\">}<\/span>\r\n\u00a0\r\n  <span style=\"color: #b1b100;\">if<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">(<\/span>PINC <span style=\"color: #66cc66;\">&gt;&gt;<\/span> <span style=\"color: #cc66cc;\">2<\/span><span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">&amp;<\/span> <span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">)<\/span> == LOW <span style=\"color: #66cc66;\">&amp;&amp;<\/span> sett == <span style=\"color: #cc66cc;\">2<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span> <span style=\"color: #808080; font-style: italic;\">\/\/\/\/\/\/\/ BUTTON ALARM PC2 = HOUR+<\/span>\r\n    ww=<span style=\"color: #cc66cc;\">1<\/span>; hh++; <span style=\"color: #b1b100;\">if<\/span><span style=\"color: #66cc66;\">(<\/span>hh<span style=\"color: #66cc66;\">&gt;<\/span><span style=\"color: #cc66cc;\">23<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>hh=<span style=\"color: #cc66cc;\">0<\/span>;<span style=\"color: #66cc66;\">}<\/span> delay<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">300<\/span><span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #66cc66;\">}<\/span>\r\n  <span style=\"color: #b1b100;\">if<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">(<\/span>PINC <span style=\"color: #66cc66;\">&gt;&gt;<\/span> <span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">&amp;<\/span> <span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">)<\/span> == LOW <span style=\"color: #66cc66;\">&amp;&amp;<\/span> sett == <span style=\"color: #cc66cc;\">2<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span> <span style=\"color: #808080; font-style: italic;\">\/\/\/\/\/\/\/ BUTTON ALARM PC1 = MINUTE+<\/span>\r\n    ww=<span style=\"color: #cc66cc;\">1<\/span>; mm++; <span style=\"color: #b1b100;\">if<\/span><span style=\"color: #66cc66;\">(<\/span>mm<span style=\"color: #66cc66;\">&gt;<\/span><span style=\"color: #cc66cc;\">59<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>mm=<span style=\"color: #cc66cc;\">0<\/span>;<span style=\"color: #66cc66;\">}<\/span> delay<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">300<\/span><span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #66cc66;\">}<\/span>\r\n\u00a0\r\n  <span style=\"color: #b1b100;\">if<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">(<\/span>PINC <span style=\"color: #66cc66;\">&gt;&gt;<\/span> <span style=\"color: #cc66cc;\">2<\/span><span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">&amp;<\/span> <span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">)<\/span> == LOW <span style=\"color: #66cc66;\">&amp;&amp;<\/span> sett == <span style=\"color: #cc66cc;\">0<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span> <span style=\"color: #808080; font-style: italic;\">\/\/\/\/\/\/\/ BUTTON PC2 = alarm on<\/span>\r\n    alarm = <span style=\"color: #cc66cc;\">1<\/span>; EEPROM.<span style=\"color: #006600;\">update<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">2<\/span>,alarm<span style=\"color: #66cc66;\">)<\/span>;delay<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">300<\/span><span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #66cc66;\">}<\/span>\r\n  <span style=\"color: #b1b100;\">if<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">(<\/span>PINC <span style=\"color: #66cc66;\">&gt;&gt;<\/span> <span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">&amp;<\/span> <span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">)<\/span> == LOW <span style=\"color: #66cc66;\">&amp;&amp;<\/span> sett == <span style=\"color: #cc66cc;\">0<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span> <span style=\"color: #808080; font-style: italic;\">\/\/\/\/\/\/\/ BUTTON PC1 = alarm off<\/span>\r\n    alarm = <span style=\"color: #cc66cc;\">0<\/span>; EEPROM.<span style=\"color: #006600;\">update<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">2<\/span>,alarm<span style=\"color: #66cc66;\">)<\/span>;delay<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">300<\/span><span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #66cc66;\">}<\/span>  \r\n    <span style=\"color: #b1b100;\">if<\/span><span style=\"color: #66cc66;\">(<\/span>alarm == <span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>PORTB <span style=\"color: #66cc66;\">|<\/span>= <span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">1<\/span> <span style=\"color: #66cc66;\">&lt;&lt;<\/span> <span style=\"color: #cc66cc;\">5<\/span><span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #66cc66;\">}<\/span><span style=\"color: #b1b100;\">else<\/span><span style=\"color: #66cc66;\">{<\/span>PORTB <span style=\"color: #66cc66;\">&amp;<\/span>= ~<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">1<\/span> <span style=\"color: #66cc66;\">&lt;&lt;<\/span> <span style=\"color: #cc66cc;\">5<\/span><span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #66cc66;\">}<\/span> \r\n\u00a0\r\n  <span style=\"color: #808080; font-style: italic;\">\/\/\/\/ setting<\/span>\r\n  <span style=\"color: #b1b100;\">if<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">(<\/span>PINC <span style=\"color: #66cc66;\">&gt;&gt;<\/span> <span style=\"color: #cc66cc;\">0<\/span><span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">&amp;<\/span> <span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">)<\/span> == LOW<span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>sett++;<span style=\"color: #b1b100;\">if<\/span><span style=\"color: #66cc66;\">(<\/span>sett <span style=\"color: #66cc66;\">&gt;<\/span> <span style=\"color: #cc66cc;\">2<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>sett=<span style=\"color: #cc66cc;\">0<\/span>;<span style=\"color: #66cc66;\">}<\/span>delay<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">300<\/span><span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #66cc66;\">}<\/span>\r\n\u00a0\r\n <span style=\"color: #808080; font-style: italic;\">\/\/\/\/\/\/\/\/\/\/ SET <\/span>\r\n <span style=\"color: #b1b100;\">if<\/span><span style=\"color: #66cc66;\">(<\/span>w == <span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>w=<span style=\"color: #cc66cc;\">0<\/span>; clock.<span style=\"color: #006600;\">setDateTime<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">2020<\/span>, <span style=\"color: #cc66cc;\">8<\/span>, <span style=\"color: #cc66cc;\">20<\/span>, hour, minut, <span style=\"color: #cc66cc;\">0<\/span><span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #66cc66;\">}<\/span>\r\n <span style=\"color: #b1b100;\">if<\/span><span style=\"color: #66cc66;\">(<\/span>ww == <span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>ww=<span style=\"color: #cc66cc;\">0<\/span>; EEPROM.<span style=\"color: #006600;\">update<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">0<\/span>,hh<span style=\"color: #66cc66;\">)<\/span>;EEPROM.<span style=\"color: #006600;\">update<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">1<\/span>,mm<span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #66cc66;\">}<\/span>\r\n\u00a0\r\n <span style=\"color: #b1b100;\">if<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">(<\/span>hh<span style=\"color: #66cc66;\">*<\/span><span style=\"color: #cc66cc;\">100<\/span>+mm == hour<span style=\"color: #66cc66;\">*<\/span><span style=\"color: #cc66cc;\">100<\/span>+minut<span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">&amp;&amp;<\/span> alarm==<span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>tone<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">6<\/span>,<span style=\"color: #cc66cc;\">1500<\/span>,<span style=\"color: #cc66cc;\">150<\/span><span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #66cc66;\">}<\/span>\r\n\u00a0\r\n <span style=\"color: #808080; font-style: italic;\">\/\/ delay(100);<\/span>\r\n  <span style=\"color: #66cc66;\">}<\/span><\/pre>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438:<\/p>\n<ul>\n<li><a href=\"http:\/\/forum.rcl-radio.ru\/misc.php?action=pan_download&amp;item=452&amp;download=1\">http:\/\/forum.rcl-radio.ru\/misc.php?action=pan_download&amp;item=452&amp;download=1<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/jarzebski\/Arduino-DS3231\/archive\/master.zip\">https:\/\/github.com\/jarzebski\/Arduino-DS3231\/archive\/master.zip<\/a><\/li>\n<\/ul>\n<p>\u0424\u043e\u0440\u0443\u043c &#8212; <a href=\"http:\/\/forum.rcl-radio.ru\/viewtopic.php?id=197\">http:\/\/forum.rcl-radio.ru\/viewtopic.php?id=197<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Arduino IDE \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 ATmega8. \u041c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 ATmega8 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d \u043f\u043e \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438 CMOS, 8-\u0440\u0430\u0437\u0440\u044f\u0434\u043d\u044b\u0439, \u043e\u0441\u043d\u043e\u0432\u0430\u043d \u043d\u0430 AVR \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435 RISC. \u0417\u0430 \u043e\u0434\u0438\u043d \u0442\u0430\u043a\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u0430 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f, \u043d\u0430 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 ATmega8 \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432 1MIPS \u043d\u0430 \u041c\u0413\u0446, \u0438 \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u0435\u043c\u0430\u044f \u044d\u043d\u0435\u0440\u0433\u0438\u044f. \u041a\u0430\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u043b\u0438 \u043f\u0440\u043e\u0448\u0438\u0442\u044c \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 Atmega8 \u0432 \u0441\u0440\u0435\u0434\u0435 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":83104,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[239,18],"tags":[],"class_list":["post-83100","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-arduino","category-18"],"views":7813,"_links":{"self":[{"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/posts\/83100","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=83100"}],"version-history":[{"count":7,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/posts\/83100\/revisions"}],"predecessor-version":[{"id":111215,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/posts\/83100\/revisions\/111215"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/media\/83104"}],"wp:attachment":[{"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=83100"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=83100"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=83100"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}