{"id":256379,"date":"2015-04-30T11:15:02","date_gmt":"2015-04-30T07:15:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=256379"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=256379","title":{"rendered":"\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0418\u041a \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 NEC \u043d\u0430 ATmega"},"content":{"rendered":"<p>     \t<img decoding=\"async\" align=\"left\" src=\"\/\/habrastorage.org\/files\/d30\/7e2\/c43\/d307e2c43bae48c3a6972f256d030a79.jpg\"\/> \u0414\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u0443\u0436\u0435 \u043c\u043d\u043e\u0433\u043e \u0433\u0434\u0435 \u043e\u043f\u0438\u0441\u0430\u043d. \u042f \u0445\u043e\u0447\u0443 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0438 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043d\u0430 \u043a\u043e\u043d\u043a\u0442\u0440\u0435\u0442\u043d\u043e\u043c \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435. \u041c\u043d\u0435 \u0431\u044b\u043b\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0441\u0438\u0433\u043d\u0430\u043b \u0441 \u043f\u0443\u043b\u044c\u0442\u0430 RGB, \u0442\u0430\u043a\u043e\u0433\u043e, \u043a\u0430\u043a \u043d\u0430 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0435. \u0415\u0433\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043a\u043e\u043c\u0430\u043d\u0434 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0430 \u0432\u043d\u0438\u0437\u0443 \u0441\u0442\u0430\u0442\u044c\u0438.<\/p>\n<p>  <b>\u041a\u0440\u0430\u0442\u043a\u0438\u0439 \u044d\u043a\u0441\u043a\u0443\u0440\u0441<\/b><br \/>  \u041a\u0430\u0436\u0434\u044b\u0439 \u043f\u0430\u043a\u0435\u0442 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 NEC \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0441\u0442\u0430\u0440\u0442\u043e\u0432\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u2013 \u0438\u043c\u043f\u0443\u043b\u044c\u0441\u0430 \u0434\u043b\u0438\u043d\u043e\u0439 9 \u043c\u0441 \u0438 \u043f\u0430\u0443\u0437\u044b \u0434\u043b\u0438\u043d\u043e\u0439 4,5 \u043c\u0441. \u0414\u0430\u0431\u044b \u043d\u0435 \u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0432\u0430\u0441 \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u0440\u0438\u0441\u0443\u043d\u043a\u0430\u043c\u0438, \u043f\u043e\u043a\u0430\u0436\u0443 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u044b \u0441 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430.<br \/>  <a name=\"habracut\"><\/a><br \/>  <img decoding=\"async\" src=\"\/\/habrastorage.org\/files\/987\/310\/7c7\/9873107c73a04ec9a44e3873838c3593.jpg\"\/><\/p>\n<p>  \u0421\u0430\u043c \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u043e\u0441\u043d\u043e\u0432\u0430\u043d \u0434\u043b\u044f \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043d\u0443\u043b\u0435\u0439 \u0438 \u0435\u0434\u0438\u043d\u0438\u0446 \u0434\u043b\u0438\u043d\u043e\u0439 \u043f\u0430\u0443\u0437\u044b. \u041d\u0430\u0447\u0430\u043b\u043e \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0431\u0438\u0442\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u043c\u043f\u0443\u043b\u044c\u0441\u043e\u043c \u0434\u043b\u0438\u043d\u043e\u0439 560 \u043c\u043a\u0441 (\u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e\u0442 \u0438\u043c\u043f\u0443\u043b\u044c\u0441 \u0441\u0438\u0433\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u043e \u043a\u043e\u043d\u0446\u0435 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0431\u0438\u0442\u0430). \u0414\u043b\u0438\u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0437\u0430 \u0438\u043c\u043f\u0443\u043b\u044c\u0441\u043e\u043c \u043f\u0430\u0443\u0437\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0431\u0438\u0442\u0430. \u0422\u0430\u043a \u0434\u043b\u0438\u043d\u0430 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043d\u0443\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f 1.12\u043c\u0441, \u0430 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0435\u0434\u0438\u043d\u0438\u0446\u044b 2.25\u043c\u0441. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043d\u044f\u0442\u0441\u044f.<\/p>\n<p>  <img decoding=\"async\" src=\"\/\/habrastorage.org\/files\/981\/e73\/2c8\/981e732c891b4b62a6f63656f3d67a38.jpg\"\/><br \/>  <img decoding=\"async\" src=\"\/\/habrastorage.org\/files\/306\/a50\/56d\/306a5056d5724d79b71fa23549198a05.jpg\"\/><\/p>\n<p>  \u041f\u0430\u043a\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0441\u0442\u0430\u0440\u0442\u043e\u0432\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0430\u0434\u0440\u0435\u0441\u0430 \u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b. \u0412 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 \u043f\u0430\u043a\u0435\u0442 \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u043c\u0435\u0435\u0442 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u0442\u0430\u043a \u043a\u0430\u043a \u0430\u0434\u0440\u0435\u0441 \u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u043a\u0430\u043a \u0432 \u043f\u0440\u044f\u043c\u043e\u043c, \u0442\u0430\u043a \u0438 \u0432 \u0438\u043d\u0432\u0435\u0440\u0441\u043d\u043e\u043c \u0432\u0438\u0434\u0435. <\/p>\n<p>  <img decoding=\"async\" src=\"\/\/habrastorage.org\/files\/e4e\/562\/f12\/e4e562f12bf0422eb3c6dcaa2afbb5aa.jpg\"\/><\/p>\n<p>  \u041f\u0440\u0438 \u0443\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0438 \u043a\u043d\u043e\u043f\u043a\u0438 \u043f\u043e\u0441\u044b\u043b\u043a\u0430 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u043d\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f. \u0412\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u043a\u0430\u0436\u0434\u044b\u0435 110 \u043c\u0441 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u043e\u0432\u0442\u043e\u0440\u0430.<\/p>\n<p>  <img decoding=\"async\" src=\"\/\/habrastorage.org\/files\/bbc\/7cc\/7b8\/bbc7cc7b809542ff8f60c629c8577066.jpg\"\/><\/p>\n<p>  <b>\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430<\/b><br \/>  \u042f \u043d\u0435 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u043b \u0430\u0434\u0440\u0435\u0441, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u043c\u043d\u0435 \u043d\u0435 \u043d\u0443\u0436\u0435\u043d. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438, \u0432\u044b \u043b\u0435\u0433\u043a\u043e \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u0431\u044b\u043b\u0430 \u0432\u044b\u0431\u0440\u0430\u043d\u0430 ATmega32 \u0441 16\u041c\u0413\u0446 \u043a\u0432\u0430\u0440\u0446\u0435\u043c. \u0421\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0432\u0441\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u044b \u0440\u0430\u0441\u0447\u0438\u0442\u0430\u043d\u044b \u0434\u043b\u044f 16\u041c\u0433\u0446. \u0414\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0442\u0430\u0439\u043c\u0435\u0440 \u0434\u043b\u044f \u043e\u0442\u0441\u0447\u0435\u0442\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0438 \u0432\u043d\u0435\u0448\u043d\u0435\u0435 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0435 \u043f\u043e \u043d\u0438\u0441\u043f\u0430\u0434\u0430\u044e\u0449\u0435\u043c\u0443 \u0444\u0440\u043e\u043d\u0442\u0443. \u0422\u0430\u0439\u043c\u0435\u0440 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d \u0441 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u0435\u043c 1024, \u043e\u0434\u0438\u043d \u0442\u0430\u043a\u0442 1024\/16\u041c\u0413\u0446 = 64\u043c\u043a\u0441, \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0435 \u043f\u043e \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044e 64\u043c\u043a\u0441 * 256 = 16\u043c\u0441 (\u0447\u0442\u043e \u0437\u0430\u0432\u0435\u0434\u043e\u043c\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u043b\u044e\u0431\u043e\u0433\u043e \u0438\u0437 \u0431\u0438\u0442\u043e\u0432 \u0432 \u043f\u0430\u043a\u0435\u0442\u0435, \u044d\u0442\u043e \u043d\u0430\u043c \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f). \u041d\u0430\u0447\u0430\u043b\u044c\u043d\u0430\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0438 \u043c\u0430\u043a\u0440\u043e\u0441\u044b \u0441\u0442\u0430\u0440\u0442\/\u0441\u0442\u043e\u043f \u0442\u0430\u0439\u043c\u0435\u0440\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u0442\u0430\u043a.<\/p>\n<pre><code>#define StopT0\tTIMSK &= ~(1 &lt;&lt; TOIE0); \/\/\u043c\u0430\u043a\u0440\u043e\u0441 \u0434\u043b\u044f \u0441\u0442\u0430\u0440\u0442\u0430 \u0442\u0430\u0439\u043c\u0435\u0440\u0430 #define StartT0\tTIMSK |= (1 &lt;&lt; TOIE0);\t\/\/\u043c\u0430\u043a\u0440\u043e\u0441 \u0441\u0442\u043e\u043f \u0442\u0430\u0439\u043c\u0435\u0440\u0430    SREG|= (1&lt;&lt;7); \/\/Global Interrupt Enable GICR|= (1&lt;&lt;INT0); \/\/\u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0435 \u043f\u043e INT0    MCUCR|=(1&lt;&lt;ISC01)|(0&lt;&lt;ISC00); \/\/\u043f\u043e \u043d\u0438\u0441\u043f\u0430\u0434\u0430\u044e\u0449\u0435\u043c\u0443 \u0444\u0440\u043e\u043d\u0442\u0443    TCCR0|=(1&lt;&lt;CS02)|(1&lt;&lt;CS00); \/\/\u0414\u0435\u043b\u0438\u0442\u0435\u043b\u044c 1024, \u043e\u0434\u0438\u043d \u0442\u0430\u043a\u0442 64\u043c\u043a\u0441, \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u0435\u043d\u0438\u0435 16,38 \u043c\u0441 asm(&quot;sei&quot;);  \/\/\u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0432\u0441\u0435 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f <\/code><\/pre>\n<p>  \u041a\u043e\u0434 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u0432 \u0441\u0440\u0435\u0434\u0435 IAR, \u043d\u043e \u043b\u0435\u0433\u043a\u043e \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u0432 \u0434\u0440\u0443\u0433\u0443\u044e \u0441\u0440\u0435\u0434\u0443, \u043f\u0443\u0442\u0435\u043c \u0437\u0430\u043c\u0435\u043d\u044b \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0439.<br \/>  \u041f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0435 \u043f\u043e \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044e \u0442\u0430\u0439\u043c\u0435\u0440\u0430 \u043d\u0443\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u201c\u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f\u201d \u043f\u0440\u0438\u0435\u043c\u0430. \u041f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0432 16\u043c\u0441 \u0431\u043e\u043b\u044c\u0448\u0435 \u043b\u044e\u0431\u043e\u0439 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u0439 \u043f\u0430\u043a\u0435\u0442\u0430, \u0431\u0443\u0434\u044c \u0442\u043e \u043f\u0440\u0435\u0430\u043c\u0431\u043e\u043b\u0430 \u0438\u043b\u0438 \u0431\u0438\u0442, \u0442\u0430\u043a \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u0435\u043c \u043f\u0440\u0438\u0435\u043c\u0430 \u043f\u0430\u043a\u0435\u0442\u0430 \u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c\u0441\u044f \u043a \u043f\u0440\u0438\u0435\u043c\u0443 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e.<br \/>  \u0417\u0434\u0435\u0441\u044c \u0443 \u043c\u0435\u043d\u044f \u0432\u043e\u0437\u043d\u0438\u043a \u043e\u0434\u0438\u043d \u043d\u044e\u0430\u043d\u0441, \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u044f \u043d\u0435 \u0437\u043d\u0430\u044e. \u041f\u0440\u0438 \u043f\u0443\u0441\u043a\u0435 \u0442\u0430\u0439\u043c\u0435\u0440\u0430 \u0441\u0440\u0430\u0437\u0443 (\u0441\u0430\u043c\u043e \u0441\u043e\u0431\u043e\u0439 \u043f\u043e\u0441\u043b\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f INT0) \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043b\u043e \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0435 \u043f\u043e \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044e \u0442\u0430\u0439\u043c\u0435\u0440\u0430. \u041a\u0430\u043a? \u0417\u0430\u0447\u0435\u043c? \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u044d\u0442\u043e \u0431\u044b\u043b \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0438\u043d\u0434\u0438\u0432\u0438\u0434\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0441\u044f\u043a, \u0438\u0431\u043e \u043e\u0431\u0449\u0430\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043d\u0430 \u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442 \u0443\u0436\u0435 \u0431\u044b\u043b\u0430 \u043d\u0435 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0430\u044f, \u043d\u043e \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u0435\u0440\u0432\u043e\u0435 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0435 \u043d\u0435 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c, \u0430 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0432\u0442\u043e\u0440\u043e\u0435, \u0442.\u0435 \u0443\u0436\u0435 32\u043c\u0441.<\/p>\n<pre><code>#pragma vector=TIMER0_OVF_vect __interrupt void TIMER0_interrupt (void) \/\/\u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u04220 16\u043c\u0441, \u0447\u0442\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u043b\u044e\u0431\u043e\u0433\u043e \u0438\u0437 \u043a\u0443\u0441\u043a\u043e\u0432 \u043f\u0430\u043a\u0435\u0442\u0430 { if (firstT ==0) { firstT = 1; }   \/* \u041f\u0435\u0440\u0432\u043e\u0435 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043f\u0440\u0438 \u0435\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0435, \u043e\u043d\u043e \u043d\u0430\u043c \u043d\u0435 \u043d\u0430\u0434\u043e.  \u0414\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043d\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442, \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u0441\u044f \u0434\u043e 32\u043c\u0441. *\/ else {  \tstartC = 0; \/\/\u0436\u0434\u0435\u043c \u043d\u043e\u0432\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \tfirstT = 0; \/\/\u0434\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e &quot;\u043f\u0435\u0440\u0432\u043e\u0433\u043e&quot; \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \tStopT0; \/\/\u0441\u0442\u043e\u043f \u0442\u0430\u0439\u043c\u0435\u0440 } } <\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0435 \u043f\u043e \u043d\u0438\u0441\u043f\u0430\u0434\u0430\u044e\u0449\u0435\u043c\u0443 \u0444\u0440\u043e\u043d\u0442\u0443 INT0. \u0422\u0443\u0442 \u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0431\u0438\u0442\u044b \u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0432\u0440\u0435\u043c\u044f, \u043f\u0440\u043e\u0439\u0434\u0435\u043d\u043d\u043e\u0435 \u0441 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f. \u041f\u043e \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 TCNT0 \u043b\u0435\u0433\u043a\u043e \u043f\u043e\u044f\u043d\u044f\u0442\u044c, \u043a\u0430\u043a\u043e\u0439 \u0431\u0438\u0442 \u044d\u0442\u043e \u0431\u044b\u043b. \u0412 \u043a\u043e\u043d\u0446\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u043e\u0431\u043d\u0443\u043b\u044f\u0435\u043c, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0447\u0430\u0442\u044c \u043e\u0442\u0441\u0447\u0435\u0442 \u0441\u043d\u0430\u0447\u0430\u043b\u0430.<\/p>\n<pre><code>#pragma vector=INT0_vect __interrupt void INT0_interrupt (void) { if (startC == 0) { \/\/\u043f\u0435\u0440\u0432\u043e\u0435 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0435 newC = 0; \/\/\u0444\u043b\u0430\u0433 \u043d\u043e\u0432\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b startC = 1; \/\/\u043d\u0430\u0447\u0430\u043b\u0438 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c StartT0; \/\/\u0441\u0442\u0430\u0440\u0442 \u04220 } else {  \t\t\/\/\u043e\u0434\u0438\u043d \u043e\u0442\u0441\u0447\u0435\u0442 \u0442\u0430\u0439\u043c\u0435\u0440\u0430 \u0440\u0430\u0432\u0435\u043d 64\u043c\u043a\u0441, \u0432\u0441\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u044e\u0442\u0441\u044f \u043d\u0430 \u043d\u0435\u043a\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435  \t\t\tif(TCNT0&gt;0xD2 & TCNT0&lt;0xFF){ \/\/13,5 \u043c\u0441 \u0421\u0422\u0410\u0420\u0422 \u0431\u0438\u0442 (\u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d 13,4 ... 16,3 \u043c\u0441) \t\t\t\ti = 32; \/\/\u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0431\u0438\u0442 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u043e\u0439 \u043f\u043e\u0441\u044b\u043b\u043a\u0438 \t\t\t\t}  \t\t\tif(TCNT0&gt;0x07 & TCNT0&lt;0x16){ \/\/1,12\u043c\u0441 \u041d\u041e\u041b\u042c (\u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d 0,45 ... 1,41 \u043c\u0441) \t\t\t\tif ((i&gt;0) & (i&lt;9)) Command1 &= ~(1&lt;&lt;(i-1)); \/\/\u0437\u0430\u043f\u0438\u0441\u044c \u0431\u0438\u0442\u0430 \u0432 \u043f\u0440\u044f\u043c\u0443\u044e  \t\t\t\tif ((i&gt;8) & (i&lt;17)) Command |= (1&lt;&lt;(i-9)); \/\/\u0438 \u0438\u043d\u0432\u0435\u0440\u0441\u043d\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u044b \t\t\t\ti--;  \t\t\t\t} \t\t\t\t \t\t\tif(TCNT0&gt;0x19 & TCNT0&lt;0x28){ \/\/2,25\u043c\u0441 \u0415\u0414\u0418\u041d\u0418\u0426\u0410 (\u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d 1,60 ... 2,56 \u043c\u0441) \t\t\t\tif ((i&gt;0) & (i&lt;9)) Command1 |= (1&lt;&lt;(i-1)); \/\/\u0437\u0430\u043f\u0438\u0441\u044c \u0431\u0438\u0442\u0430 \u0432 \u043f\u0440\u044f\u043c\u0443\u044e \t\t\t\tif ((i&gt;8) & (i&lt;17)) Command &= ~(1&lt;&lt;(i-9)); \/\/\u0438 \u0438\u043d\u0432\u0435\u0440\u0441\u043d\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u044b \t\t\t\ti--; \t\t\t\t}  \t\t\tif(TCNT0&gt;0xA9 & TCNT0&lt;0xB8){ \/\/11,25\u043c\u0441 \u043f\u043e\u0432\u0442\u043e\u0440 \u043a\u043e\u043c\u0430\u043d\u0434\u044b (\u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d 10,8 ... 11,8 \u043c\u0441) \t\t\t\tnewC = 1; \/\/\u043f\u043e\u0432\u0442\u043e\u0440 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \t\t\t\t} \t\t\t\t \t\t\tif (i==0) { \/\/\u0432\u0441\u0435 \u0431\u0438\u0442\u044b \u043f\u0440\u0438\u043d\u044f\u0442\u044b \t\t\t\tStopT0; \/\/\u0441\u0442\u043e\u043f \u0442\u0430\u0439\u043c\u0435\u0440 \t\t\t\tnewC = 1; \/\/\u044d\u0442\u043e \u043d\u043e\u0432\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \t\t\t\tstartC = 0; \/\/\u0436\u0434\u0435\u043c \u043d\u043e\u0432\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \t\t\t\tfirstT = 0;\t\/\/\u0434\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e &quot;\u043f\u0435\u0440\u0432\u043e\u0433\u043e&quot; \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0442\u0430\u0439\u043c\u0435\u0440\u0430\t\t\t             } } TCNT0 = 0; \/\/\u043e\u0431\u043d\u0443\u043b\u044f\u0435\u043c \u0441\u0447\u0435\u0442\u0447\u0438\u043a } <\/code><\/pre>\n<p>  \u0412 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0444\u043b\u0430\u0433 newC, \u043d\u0435 \u0437\u0430\u0431\u044b\u0432 \u043e\u0431\u043d\u0443\u043b\u0438\u0442\u044c \u0435\u0433\u043e. \u041d\u0443 \u0438 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0430\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u044b.<\/p>\n<pre><code>while(1)     { \tif (newC) { \/\/\u0435\u0441\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0430? \t\t\tnewC = 0;\t\/\/\u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0435\u0442             if (Command == Command1) { \/\/\u0440\u0430\u0432\u043d\u044b \u043b\u0438 \u043f\u0440\u044f\u043c\u0430\u044f \u0438 \u0438\u043d\u0432\u0435\u0440\u0441\u043d\u0430\u044f? \t\t\tswitch (Command) { \/\/\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043a\u043e\u043c\u0430\u043d\u0434                 case 0x5F: { } \/\/Up                 case 0xDF: { } \/\/Down \t\t\t\t\/\/........... \t\t\t\t} \t\t\t} \t\t\t} \t} <\/code><\/pre>\n<p>  <b>\u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u043a\u043e\u043c\u0430\u043d\u0434<\/b><br \/>  \u0410 \u0432\u043e\u0442 \u0438 \u0441\u0430\u043c\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043a\u043e\u043c\u0430\u043d\u0434 \u0434\u043b\u044f \u043f\u0443\u043b\u044c\u0442\u0430 ED618 (\u043f\u043e\u043a\u0443\u043f\u0430\u044e \u0438\u0445 \u043d\u0430 dx.com):<br \/>  <img decoding=\"async\" align=\"left\" src=\"\/\/habrastorage.org\/files\/627\/3cd\/1a9\/6273cd1a902740329042daeb5de23e8a.jpg\"\/><\/p>\n<p>  \u0414\u043b\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u0442\u0430\u043a\u0438\u0445 \u0436\u0435 RGB \u043f\u0443\u043b\u044c\u0442\u043e\u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043a\u043e\u043c\u0430\u043d\u0434 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0434\u0440\u0443\u0433\u0430\u044f! \u0423 \u043c\u0435\u043d\u044f \u0435\u0441\u0442\u044c \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 \u043f\u0443\u043b\u044c\u0442, \u0434\u043e\u0441\u0442\u0430\u043b\u0441\u044f \u043c\u043d\u0435 \u043e\u0442 \u043a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u043f\u043e\u043a\u0443\u043f\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 RGB, \u0442\u0430\u043a \u0442\u0430\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043a\u043e\u043c\u0430\u043d\u0434 \u0432\u0435\u0441\u044c\u043c\u0430 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f. \u0421\u0447\u0438\u0442\u044b\u0432\u0430\u0439\u0442\u0435 \u0438 \u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0441\u0430\u043c\u0438. \u042f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u043b \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0438 \u0441\u043a\u0438\u0434\u044b\u0432\u0430\u043b \u0435\u0435 \u043f\u043e UART&#8217;\u0443 \u043d\u0430 \u043a\u043e\u043c\u043f.<\/p>\n<p>  <br clear=\"left\"\/>  \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u0430\u043c \u043f\u043e \u0441\u0435\u0431\u0435 \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0439, \u043d\u0430\u0434\u0435\u044e\u0441\u044c \u043a\u043e\u043c\u0443-\u0442\u043e \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f. \u0423 \u043c\u0435\u043d\u044f \u0443\u0436\u0435 \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u043d\u0435 \u043e\u0434\u043d\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0443\u043b\u044c\u0442\u0430 \u0441 \u0442\u0430\u043a\u0438\u043c \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u043c, \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0445\u043e\u0440\u043e\u0448\u043e. \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043f\u0440\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u043e\u0432 ws2812b, \u0435\u0441\u043b\u0438 \u0437\u0430\u0445\u043e\u0442\u0438\u0442\u0435 \u043a\u043e\u043d\u0435\u0447\u043d\u043e.     \t<\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/257041\/\"> http:\/\/habrahabr.ru\/post\/257041\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>     \t<img decoding=\"async\" align=\"left\" src=\"\/\/habrastorage.org\/files\/d30\/7e2\/c43\/d307e2c43bae48c3a6972f256d030a79.jpg\"\/> \u0414\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u0443\u0436\u0435 \u043c\u043d\u043e\u0433\u043e \u0433\u0434\u0435 \u043e\u043f\u0438\u0441\u0430\u043d. \u042f \u0445\u043e\u0447\u0443 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0438 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043d\u0430 \u043a\u043e\u043d\u043a\u0442\u0440\u0435\u0442\u043d\u043e\u043c \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435. \u041c\u043d\u0435 \u0431\u044b\u043b\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0441\u0438\u0433\u043d\u0430\u043b \u0441 \u043f\u0443\u043b\u044c\u0442\u0430 RGB, \u0442\u0430\u043a\u043e\u0433\u043e, \u043a\u0430\u043a \u043d\u0430 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0435. \u0415\u0433\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043a\u043e\u043c\u0430\u043d\u0434 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0430 \u0432\u043d\u0438\u0437\u0443 \u0441\u0442\u0430\u0442\u044c\u0438.<\/p>\n<p>  <b>\u041a\u0440\u0430\u0442\u043a\u0438\u0439 \u044d\u043a\u0441\u043a\u0443\u0440\u0441<\/b><br \/>  \u041a\u0430\u0436\u0434\u044b\u0439 \u043f\u0430\u043a\u0435\u0442 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 NEC \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0441\u0442\u0430\u0440\u0442\u043e\u0432\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u2013 \u0438\u043c\u043f\u0443\u043b\u044c\u0441\u0430 \u0434\u043b\u0438\u043d\u043e\u0439 9 \u043c\u0441 \u0438 \u043f\u0430\u0443\u0437\u044b \u0434\u043b\u0438\u043d\u043e\u0439 4,5 \u043c\u0441. \u0414\u0430\u0431\u044b \u043d\u0435 \u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0432\u0430\u0441 \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u0440\u0438\u0441\u0443\u043d\u043a\u0430\u043c\u0438, \u043f\u043e\u043a\u0430\u0436\u0443 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u044b \u0441 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-256379","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/256379","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=256379"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/256379\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=256379"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=256379"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=256379"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}