{"id":68396,"date":"2019-12-14T17:01:13","date_gmt":"2019-12-14T11:01:13","guid":{"rendered":"http:\/\/rcl-radio.ru\/?p=68396"},"modified":"2022-01-09T13:16:43","modified_gmt":"2022-01-09T07:16:43","slug":"stm32-lcd1602-i2c","status":"publish","type":"post","link":"http:\/\/rcl-radio.ru\/?p=68396","title":{"rendered":"STM32 + LCD1602 I2C"},"content":{"rendered":"<p>I2C \u043c\u043e\u0434\u0443\u043b\u044c \u043d\u0430 \u0431\u0430\u0437\u0435 \u043c\u0438\u043a\u0440\u043e\u0441\u0445\u0435\u043c PCF8574 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b\u044c\u043d\u044b\u0439 \u0434\u0438\u0441\u043f\u043b\u0435\u0439 1602 \u043a \u043f\u043b\u0430\u0442\u0435 STM32 \u0432\u0441\u0435\u0433\u043e \u043f\u043e \u0434\u0432\u0443\u043c \u043f\u0440\u043e\u0432\u043e\u0434\u0430\u043c SDA \u0438 SCL (B7 \u0438 B6).<\/p>\n<p><a href=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2019\/12\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2019-12-14-164937.png\" class=\"highslide-image\" onclick=\"return hs.expand(this);\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-68397\" src=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2019\/12\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2019-12-14-164937.png\" alt=\"\" width=\"460\" height=\"559\" srcset=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2019\/12\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2019-12-14-164937.png 460w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2019\/12\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2019-12-14-164937-200x243.png 200w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2019\/12\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2019-12-14-164937-411x500.png 411w\" sizes=\"auto, (max-width: 460px) 100vw, 460px\" \/><\/a><\/p>\n<p>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 LCD1602 \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0448\u0438\u043d\u044b I2C \u043a \u043f\u043b\u0430\u0442\u0435 STM32 \u043c\u0430\u043b\u043e \u0447\u0435\u043c \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a Arduino Nano, \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043c\u0435\u0441\u0442\u043e A4 A5 \u0434\u043b\u044f Nano, \u0432 STM32 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0432\u044b\u0432\u043e\u0434\u044b B6 (SCL) B7 (SDA). \u041f\u0440\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u043f\u043b\u0430\u0442\u044b STM32 \u043a USB \u043f\u043e\u0440\u0442\u0443 LCD1602 \u0441 I2C \u043c\u043e\u0434\u0443\u043b\u0435\u043c \u043f\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u0432\u044b\u0445\u043e\u0434\u0430 5V. \u041f\u0440\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u043f\u0438\u0442\u0430\u043d\u0438\u044f 5 \u0412, \u044d\u0442\u043e \u043d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0430 VCC I2C \u043c\u043e\u0434\u0443\u043b\u044f \u0438 \u043d\u0430 \u0432\u0445\u043e\u0434 5V \u043f\u043b\u0430\u0442\u044b STM32.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2019\/09\/368632862389.png\" width=\"455\" height=\"223\" \/><\/p>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0437\u0430\u043b\u0438\u0432\u043a\u043e\u0439 \u0441\u043a\u0435\u0442\u0447\u0430 \u0432 STM32 \u0412\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435\u0439 &#8212; <a href=\"http:\/\/rcl-radio.ru\/?p=68376\">STM32 Arduino IDE<\/a><\/p>\n<div id=\"marketWidget\"><\/div>\n<pre class=\"actionscript\" style=\"font-family: monospace; font-size: 10px;\"><span style=\"color: #808080; font-style: italic;\">#include &lt;Wire.h&gt; <\/span>\r\n<span style=\"color: #808080; font-style: italic;\">#include &lt;LiquidCrystal_I2C.h&gt; \/\/ <a href=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2019\/12\/liquidcrystali2c-9.zip\">liquidcrystali2c.zip<\/a><\/span>\r\nLiquidCrystal_I2C lcd<span style=\"color: #66cc66;\">(<\/span>0x27,<span style=\"color: #cc66cc;\">16<\/span>,<span style=\"color: #cc66cc;\">2<\/span><span style=\"color: #66cc66;\">)<\/span>;  <span style=\"color: #808080; font-style: italic;\">\/\/ \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0434\u0438\u0441\u043f\u043b\u0435\u0439<\/span>\r\n<span style=\"color: #0066cc;\">void<\/span> setup<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>\r\n<span style=\"color: #66cc66;\">{<\/span>\r\n  lcd.<span style=\"color: #006600;\">init<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;                     \r\n  lcd.<span style=\"color: #006600;\">backlight<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #808080; font-style: italic;\">\/\/ \u0412\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043f\u043e\u0434\u0441\u0432\u0435\u0442\u043a\u0443 \u0434\u0438\u0441\u043f\u043b\u0435\u044f<\/span>\r\n  lcd.<span style=\"color: #0066cc;\">print<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #ff0000;\">\"  rcl-radio.ru  \"<\/span><span style=\"color: #66cc66;\">)<\/span>;\r\n  lcd.<span style=\"color: #006600;\">setCursor<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">0<\/span>, <span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">)<\/span>;\r\n  lcd.<span style=\"color: #0066cc;\">print<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #ff0000;\">\"    LCD 1602    \"<\/span><span style=\"color: #66cc66;\">)<\/span>;\r\n  delay<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">5000<\/span><span style=\"color: #66cc66;\">)<\/span>;\r\n  lcd.<span style=\"color: #006600;\">noBacklight<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #808080; font-style: italic;\">\/\/ \u0412\u044b\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043f\u043e\u0434\u0441\u0432\u0435\u0442\u043a\u0443 \u0434\u0438\u0441\u043f\u043b\u0435\u044f<\/span>\r\n  delay<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">5000<\/span><span style=\"color: #66cc66;\">)<\/span>;\r\n  lcd.<span style=\"color: #006600;\">backlight<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #808080; font-style: italic;\">\/\/ \u0412\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043f\u043e\u0434\u0441\u0432\u0435\u0442\u043a\u0443 \u0434\u0438\u0441\u043f\u043b\u0435\u044f<\/span>\r\n<span style=\"color: #66cc66;\">}<\/span>\r\n<span style=\"color: #0066cc;\">void<\/span> loop<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span><span style=\"color: #66cc66;\">}<\/span><\/pre>\n<p><a href=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2019\/11\/Screenshot-20.11.2019-131925.png\" class=\"highslide-image\" onclick=\"return hs.expand(this);\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-67565\" src=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2019\/11\/Screenshot-20.11.2019-131925.png\" alt=\"\" width=\"537\" height=\"215\" srcset=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2019\/11\/Screenshot-20.11.2019-131925.png 537w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2019\/11\/Screenshot-20.11.2019-131925-200x80.png 200w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2019\/11\/Screenshot-20.11.2019-131925-500x200.png 500w\" sizes=\"auto, (max-width: 537px) 100vw, 537px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I2C \u043c\u043e\u0434\u0443\u043b\u044c \u043d\u0430 \u0431\u0430\u0437\u0435 \u043c\u0438\u043a\u0440\u043e\u0441\u0445\u0435\u043c PCF8574 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b\u044c\u043d\u044b\u0439 \u0434\u0438\u0441\u043f\u043b\u0435\u0439 1602 \u043a \u043f\u043b\u0430\u0442\u0435 STM32 \u0432\u0441\u0435\u0433\u043e \u043f\u043e \u0434\u0432\u0443\u043c \u043f\u0440\u043e\u0432\u043e\u0434\u0430\u043c SDA \u0438 SCL (B7 \u0438 B6). \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 LCD1602 \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0448\u0438\u043d\u044b I2C \u043a \u043f\u043b\u0430\u0442\u0435 STM32 \u043c\u0430\u043b\u043e \u0447\u0435\u043c \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a Arduino Nano, \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043c\u0435\u0441\u0442\u043e A4 A5 \u0434\u043b\u044f Nano, \u0432 STM32 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0432\u044b\u0432\u043e\u0434\u044b B6 (SCL) B7 (SDA). [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":67565,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[239],"tags":[],"class_list":["post-68396","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-arduino"],"views":9713,"_links":{"self":[{"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/posts\/68396","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=68396"}],"version-history":[{"count":3,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/posts\/68396\/revisions"}],"predecessor-version":[{"id":111304,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/posts\/68396\/revisions\/111304"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/media\/67565"}],"wp:attachment":[{"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=68396"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=68396"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=68396"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}