{"id":111620,"date":"2022-01-16T20:26:22","date_gmt":"2022-01-16T14:26:22","guid":{"rendered":"http:\/\/rcl-radio.ru\/?p=111620"},"modified":"2022-01-16T21:09:07","modified_gmt":"2022-01-16T15:09:07","slug":"%d1%88%d0%b8%d1%80%d0%be%d1%82%d0%bd%d0%be-%d0%b8%d0%bc%d0%bf%d1%83%d0%bb%d1%8c%d1%81%d0%bd%d0%b0%d1%8f-%d0%bc%d0%be%d0%b4%d1%83%d0%bb%d1%8f%d1%86%d0%b8%d1%8f-pwm-arduino-%d0%ba%d0%b0%d0%bb%d1%8c","status":"publish","type":"post","link":"http:\/\/rcl-radio.ru\/?p=111620","title":{"rendered":"PWM ARDUINO \u043a\u0430\u043b\u044c\u043a\u0443\u043b\u044f\u0442\u043e\u0440"},"content":{"rendered":"<p>\u0428\u0438\u0440\u043e\u0442\u043d\u043e-\u0438\u043c\u043f\u0443\u043b\u044c\u0441\u043d\u0430\u044f \u043c\u043e\u0434\u0443\u043b\u044f\u0446\u0438\u044f \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u043d\u043e \u0428\u0418\u041c (<strong>PWM<\/strong>) \u0432 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435 Arduino \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u044b\u0435 \u0438\u043c\u043f\u0443\u043b\u044c\u0441\u044b \u0441 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u043e\u0439 \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e \u0438\u043c\u043f\u0443\u043b\u044c\u0441\u0430 \u043f\u0440\u0438 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u043e\u0442\u0435 \u0438 \u0430\u043c\u043f\u043b\u0438\u0442\u0443\u0434\u0435 \u0438\u043c\u043f\u0443\u043b\u044c\u0441\u043e\u0432. \u0421\u0438\u0433\u043d\u0430\u043b \u0428\u0418\u041c \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043f\u043b\u0430\u0432\u043d\u043e\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043c\u043e\u0449\u043d\u043e\u0441\u0442\u0438 \u043d\u0430 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0435, \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u044e\u0449\u0435\u0439 \u043e\u0442 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u043f\u0438\u0442\u0430\u043d\u0438\u044f. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441 \u0446\u0435\u043b\u044c\u044e \u0440\u0435\u0433\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0432\u0430\u043b\u0430 \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u044f; \u043f\u043b\u0430\u0432\u043d\u043e\u0441\u0442\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u044f\u0440\u043a\u043e\u0441\u0442\u0438 \u043e\u0441\u0432\u0435\u0449\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u043f\u043e\u0434\u0441\u0432\u0435\u0442\u043a\u0438.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter\" src=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2020\/07\/%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-2020-07-19-123643.png\" \/><\/p>\n<p>\u041f\u043b\u0430\u0442\u044b Arduino Uno \u0438 Arduino Nano \u043d\u0430 \u0431\u0430\u0437\u0435 <strong>ATmega168\/328<\/strong> \u0438\u043c\u0435\u044e\u0442 6 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u044b\u0445 \u0428\u0418\u041c \u043c\u043e\u0434\u0443\u043b\u044f\u0442\u043e\u0440\u043e\u0432 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0430 D3, D5, D6, D9, D10, D11.<\/p>\n<div id=\"marketWidget\"><\/div>\n<p>\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0428\u0418\u041c \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u043c \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438,\u00a0<strong>analogWrite<\/strong> \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0430\u043d\u0430\u043b\u043e\u0433\u043e\u0432\u044b\u0439 \u0441\u0438\u0433\u043d\u0430\u043b \u0438 \u0437\u0430\u0434\u0430\u0435\u0442 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0438\u043c\u043f\u0443\u043b\u044c\u0441\u0430. Arduino \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u043d\u0430 \u0432\u044b\u0432\u043e\u0434\u0430\u0445 \u0447\u0430\u0441\u0442\u043e\u0442\u0443 488,28 \u0413\u0446 \u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 8 \u0440\u0430\u0437\u0440\u044f\u0434\u043e\u0432 (\u043e\u0442 0 \u0434\u043e 255).\u00a0 \u0417\u0430 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u0428\u0418\u041c \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0442 3 \u0442\u0430\u0439\u043c\u0435\u0440\u0430, \u0437\u0430 \u0432\u044b\u0445\u043e\u0434\u044b D5 \u0438 D6 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 Timer0, \u0437\u0430 D9 \u0438 D10 Timer1, \u0430 \u0437\u0430 \u0432\u044b\u0445\u043e\u0434\u044b D3 \u0438 D11 Timer2. \u0422\u0430\u0439\u043c\u0435\u0440\u044b 0 \u0438 2 8-\u0438 \u0431\u0438\u0442\u043d\u044b\u0435, \u0442\u0430\u0439\u043c\u0435\u0440 1 16-\u0438 \u0431\u0438\u0442\u043d\u044b\u0439.<\/p>\n<p>\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f <strong>analogWrite<\/strong> \u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u0440\u0443\u0433\u0443\u044e \u0447\u0430\u0441\u0442\u043e\u0442\u0443 \u0438\u043b\u0438 \u0440\u0430\u0437\u0440\u044f\u0434\u043d\u043e\u0441\u0442\u044c \u0428\u0418\u041c \u0441\u0438\u0433\u043d\u0430\u043b\u0430, \u043d\u043e \u0435\u0441\u043b\u0438 \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u043c \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0447\u0430\u0441\u0442\u043e\u0442\u0443 \u0428\u0418\u041c \u043e\u0442 7.6 \u0413\u0446 \u0434\u043e 62,5 \u043a\u0413\u0446 \u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u043e\u0442 8 \u0434\u043e 10 \u0431\u0438\u0442.<\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0428\u0418\u041c \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0442\u0430\u0439\u043c\u0435\u0440\u0430 1 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 <strong>ATmega168\/328.<\/strong><\/p>\n<pre><span style=\"color: #00979c;\">void<\/span> <span style=\"color: #5e6d03;\">setup<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">)<\/span> <span style=\"color: #000000;\">{<\/span>\r\n \u00a0<span style=\"color: #d35400;\">pinMode<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">9<\/span><span style=\"color: #434f54;\">,<\/span><span style=\"color: #00979c;\">OUTPUT<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span>\r\n \u00a0<span style=\"color: #000000;\">cli<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span>\r\n \u00a0<span style=\"color: #000000;\">TCCR1A<\/span> <span style=\"color: #434f54;\">=<\/span> <span style=\"color: #000000;\">0<\/span><span style=\"color: #000000;\">;<\/span>\r\n \u00a0<span style=\"color: #000000;\">TCCR1B<\/span> <span style=\"color: #434f54;\">=<\/span> <span style=\"color: #000000;\">0<\/span><span style=\"color: #000000;\">;<\/span>\r\n \u00a0<span style=\"color: #000000;\">TCNT1<\/span> <span style=\"color: #434f54;\">=<\/span> <span style=\"color: #000000;\">0<\/span><span style=\"color: #000000;\">;<\/span>\r\n \u00a0<span style=\"color: #000000;\">TCCR1A<\/span> <span style=\"color: #434f54;\">|=<\/span> <span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">1<\/span><span style=\"color: #434f54;\">&lt;&lt;<\/span><span style=\"color: #000000;\">COM1A1<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span>\r\n \u00a0<span style=\"color: #000000;\">TCCR1B<\/span> <span style=\"color: #434f54;\">|=<\/span> <span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">1<\/span><span style=\"color: #434f54;\">&lt;&lt;<\/span><span style=\"color: #000000;\">WGM12<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span>\r\n \u00a0<span style=\"color: #000000;\">TCCR1A<\/span> <span style=\"color: #434f54;\">|=<\/span> <span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">1<\/span><span style=\"color: #434f54;\">&lt;&lt;<\/span><span style=\"color: #000000;\">WGM11<\/span><span style=\"color: #000000;\">)<\/span> <span style=\"color: #434f54;\">|<\/span> <span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">1<\/span><span style=\"color: #434f54;\">&lt;&lt;<\/span><span style=\"color: #000000;\">WGM10<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span>\r\n \u00a0<span style=\"color: #000000;\">TCCR1B<\/span> <span style=\"color: #434f54;\">|=<\/span> <span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">1<\/span> <span style=\"color: #434f54;\">&lt;&lt;<\/span> <span style=\"color: #000000;\">CS10<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span> \r\n \u00a0<span style=\"color: #000000;\">ICR1<\/span> <span style=\"color: #434f54;\">=<\/span> <span style=\"color: #000000;\">1023<\/span><span style=\"color: #000000;\">;<\/span> \r\n \u00a0<span style=\"color: #000000;\">OCR1A<\/span> <span style=\"color: #434f54;\">=<\/span> <span style=\"color: #000000;\">512<\/span><span style=\"color: #000000;\">;<\/span> \r\n<span style=\"color: #434f54;\">\/\/ F=16000000\/1024\/1\/1=15625 Hz<\/span>\r\n<span style=\"color: #434f54;\">\/\/ PWM 50.05 %<\/span>\r\n \u00a0<span style=\"color: #000000;\">sei<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span>\r\n<span style=\"color: #000000;\">}<\/span>\r\n\r\n<span style=\"color: #00979c;\">void<\/span> <span style=\"color: #5e6d03;\">loop<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">{<\/span><span style=\"color: #000000;\">}<\/span>\r\n\r\n<\/pre>\n<p>\u0417\u0430 \u0440\u0430\u0431\u043e\u0442\u0443 \u0428\u0418\u041c \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043e\u0432, \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0439 \u0438\u0445 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443.<\/p>\n<p><strong>TCCR1A<\/strong> &#8212; \u0440\u0435\u0433\u0438\u0441\u0442\u0440 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432\u044b\u0432\u043e\u0434\u043e\u0432 OC1A \u0438 OC1B (\u0431\u0438\u0442\u044b 1 \u0438 2 \u043f\u043e\u0440\u0442\u0430 B) \u043f\u0440\u0438 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435 \u0441 TCNT1A \u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0445 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f OCR1A\/OCR1B, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u043b\u044f \u0432\u044b\u0431\u043e\u0440\u043e\u0432 \u0440\u0435\u0436\u0438\u043c\u043e\u0432 \u0428\u0418\u041c.<\/p>\n<p><strong>TCCR1B<\/strong>\u00a0&#8212; \u0440\u0435\u0433\u0438\u0441\u0442\u0440 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f<\/p>\n<p>\u0427\u0435\u0440\u0435\u0437 \u044d\u0442\u0438 \u0434\u0432\u0430 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f PWM<\/p>\n<p><a href=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/01\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-01-16-195057.png\" class=\"highslide-image\" onclick=\"return hs.expand(this);\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-111622\" src=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/01\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-01-16-195057.png\" alt=\"\" width=\"577\" height=\"73\" srcset=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/01\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-01-16-195057.png 577w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/01\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-01-16-195057-200x25.png 200w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/01\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-01-16-195057-500x63.png 500w\" sizes=\"auto, (max-width: 577px) 100vw, 577px\" \/><\/a> <a href=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/01\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-01-16-195049.png\" class=\"highslide-image\" onclick=\"return hs.expand(this);\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-111623\" src=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/01\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-01-16-195049.png\" alt=\"\" width=\"571\" height=\"80\" srcset=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/01\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-01-16-195049.png 571w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/01\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-01-16-195049-200x28.png 200w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/01\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-01-16-195049-500x70.png 500w\" sizes=\"auto, (max-width: 571px) 100vw, 571px\" \/><\/a><\/p>\n<p>\u0411\u0438\u0442\u044b <strong>COM1A1\/COM1A0<\/strong> \u0438 <strong>COM1B1\/COM1B0<\/strong> \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 <strong>TCCR1A <\/strong>\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432\u044b\u0432\u043e\u0434\u043e\u0432 <strong>OC1A\/OC1B<\/strong> (D9\/D10) \u043f\u0440\u0438\u00a0 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043e\u0432 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f <strong>OCR1A\/OCR1B<\/strong> \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u0441\u0447\u0451\u0442\u043d\u043e\u0433\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 <strong>TCNT1.<\/strong><\/p>\n<p>\u041f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u0431\u0438\u0442\u043e\u0432<strong> COM1A1\/COM1A0<\/strong> \u0438 <strong>COM1B1\/COM1B0<\/strong> <strong>[1:0]<\/strong>\u00a0 &#8212; \u043d\u0435\u0438\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u0428\u0418\u041c<\/p>\n<p>\u041f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u0431\u0438\u0442\u043e\u0432<strong> COM1A1\/COM1A0<\/strong> \u0438 <strong>COM1B1\/COM1B0<\/strong> <strong>[1:1]<\/strong> &#8212; \u0438\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u0428\u0418\u041c<\/p>\n<p>\u0411\u0438\u0442\u044b <strong>WGM10<\/strong>, <strong>WGM11<\/strong> \u0438 <strong>WGM12<\/strong> \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043e\u0432 <strong>TCCR1A <\/strong>\u0438<strong>TCCR1A\u00a0<\/strong>\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442 \u0440\u0435\u0436\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u044b PWM.<\/p>\n<p><a href=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/01\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-01-16-200637.png\" class=\"highslide-image\" onclick=\"return hs.expand(this);\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-111625\" src=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/01\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-01-16-200637.png\" alt=\"\" width=\"734\" height=\"378\" srcset=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/01\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-01-16-200637.png 734w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/01\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-01-16-200637-200x103.png 200w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/01\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-01-16-200637-500x257.png 500w\" sizes=\"auto, (max-width: 734px) 100vw, 734px\" \/><\/a><\/p>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u043d\u0430 \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u0435 PWM \u0438\u043c\u0435\u0435\u0442 2 \u0442\u0438\u043f\u0430 \u043c\u043e\u0434\u0443\u043b\u044f\u0446\u0438\u0438:<\/p>\n<ul>\n<li><strong>Fast PWM <\/strong>&#8212; \u0432 \u044d\u0442\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435 \u0441\u0447\u0435\u0442\u0447\u0438\u043a \u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u043e\u0442 \u043d\u0443\u043b\u044f \u0434\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f (\u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0440\u0430\u0437\u0440\u044f\u0434\u043d\u043e\u0441\u0442\u0438), \u043f\u043e\u0441\u043b\u0435 \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u043d\u043e\u043b\u044c \u0438 \u0441\u0447\u0435\u0442 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441\u043d\u043e\u0432\u0430. \u041a\u043e\u0433\u0434\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u0441\u0447\u0435\u0442\u0447\u0438\u043a\u0435 \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f, \u0442\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0435\u043c\u0443 \u0432\u044b\u0432\u043e\u0434 \u041e\u0421\u0445\u0445 \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u043d\u043e\u043b\u044c.<\/li>\n<li><strong>Phase Correct PWM<\/strong> &#8212; \u0428\u0418\u041c \u0441 \u0442\u043e\u0447\u043d\u043e\u0439 \u0444\u0430\u0437\u043e\u0439. \u0421\u0447\u0435\u0442\u0447\u0438\u043a \u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u0442 0 \u0434\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f (\u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0440\u0430\u0437\u0440\u044f\u0434\u043d\u043e\u0441\u0442\u0438), \u043f\u043e\u0442\u043e\u043c \u043e\u0442 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f (\u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0440\u0430\u0437\u0440\u044f\u0434\u043d\u043e\u0441\u0442\u0438) \u0434\u043e 0. \u0412\u044b\u0432\u043e\u0434 OCxx \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0438 \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u043f\u0440\u0438 \u0432\u0442\u043e\u0440\u043e\u043c \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f. \u0427\u0430\u0441\u0442\u043e\u0442\u0430 \u0428\u0418\u041c \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u0430\u0434\u0430\u0435\u0442 \u0432 \u0434\u0432\u0430 \u0440\u0430\u0437\u0430.<\/li>\n<\/ul>\n<p>\u0411\u0438\u0442\u044b <strong>CS10<\/strong>, <strong>CS11<\/strong> \u0438 <strong>CS12<\/strong> \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 <strong>TCCR1B\u00a0<\/strong>\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044f:<\/p>\n<p><a href=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/01\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-01-16-201359.png\" class=\"highslide-image\" onclick=\"return hs.expand(this);\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-111626\" src=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/01\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-01-16-201359.png\" alt=\"\" width=\"574\" height=\"209\" srcset=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/01\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-01-16-201359.png 574w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/01\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-01-16-201359-200x73.png 200w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/01\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-01-16-201359-500x182.png 500w\" sizes=\"auto, (max-width: 574px) 100vw, 574px\" \/><\/a><\/p>\n<p><strong>ICR1<\/strong> &#8212; \u0432 \u044d\u0442\u043e\u0442 \u0440\u0435\u0433\u0438\u0441\u0442\u0440 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0441\u0447\u0451\u0442\u0447\u0438\u043a\u0430 \u043f\u0440\u0438 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0438 \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u043d\u0430 \u0432\u044b\u0432\u043e\u0434\u0435 ICP (\u0431\u0438\u0442 0 \u043f\u043e\u0440\u0442\u0430 B), \u0432 \u043d\u0435\u043c \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 (\u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0440\u0430\u0437\u0440\u044f\u0434\u043d\u043e\u0441\u0442\u0438).<\/p>\n<p><strong>OCR1A<\/strong> &#8212; \u0440\u0435\u0433\u0438\u0441\u0442\u0440 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u0442 \u0441\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0447\u0435\u0442\u043d\u043e\u0433\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 <strong>TCNT1\u00a0<\/strong>, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043e\u043c <strong>TCCR1A<\/strong>.<\/p>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 PWM \u0437\u0430\u043a\u043e\u043d\u0447\u0435\u043d\u0430. \u041f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0442\u0430\u0439\u043c\u0435\u0440\u0430\u043c\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 Atmega328 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u0442\u0430\u0439\u043c\u0435\u0440 0 \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043d \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u0445 delay()\u00a0\u0438\u00a0millis(), \u0430 \u0442\u0430\u0439\u043c\u0435\u0440 2 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u00a0tone().<\/p>\n<p>\u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0428\u0418\u041c \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u043e\u043d\u043b\u0430\u0439\u043d \u043a\u0430\u043b\u044c\u043a\u0443\u043b\u044f\u0442\u043e\u0440\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0437\u0430\u0434\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b <strong>PWM<\/strong> \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u043e\u0434 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0442\u0430\u0439\u043c\u0435\u0440\u0430:<\/p>\n<p><iframe loading=\"lazy\" src=\"http:\/\/rcl-radio.ru\/php\/AVR_PWM.php\" width=\"100%\" height=\"680\" frameborder=\"0\"><span data-mce-type=\"bookmark\" style=\"display: inline-block; width: 0px; overflow: hidden; line-height: 0;\" class=\"mce_SELRES_start\">\ufeff<\/span><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0428\u0438\u0440\u043e\u0442\u043d\u043e-\u0438\u043c\u043f\u0443\u043b\u044c\u0441\u043d\u0430\u044f \u043c\u043e\u0434\u0443\u043b\u044f\u0446\u0438\u044f \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u043d\u043e \u0428\u0418\u041c (PWM) \u0432 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435 Arduino \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u044b\u0435 \u0438\u043c\u043f\u0443\u043b\u044c\u0441\u044b \u0441 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u043e\u0439 \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e \u0438\u043c\u043f\u0443\u043b\u044c\u0441\u0430 \u043f\u0440\u0438 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u043e\u0442\u0435 \u0438 \u0430\u043c\u043f\u043b\u0438\u0442\u0443\u0434\u0435 \u0438\u043c\u043f\u0443\u043b\u044c\u0441\u043e\u0432. \u0421\u0438\u0433\u043d\u0430\u043b \u0428\u0418\u041c \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043f\u043b\u0430\u0432\u043d\u043e\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043c\u043e\u0449\u043d\u043e\u0441\u0442\u0438 \u043d\u0430 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0435, \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u044e\u0449\u0435\u0439 \u043e\u0442 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u043f\u0438\u0442\u0430\u043d\u0438\u044f. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441 \u0446\u0435\u043b\u044c\u044e \u0440\u0435\u0433\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0432\u0430\u043b\u0430 \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u044f; \u043f\u043b\u0430\u0432\u043d\u043e\u0441\u0442\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u044f\u0440\u043a\u043e\u0441\u0442\u0438 \u043e\u0441\u0432\u0435\u0449\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u043f\u043e\u0434\u0441\u0432\u0435\u0442\u043a\u0438. \u041f\u043b\u0430\u0442\u044b Arduino Uno \u0438 Arduino Nano [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":111627,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[239,21],"tags":[],"class_list":["post-111620","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-arduino","category-21"],"views":4938,"_links":{"self":[{"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/posts\/111620","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=111620"}],"version-history":[{"count":4,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/posts\/111620\/revisions"}],"predecessor-version":[{"id":111631,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/posts\/111620\/revisions\/111631"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/media\/111627"}],"wp:attachment":[{"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=111620"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=111620"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=111620"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}