{"id":313385,"date":"2020-11-18T21:00:27","date_gmt":"2020-11-18T21:00:27","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=313385"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=313385","title":{"rendered":"STM32 \u0438 \u0431\u0435\u0441\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u043d\u044b\u0439 \u0434\u0430\u0442\u0447\u0438\u043a \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b MLX90614. \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043f\u043e I2C"},"content":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<p>\u0414\u0430\u0442\u0447\u0438\u043a MLX90614 &#8212; \u044d\u0442\u043e \u0434\u0430\u0442\u0447\u0438\u043a \u0441 \u0431\u0435\u0441\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u043d\u044b\u043c \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u0435\u043c \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u043f\u0440\u0438\u0435\u043c\u0430 \u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u043d\u0444\u0440\u0430\u043a\u0440\u0430\u0441\u043d\u043e\u0433\u043e \u0438\u0437\u043b\u0443\u0447\u0435\u043d\u0438\u044f. \u041e\u043d \u0443\u043c\u0435\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u0442\u0440\u0435\u0445 \u0440\u0435\u0436\u0438\u043c\u0430\u0445: \u0442\u0435\u0440\u043c\u043e\u0441\u0442\u0430\u0442, \u0428\u0418\u041c \u0432\u044b\u0445\u043e\u0434 \u0438 SMBus. \u0412 \u0440\u0435\u0436\u0438\u043c\u0435 \u0442\u0435\u0440\u043c\u043e\u0441\u0442\u0430\u0442 \u0434\u0430\u0442\u0447\u0438\u043a\u0443 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440, \u043e\u043d \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u0435\u0440\u0436\u0438\u0442 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0443 \u0432 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445, \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044f \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u043c \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u0441\u0442\u043e\u043a\u043e\u043c. \u0412 \u0440\u0435\u0436\u0438\u043c\u0435 \u0428\u0418\u041c \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0438\u0433\u043d\u0430\u043b \u0428\u0418\u041c, \u0441\u043a\u0432\u0430\u0436\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b. \u0412 \u0446\u0435\u043b\u044f\u0445 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0443 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0435\u043d \u0440\u0435\u0436\u0438\u043c SMBus. \u0422\u0430\u043a \u043a\u0430\u043a \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u044d\u043b\u0435\u043a\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u0438 \u0438 \u0441\u0438\u0433\u043d\u0430\u043b\u044c\u043d\u043e \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c \u0441 I2C \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u043c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u044b\u0439 I2C. \u041e \u043d\u0435\u043c \u0438 \u043f\u043e\u0439\u0434\u0435\u0442 \u0440\u0435\u0447\u044c \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435. \u0412\u0441\u0435 \u0440\u0435\u0436\u0438\u043c\u044b \u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0437\u0430\u043f\u0438\u0441\u044c\u044e \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u044f\u0447\u0435\u0439\u043a\u0438 EEPROM. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0434\u0430\u0442\u0447\u0438\u043a \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 SMBus. <\/p>\n<hr>\n<h2>\u0412\u043d\u0435\u0448\u043d\u0438\u0439 \u0432\u0438\u0434 \u0438 \u0441\u0445\u0435\u043c\u0430 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f <\/h2>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c0b\/586\/35c\/c0b58635cbf602fff208a2e65c700919.png\" width=\"169\" height=\"317\"><figcaption><\/figcaption><\/figure>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b0a\/b3c\/f53\/b0ab3cf53dee2a65124d1e136c1a3496.png\" width=\"356\" height=\"290\"><figcaption><\/figcaption><\/figure>\n<p>\u0412 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u043d\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e. \u0423 \u043c\u0435\u043d\u044f \u0435\u0441\u0442\u044c \u043f\u043b\u0430\u0442\u0430 &#171;\u0421\u0438\u043d\u044f\u044f \u0442\u0430\u0431\u043b\u0435\u0442\u043a\u0430&#187; \u0441 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u043c STM32F103C8T6 \u043d\u0430 \u0431\u043e\u0440\u0442\u0443, \u0432\u043e\u0442 \u043a \u043d\u0435\u0439 \u0438 \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0434\u0430\u0442\u0447\u0438\u043a. \u0423 \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 2 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 I2C. \u0414\u043b\u044f \u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0435\u0440\u0432\u044b\u0439 \u043d\u0430 \u0432\u044b\u0432\u043e\u0434\u0430\u0445 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e. \u042d\u0442\u043e PB6 &#8212; SCL, PB7 &#8212; SDA. \u041f\u0440\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0435 \u0437\u0430\u0431\u044b\u0442\u044c \u043f\u043e\u0434\u0442\u044f\u043d\u0443\u0442\u044c \u044d\u0442\u0438 \u0432\u044b\u0432\u043e\u0434\u044b \u043a \u043f\u0438\u0442\u0430\u043d\u0438\u044e \u0432\u043d\u0435\u0448\u043d\u0438\u043c\u0438 \u0440\u0435\u0437\u0438\u0441\u0442\u043e\u0440\u0430\u043c\u0438, \u0443 \u043c\u0435\u043d\u044f \u0438\u0445 \u0441\u043e\u043f\u0440\u043e\u0442\u0438\u0432\u043b\u0435\u043d\u0438\u0435 4.7 \u043a\u041e\u043c. <\/p>\n<h2>\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c<\/h2>\n<p>\u0412\u0435\u0441\u044c \u043a\u043e\u0434 \u044f \u0440\u0435\u0448\u0438\u043b \u043e\u0444\u043e\u0440\u043c\u0438\u0442\u044c \u0432 \u0432\u0438\u0434\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0435\u0439 \u0438\u0437 \u0434\u0432\u0443\u0445 \u0444\u0430\u0439\u043b\u043e\u0432: mlx90614.h \u0438 mlx90614.c . \u0422\u0430\u043a\u0436\u0435 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u0442\u0430\u0439\u043c\u0435\u0440\u0430 \u0434\u043b\u044f \u0437\u0430\u0434\u0435\u0440\u0436\u0435\u043a \u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 LCD \u0434\u0438\u0441\u043f\u043b\u0435\u044f A2004 \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b. \u041e\u043d\u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0432 <a href=\"https:\/\/habr.com\/ru\/post\/522938\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a>.<\/p>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430. <\/p>\n<pre><code class=\"cpp\">#ifndef I2C_DEVICES_I2C_H_ #define I2C_DEVICES_I2C_H_  #include \"stm32f1xx.h\" #include &lt;stdio.h&gt; #include \"delay.h\"  #define F_APB1 36 \t\t\t\t\t\t\t\t\t\t\t\t\t\/\/ \u0447\u0430\u0441\u0442\u043e\u0442\u0430 \u0448\u0438\u043d\u044b APB1 #define TPCLK1 ( 1000\/F_APB1 ) \t\t\t\t\t\t\t\/\/ \u043f\u0435\u0440\u0438\u043e\u0434 \u0447\u0430\u0441\u0442\u043e\u0442\u044b APB1 ns. ~ 28 #define CCR_VALUE ( 10000 \/(TPCLK1 * 2 ) ) \t\/\/ \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 CCR \u0414\u043b\u044f 36 \u041c\u0433\u0446 ~ 179 #define TRISE_VALUE ( 1000 \/ TPCLK1)<\/code><\/pre>\n<p>\u0412 \u043d\u0430\u0447\u0430\u043b\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0434\u043b\u044f \u0441\u0432\u043e\u0435\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430. \u0423 \u043c\u0435\u043d\u044f \u044d\u0442\u043e stm32f1xx.h. \u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0421\u0418 stdio.h \u043d\u0443\u0436\u043d\u0430 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442\u044c \u0434\u0440\u043e\u0431\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 \u0432 char \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u043d\u0430 LCD. delay.h &#8212; \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0437\u0430\u0434\u0435\u0440\u0436\u0435\u043a. <\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0438\u0434\u0443\u0442 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u0434\u043b\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e\u0433\u043e I2C. \u0412 \u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0438 \u0432 \u043a\u043e\u0434\u0435 \u043e\u043d\u0438 \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u044f\u0442\u0441\u044f \u0432 \u043d\u0443\u0436\u043d\u044b\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u044b. \u042d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043c\u0435\u043d\u044f\u044f \u0447\u0430\u0441\u0442\u043e\u0442\u0443 \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u0430\u043a\u0440\u043e\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 F_APB1, \u0430 \u043d\u0435 \u043a\u043e\u043f\u0430\u0442\u044c\u0441\u044f \u0432 \u043a\u043e\u0434\u0435 \u0438 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u0430 \u043d\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0438\u0434\u0435\u043c \u0432 \u0434\u0430\u0442\u0430\u0448\u0438\u0442 \u0438 \u0443\u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u0434\u0430\u0442\u0447\u0438\u043a \u0438\u043c\u0435\u0435\u0442 \u0434\u0432\u0435 \u0440\u0430\u0437\u043d\u044b\u0435 \u043f\u0430\u043c\u044f\u0442\u0438: RAM \u0438 EEPROM. RAM \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b. \u0412\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 \u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0443 \u0441 \u0441\u0435\u043d\u0441\u043e\u0440\u043e\u0432, \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0438 \u043a\u043b\u0430\u0434\u0435\u0442 \u0432 \u044f\u0447\u0435\u0439\u043a\u0438 RAM \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0443 \u0432 \u041a\u0435\u043b\u044c\u0432\u0438\u043d\u0430\u0445. \u0412 \u043f\u0435\u0440\u0432\u044b\u0445 \u0434\u0432\u0443\u0445 \u044f\u0447\u0435\u0439\u043a\u0430\u0445 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f &#171;\u0441\u044b\u0440\u0430\u044f \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430&#187;. \u042f \u043d\u0435 \u043f\u043e\u043d\u044f\u043b \u0447\u0442\u043e \u043e\u043d\u0430 \u0438\u0437 \u0441\u0435\u0431\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442. \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u044f\u0447\u0435\u0439\u043a\u0430\u0445 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 \u043a\u0440\u0438\u0441\u0442\u0430\u043b\u043b\u0430 \u0434\u0430\u0442\u0447\u0438\u043a\u0430, \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0438 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0441\u0435\u043d\u0441\u043e\u0440\u0430. \u0414\u0430\u0442\u0447\u0438\u043a\u0438 MLX90614 \u0431\u044b\u0432\u0430\u044e\u0442 \u0441 \u043e\u0434\u043d\u0438\u043c \u0438 \u0434\u0432\u0443\u043c\u044f \u0434\u0430\u0442\u0447\u0438\u043a\u0430\u043c\u0438. \u0423 \u043c\u0435\u043d\u044f \u0441 \u043e\u0434\u043d\u0438\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 \u0431\u0443\u0434\u0435\u0442 \u0447\u0438\u0442\u0430\u0442\u044c\u0441\u044f \u0441 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0441\u0435\u043d\u0441\u043e\u0440\u0430. \u0412 EEPROM \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u0434\u0430\u0442\u0447\u0438\u043a\u0430. \u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u0430\u0434\u0440\u0435\u0441\u0430\u0446\u0438\u044e \u043f\u0430\u043c\u044f\u0442\u0438 \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u0432 \u0432\u0438\u0434\u0435 \u043c\u0430\u043a\u0440\u043e\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439.<\/p>\n<pre><code class=\"cpp\">\/\/---------------- RAM addresses -------------------------------------------- #define MLX90614_RAW_IR_1 0x04\t\t\/\/ \u0441\u044b\u0440\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u0441\u0435\u043d\u0441\u043e\u0440\u043e\u0432 #define MLX90614_RAW_IR_2 0x05 #define MLX90614_TA 0x06\t\t\t\t\t\/\/ \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 \u043a\u0440\u0438\u0441\u0442\u0430\u043b\u043b\u0430 \u0434\u0430\u0442\u0447\u0438\u043a\u0430 #define MLX90614_TOBJ_1 0x07\t\t\t\/\/ \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 \u0441 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0418\u041a \u0441\u0435\u043d\u0441\u043e\u0440\u0430 #define MLX90614_TOBJ_2 0x08\t\t\t\/\/ \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 \u0441\u043e \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0418\u041a \u0441\u0435\u043d\u0441\u043e\u0440\u0430  \/\/--------------- EEPROM addresses ------------------------------------------ #define MLX90614_TO_MAX 0x00 #define MLX90614_TO_MIN 0x01 #define MLX90614_PWM_CTRL 0x02 #define MLX90614_TA_RANGE 0x03 #define MLX90614_EMISSIVITY 0x04 #define MLX90614_CONFIG_REGISTER_1 0x05 #define MLX90614_SMBUS_ADDRESS 0x0E \/\/ LSByte only #define MLX90614_ID_NUMBER_1 0x1C #define MLX90614_ID_NUMBER_2 0x1D #define MLX90614_ID_NUMBER_3 0x1E #define MLX90614_ID_NUMBER_4 0x1F<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0438\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043a \u0434\u0430\u0442\u0447\u0438\u043a\u0443 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043e\u043d \u0443\u043c\u0435\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c.<\/p>\n<pre><code class=\"cpp\">\/\/--------------- Commands ------------------------------------------------ #define MLX90614_RAM_ACCESS 0 \t\t\t\t\t\/\/ \u0434\u043e\u0441\u0442\u0443\u043f \u043a RAM #define MLX90614_EEPROM_ACCESS 0x20 \t\t\/\/ \u0434\u043e\u0441\u0442\u0443\u043f \u043a EEPROM #define MLX90614_READ_FLAGS 0xF0 \t\t\t\t\/\/ \u0447\u0442\u0435\u043d\u0438\u0435 \u0444\u043b\u0430\u0433\u043e\u0432 #define MLX90614_ENTER_SLEEP_MODE 0xFF \t\/\/ \u0440\u0435\u0436\u0438\u043c \u0441\u043d\u0430 #define MLX90614_READ 1\t\t\t\t\t\t\t\t\t\/\/ \u0440\u0435\u0436\u0438\u043c \u0447\u0442\u0435\u043d\u0438\u044f \u0438\u0437 \u0434\u0430\u0442\u0447\u0438\u043a\u0430 #define MLX90614_WRITE 0\t\t\t\t\t\t\t\t\/\/ \u0440\u0435\u0436\u0438\u043c \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0434\u0430\u0442\u0447\u0438\u043a<\/code><\/pre>\n<p>\u0421 \u043c\u0430\u043a\u0440\u043e\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f\u043c\u0438 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0438. \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0431\u0443\u0434\u0435\u0442 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u043c. \u0427\u0442\u043e\u0431\u044b \u043a\u043e\u043c\u0444\u043e\u0440\u0442\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u043c \u043d\u0443\u0436\u043d\u043e \u0443\u043c\u0435\u0442\u044c \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0443 \u0438 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0438 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0430\u0434\u0440\u0435\u0441 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u043d\u0430 \u0448\u0438\u043d\u0435 I2C \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0430\u043a\u0438\u0445 \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u0432, \u0430 \u0430\u0434\u0440\u0435\u0441 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0443 \u0432\u0441\u0435\u0445 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0439 &#8212; 5A. \u042f \u0437\u0430\u0434\u0443\u043c\u044b\u0432\u0430\u043b \u0432 \u0441\u0432\u043e\u0435\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0432\u0430 \u0442\u0430\u043a\u0438\u0445 \u0434\u0430\u0442\u0447\u0438\u043a\u0430, \u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0432 \u0444\u043e\u0440\u0443\u043c\u044b \u043f\u043e\u043d\u044f\u043b, \u0447\u0442\u043e \u043e\u043d\u0438 \u0434\u043b\u044f \u043c\u043e\u0438\u0445 \u0446\u0435\u043b\u0435\u0439 \u043d\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0442. \u0422\u0430\u043a \u043a\u0430\u043a \u0434\u0430\u0442\u0447\u0438\u043a\u0438 \u0443\u0436\u0435 \u0431\u044b\u043b\u0438 \u0443 \u043c\u0435\u043d\u044f \u044f \u0440\u0435\u0448\u0438\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u043e\u0434 \u043d\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u043d\u0430 \u0431\u0443\u0434\u0443\u0449\u0435\u0435.<\/p>\n<p><strong>\u0418\u0442\u0430\u043a \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0438:<\/strong><\/p>\n<pre><code class=\"cpp\">void mlx90614Init( void ); double getTemp_Mlx90614_Double( uint16_t address, uint8_t ram_address ); void getTemp_Mlx90614_CharArray( uint16_t address, uint8_t ram_address, char* buf );  uint16_t getAddrFromEEPROM( uint16_t address ); int setAddrToEEPROM ( uint16_t address, uint16_t new_address );  uint16_t readEEPROM( uint16_t address, uint16_t eeprom_address ); void writeEEPROM ( uint16_t address, uint16_t eeprom_address, uint16_t data );  #endif \/* I2C_DEVICES_I2C_H_ *\/<\/code><\/pre>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"368\" width=\"368\">\n<p>void mlx90614Init( void )<\/p>\n<\/td>\n<td>\n<p>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f I2C \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u043c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"368\" width=\"368\">\n<p>double getTemp<em>Mlx90614<\/em>Double( uint16<em>t address, uint8<\/em>t ram_address )<\/p>\n<\/td>\n<td>\n<p>\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0443 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 double \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u0443\u044e \u043a \u0433\u0440\u0430\u0434\u0443\u0441\u0430\u043c \u0426\u0435\u043b\u044c\u0441\u0438\u044f. \u041f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u0430 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0430\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u041f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0430\u0434\u0440\u0435\u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u0438 \u0430\u0434\u0440\u0435\u0441 RAM \u043f\u0430\u043c\u044f\u0442\u0438 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0447\u0438\u0442\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435.  \u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0430\u0434\u0440\u0435\u0441\u0430 RAM \u0432\u0435\u0440\u043d\u0435\u0442 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0443 \u043a\u0440\u0438\u0441\u0442\u0430\u043b\u043b\u0430, \u0441\u0435\u043d\u0441\u043e\u0440\u0430 1 \u0438\u043b\u0438 2.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"368\" width=\"368\">\n<p>void getTemp<em>Mlx90614<\/em>CharArray( uint16<em>t address, uint8<\/em>t ram_address, char* buf )<\/p>\n<\/td>\n<td>\n<p>\u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0430\u044f \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 char \u043c\u0430\u0441\u0441\u0438\u0432, \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435. \u0423\u0434\u043e\u0431\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \u043d\u0430 LCD<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"368\" width=\"368\">\n<p>uint16<em>t getAddrFromEEPROM( uint16<\/em>t address )<\/p>\n<\/td>\n<td>\n<p>\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0430\u0434\u0440\u0435\u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u0430, \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0432 \u0435\u0433\u043e EEPROM. \u041f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0430\u0434\u0440\u0435\u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u0430. <\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"368\" width=\"368\">\n<p>int setAddrToEEPROM ( uint16<em>t address, uint16<\/em>t new_address )<\/p>\n<\/td>\n<td>\n<p>\u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0430\u0434\u0440\u0435\u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u0432 EEPROM. \u041f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0430\u0434\u0440\u0435\u0441\u0430 \u0434\u0430\u0442\u0447\u0438\u043a\u0430.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"368\" width=\"368\">\n<p>uint16<em>t readEEPROM( uint16<\/em>t address, uint16<em>t eeprom<\/em>address )<\/p>\n<\/td>\n<td>\n<p>\u0423\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0447\u0442\u0435\u043d\u0438\u044f EEPROM<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"368\" width=\"368\">\n<p>void writeEEPROM ( uint16<em>t address, uint16<\/em>t eeprom<em>address, uint16<\/em>t data )<\/p>\n<\/td>\n<td>\n<p>\u0423\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 EEPROM<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u0421 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u044b\u043c \u0444\u0430\u0439\u043b\u043e\u043c \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0438. \u0421\u0430\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0439.<\/p>\n<pre><code class=\"cpp\">void mlx90614Init(void){  \t delay_ms(120);\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\/\/ \u043d\u0430 \u0441\u0442\u0430\u0431\u0438\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043f\u0438\u0442\u0430\u043d\u0438\u044f \u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043d\u044b\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0432 \u0434\u0430\u0442\u0447\u0438\u043a\u0435  RCC-&gt;APB2ENR |= RCC_APB2ENR_IOPBEN;\t\t\t\t\t\t\t\/\/ \u0442\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c \u043f\u043e\u0440\u0442 RCC-&gt;APB1ENR |= RCC_APB1ENR_I2C1EN;\t\t\t\t\t\t\t\/\/ \u0442\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c i2c1  GPIOB-&gt;CRL |= GPIO_CRL_MODE6 | GPIO_CRL_MODE7;\t\/\/ \u0432\u044b\u0445\u043e\u0434 50 \u043c\u0433\u0446 GPIOB-&gt;CRL |= GPIO_CRL_CNF6 | GPIO_CRL_CNF7; \t\t\/\/ \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u0430\u044f \u0444-\u044f \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439 \u0441\u0442\u043e\u043a  I2C1-&gt;CR2 &amp;= ~I2C_CR2_FREQ; \t\t\t\t\t\t\t\t\t\t\/\/ \u0441\u043a\u0438\u0434\u044b\u0432\u0430\u0435\u043c \u0431\u0438\u0442\u044b \u0447\u0430\u0441\u0442\u043e\u0442\u044b \u0448\u0438\u043d\u044b \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f  APB1 I2C1-&gt;CR2 |= F_APB1; \t\t\t\t\t\t\t\t\t\t\t\t\t\t\/\/ \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0447\u0430\u0441\u0442\u043e\u0442\u0443 \u0448\u0438\u043d\u044b APB1 \u043e\u0442 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0442\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f I2C \u043c\u043e\u0434\u0443\u043b\u044c I2C1-&gt;CR1 &amp;= ~I2C_CR1_PE; \t\t\t\t\t\t\t\t\t\t\t\/\/ \u0432\u044b\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u044c I2C \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 CCR I2C1-&gt;CCR &amp;= ~I2C_CCR_CCR; I2C1-&gt;CCR |=  CCR_VALUE; I2C1-&gt;TRISE |=  TRISE_VALUE;  I2C1-&gt;CR1 |= I2C_CR1_ENPEC; \t\t\t\t\t\t\t\t\t\t\/\/ \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u043e\u0442\u0441\u044b\u043b\u043a\u0443 PEC I2C1-&gt;CR1 |= I2C_CR1_PE;\t\t\t\t\t\t\t\t\t\t\t\t\/\/ \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u044c I2C I2C1-&gt;CR1 |= I2C_CR1_ACK; \t\t\t\t\t\t\t\t\t\t\t\/\/ \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c ACK  }<\/code><\/pre>\n<p>\u0418\u0437 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u043e \u0447\u0442\u043e \u0432 \u043d\u0435\u0439 \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f. \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 F_APB1, CCR_VALUE \u0438 TRISE_VALUE \u043e\u043d\u0438 \u0431\u0435\u0440\u0443\u0442\u0441\u044f \u0438\u0437 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430, \u0442\u0430\u043c \u0438 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u043e\u0442\u044b \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0422\u0430\u043a \u0436\u0435 \u0432\u0430\u0436\u043d\u043e \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c I2C \u043f\u0435\u0440\u0435\u0434 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u043e\u0439 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 CCR ( \u044d\u0442\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043d\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 ) \u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c ACK \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043c\u043e\u0434\u0443\u043b\u044f I2C , \u0438\u043d\u0430\u0447\u0435 ACK \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0435\u0442.<\/p>\n<pre><code class=\"cpp\">double getTemp_Mlx90614_Double( uint16_t address, \t\t\t\t\t\t\t\tuint8_t ram_address){  \t uint16_t\ttemp ; \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\/\/ \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 \t uint8_t\ttemp_lsb ;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\/\/ \u043c\u043b\u0430\u0434\u0448\u0438\u0435 \u0431\u0438\u0442\u044b \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \t double temp_result ; \t\t\t\t\t\t\t\t\t\t\t\t\t\/\/ \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0430\u044f \u043f\u0435\u0440\u0435\u0441\u0447\u0438\u0442\u0430\u043d\u043d\u0430\u044f \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 \t double temp_double ;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\/\/ \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430, \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u0430\u044f \u043a \u0444\u043e\u0440\u043c\u0430\u0442\u0443 double  \t address = address&lt;&lt;1; \t\t\t\t\t\t\t\t\t\t\t\t\t\/\/ \u0441\u0434\u0432\u0438\u0433\u0430\u0435\u043c \u043d\u0430 \u043e\u0434\u0438\u043d \u0432\u043b\u0435\u0432\u043e (\u0442\u0430\u043a \u0434\u0430\u0442\u0447\u0438\u043a \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \t \t \t \t \t \t \t \t \t \t \t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\/\/ \u0430\u0434\u0440\u0435\u0441 \u043f\u043b\u044e\u0441 1-\u0439 \u0431\u0438\u0442 \u0437\u0430\u043f\u0438\u0441\u044c\/\u0447\u0442\u0435\u043d\u0438\u0435) \t I2C1-&gt;CR1 |= I2C_CR1_START; \t while (!(I2C1-&gt;SR1 &amp; I2C_SR1_SB)){}  \t (void) I2C1-&gt;SR1;  \t I2C1-&gt;DR = address | MLX90614_WRITE; \t\t\t\t\t\/\/ \u0440\u0435\u0436\u0438\u043c \u0437\u0430\u043f\u0438\u0441\u0438 , \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0430\u0434\u0440\u0435\u0441\u0430 MLX90614 \t while (!(I2C1-&gt;SR1 &amp; I2C_SR1_ADDR)){}  \t (void) I2C1-&gt;SR1; \t (void) I2C1-&gt;SR2;  \t I2C1-&gt;DR= ram_address;\t\t\t\t\t\t\t\t\t\t\t\t\t\/\/ \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0430\u0434\u0440\u0435\u0441\u0430 RAM  \u0434\u0430\u0442\u0447\u0438\u043a\u0430 MLX90614 \t while (!(I2C1-&gt;SR1 &amp; I2C_SR1_TXE)){}  \t I2C1-&gt;CR1 |= I2C_CR1_START;\t\t\t\t\t\t\t\t\t\t\/\/ \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0439 \u0441\u0442\u0430\u0440\u0442 \t while (!(I2C1-&gt;SR1 &amp; I2C_SR1_SB)){}  \t (void) I2C1-&gt;SR1;  \t I2C1-&gt;DR = address | MLX90614_READ;\t\t\t\t\t\t\/\/ \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \u0434\u0430\u0442\u0447\u0438\u043a\u0443 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \t while (!(I2C1-&gt;SR1 &amp; I2C_SR1_ADDR)){}  \t (void) I2C1-&gt;SR1; \t (void) I2C1-&gt;SR2;  \t while(!(I2C1-&gt;SR1 &amp; I2C_SR1_RXNE)){}  \t temp_lsb = I2C1-&gt;DR;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\/\/ \u0447\u0438\u0442\u0430\u0435\u043c \u043c\u043b\u0430\u0434\u0448\u0438\u0439 \u0431\u0430\u0439\u0442  \t while(!(I2C1-&gt;SR1 &amp; I2C_SR1_RXNE)){}  \t temp = I2C1-&gt;DR;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\/\/ \u0447\u0438\u0442\u0430\u0435\u043c \u0441\u0442\u0430\u0440\u0448\u0438\u0439 \u0431\u0430\u0439\u0442  \t I2C1-&gt;CR1 |= I2C_CR1_STOP;  \t temp = (temp &amp; 0x007F) &lt;&lt; 8;\t\t\t\t\t\t\t\t\t\t\/\/ \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u0431\u0438\u0442 \u043e\u0448\u0438\u0431\u043a\u0438, \u0441\u0434\u0432\u0438\u0433\u0430\u0435\u043c \u0432 \u0441\u0442\u0430\u0440\u0448\u0438\u0439 \u0431\u0430\u0439\u0442 \t temp |= temp_lsb; \t temp_double = (double) temp; \t\t\t\t\t\t\t\t\t\/\/ \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043c \u043a \u0444\u043e\u0440\u043c\u0430\u0442\u0443 double \t temp_result =  ((temp_double * 0.02)- 0.01 );\t\/\/ \u0443\u043c\u043d\u043e\u0436\u0430\u0435\u043c \u043d\u0430 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0439 \t temp_result = temp_result - 273.15; \t\t\t\t\t\t\/\/ \u0438 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043c \u043a \u0433\u0440\u0430\u0434. \u0426\u0435\u043b\u044c\u0441\u0438\u044f    return temp_result;    }<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0430\u0434\u0440\u0435\u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u0441\u0434\u0432\u0438\u0433\u0430\u0435\u0442\u0441\u044f \u043d\u0430 1 \u0431\u0438\u0442 \u0432\u043b\u0435\u0432\u043e, \u0430 \u043f\u043e\u0442\u043e\u043c \u0432 \u043f\u0435\u0440\u0432\u044b\u0439 \u0431\u0438\u0442 \u0430\u0434\u0440\u0435\u0441\u0430 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f 1 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f, 0 &#8212; \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438. \u0412 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043d\u0430 \u0434\u0430\u0442\u0447\u0438\u043a \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e \u043e\u0441\u0432\u0435\u0449\u0435\u043d \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0430\u0434\u0440\u0435\u0441\u0430 \u043f\u043e I2C. \u0418 \u0442\u0430\u043c \u043d\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e \u043f\u043e\u0447\u0435\u043c\u0443 \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 5A, \u0430 \u043d\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0435 B4 \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0438 B5 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f. \u041f\u0440\u0438\u043d\u0438\u043c\u0430\u044f \u0432\u043e \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0442\u043e\u0442 \u0444\u0430\u043a\u0442, \u0447\u0442\u043e \u043c\u044b \u0441\u0434\u0432\u0438\u0433\u0430\u0435\u043c \u0430\u0434\u0440\u0435\u0441 \u0432\u043b\u0435\u0432\u043e \u0438 \u043f\u0440\u0438\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0431\u0438\u0442 \u0440\u0435\u0436\u0438\u043c\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430, \u0432\u0441\u0435 \u0432\u0441\u0442\u0430\u0435\u0442 \u043d\u0430 \u0441\u0432\u043e\u0438 \u043c\u0435\u0441\u0442\u0430. \u0415\u0449\u0435 \u0435\u0441\u0442\u044c \u043e\u0434\u043d\u0430 \u0442\u043e\u043d\u043a\u043e\u0441\u0442\u044c. \u0412 \u0441\u0442\u0430\u0440\u0448\u0435\u043c \u0431\u0438\u0442\u0435 \u0441\u0442\u0430\u0440\u0448\u0435\u0433\u043e \u0431\u0430\u0439\u0442\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0431\u0438\u0442 \u043e\u0448\u0438\u0431\u043a\u0438. \u0415\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u0434 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439, \u0447\u0442\u043e \u043c\u044b \u0438 \u0434\u0435\u043b\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u0434 \u0441\u0434\u0432\u0438\u0433\u043e\u043c \u0432 \u0441\u0442\u0430\u0440\u0448\u0438\u0439 \u0431\u0430\u0439\u0442 &#8212; (temp &amp; 0x007F).<\/p>\n<p>\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0445\u043e\u0440\u043e\u0448\u043e, \u043d\u043e \u0435\u0449\u0435 \u043b\u0443\u0447\u0448\u0435 \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0430 LCD, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f void getTemp<em>Mlx90614<\/em>CharArray, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 char \u043c\u0430\u0441\u0441\u0438\u0432, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0421\u0418 sprintf(), \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0430 \u0432 \u0444\u0430\u0439\u043b\u0435 stdio.h<\/p>\n<pre><code class=\"cpp\">void getTemp_Mlx90614_CharArray( uint16_t address, uint8_t ram_address, char* buf){  \tdouble t; \tt = getTemp_Mlx90614_Double(address,ram_address);  \t sprintf(buf, \"%.1f\",t);  \treturn ;  }<\/code><\/pre>\n<p><strong>\u041e\u0431\u0449\u0438\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0447\u0442\u0435\u043d\u0438\u044f \u0438\u0437 RAM \u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/strong><\/p>\n<ol>\n<li>\n<p>START<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0430\u0434\u0440\u0435\u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u0430, \u0441\u0434\u0432\u0438\u043d\u0443\u0442\u044b\u0439 \u043d\u0430 1 \u0431\u0438\u0442 \u0432\u043b\u0435\u0432\u043e \u043f\u043b\u044e\u0441 \u0431\u0438\u0442 \u0437\u0430\u043f\u0438\u0441\u0438 (\u043f\u0435\u0440\u0432\u044b\u0439). \u0414\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 &#8212; 0<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0434\u0430\u0435\u043c  \u0430\u0434\u0440\u0435\u0441 RAM \u043e\u0442\u043a\u0443\u0434\u0430 \u0447\u0438\u0442\u0430\u0442\u044c \u043f\u043b\u044e\u0441 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a RAM. \u0410\u0434\u0440\u0435\u0441\u043e\u043c RAM  \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 \u043a\u0440\u0438\u0441\u0442\u0430\u043b\u043b\u0430 \u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u0438\u043b\u0438 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u0434\u0432\u0443\u0445 \u0438\u043d\u0444\u0440\u0430\u043a\u0440\u0430\u0441\u043d\u044b\u0445 \u0441\u0435\u043d\u0441\u043e\u0440\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0439 START<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0430\u0434\u0440\u0435\u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u0441\u0434\u0432\u0438\u043d\u0443\u0442\u044b\u0439 \u043d\u0430 1 \u0432\u043b\u0435\u0432\u043e \u043f\u043b\u044e\u0441 \u0431\u0438\u0442 \u0447\u0442\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u0427\u0438\u0442\u0430\u0435\u043c \u043c\u043b\u0430\u0434\u0448\u0438\u0439 \u0431\u0430\u0439\u0442<\/p>\n<\/li>\n<li>\n<p>\u0427\u0438\u0442\u0430\u0435\u043c \u0441\u0442\u0430\u0440\u0448\u0438\u0439 \u0431\u0430\u0439\u0442<\/p>\n<\/li>\n<li>\n<p>STOP<\/p>\n<\/li>\n<\/ol>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0443\u043c\u0435\u0435\u043c \u0447\u0438\u0442\u0430\u0442\u044c \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0443 \u0438\u0437 \u0434\u0430\u0442\u0447\u0438\u043a\u0430. \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043c\u0435\u043d\u044f\u0442\u044c \u0430\u0434\u0440\u0435\u0441, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0432\u0435\u0448\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u0432 \u043d\u0430 \u0448\u0438\u043d\u0443. \u041d\u043e \u043f\u0435\u0440\u0435\u0434 \u044d\u0442\u0438\u043c \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0434\u0432\u0435 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 EEPROM \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0438 \u0447\u0442\u0435\u043d\u0438\u044f.<\/p>\n<p><strong>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0447\u0442\u0435\u043d\u0438\u044f \u0438\u0437 EEPROM \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/strong><\/p>\n<ol>\n<li>\n<p>START<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0430\u0434\u0440\u0435\u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u0430, \u0441\u0434\u0432\u0438\u043d\u0443\u0442\u044b\u0439 \u043d\u0430 1 \u0431\u0438\u0442 \u0432\u043b\u0435\u0432\u043e \u043f\u043b\u044e\u0441 \u0431\u0438\u0442 \u0437\u0430\u043f\u0438\u0441\u0438 (\u043f\u0435\u0440\u0432\u044b\u0439). \u0414\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 &#8212; 0<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0434\u0430\u0435\u043c  \u0430\u0434\u0440\u0435\u0441 EEPROM \u043e\u0442\u043a\u0443\u0434\u0430 \u0447\u0438\u0442\u0430\u0442\u044c \u043f\u043b\u044e\u0441 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a EEPROM ( \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0430 \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435 )<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0439 START<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0430\u0434\u0440\u0435\u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u043f\u043b\u044e\u0441 \u0431\u0438\u0442 \u0447\u0442\u0435\u043d\u0438\u044f<\/p>\n<\/li>\n<li>\n<p>\u0427\u0438\u0442\u0430\u0435\u043c \u043c\u043b\u0430\u0434\u0448\u0438\u0439 \u0431\u0430\u0439\u0442<\/p>\n<\/li>\n<li>\n<p>\u0427\u0438\u0442\u0430\u0435\u043c \u0441\u0442\u0430\u0440\u0448\u0438\u0439 \u0431\u0430\u0439\u0442<\/p>\n<\/li>\n<li>\n<p>STOP<\/p>\n<\/li>\n<\/ol>\n<p><strong>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u0438\u0437 EEPROM<\/strong><\/p>\n<pre><code class=\"cpp\">uint16_t readEEPROM( uint16_t address, uint16_t eeprom_address ){  \t uint16_t\tdata_msb; \t uint16_t\tdata_lsb; \t uint16_t data_result;  \t address = address&lt;&lt;1; \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\/\/ \u0441\u0434\u0432\u0438\u0433\u0430\u0435\u043c \u043d\u0430 \u043e\u0434\u0438\u043d \u0432\u043b\u0435\u0432\u043e (\u0442\u0430\u043a \u0434\u0430\u0442\u0447\u0438\u043a \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0430\u0434\u0440\u0435\u0441 + 1 \u0431\u0438\u0442 \u0447\u0442\u0435\u043d\u0438\u0435\/\u0437\u0430\u043f\u0438\u0441\u044c)  \t \t I2C1-&gt;CR1 |= I2C_CR1_START; \t\t while (!(I2C1-&gt;SR1 &amp; I2C_SR1_SB)){}  \t\t (void) I2C1-&gt;SR1;  \t\t I2C1-&gt;DR = address | MLX90614_WRITE; \t\t\t\t\t\t\t\/\/ \u0440\u0435\u0436\u0438\u043c \u0437\u0430\u043f\u0438\u0441\u0438 , \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0430\u0434\u0440\u0435\u0441\u0430 MLX90614 \t\t while (!(I2C1-&gt;SR1 &amp; I2C_SR1_ADDR)){}  \t\t (void) I2C1-&gt;SR1; \t\t (void) I2C1-&gt;SR2;  \t\t I2C1-&gt;DR= eeprom_address | MLX90614_EEPROM_ACCESS;\t\/\/ \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0430\u0434\u0440\u0435\u0441\u0430 EEPROM \u0434\u0430\u0442\u0447\u0438\u043a\u0430 MLX90614 \t\t while (!(I2C1-&gt;SR1 &amp; I2C_SR1_TXE)){}  \t\t I2C1-&gt;CR1 |= I2C_CR1_START;\t\t\t\t\t\t\t\t\t\t\t\t\/\/ \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0439 \u0441\u0442\u0430\u0440\u0442 \t\t while (!(I2C1-&gt;SR1 &amp; I2C_SR1_SB)){}  \t\t (void) I2C1-&gt;SR1;  \t\t I2C1-&gt;DR = address | MLX90614_READ;\t\t\t\t\t\t\t\t\/\/ \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \u0434\u0430\u0442\u0447\u0438\u043a\u0443 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \t\t while (!(I2C1-&gt;SR1 &amp; I2C_SR1_ADDR)){}  \t\t (void) I2C1-&gt;SR1; \t\t (void) I2C1-&gt;SR2;  \t\t \/\/I2C1-&gt;CR1 &amp;= ~I2C_CR1_ACK; \t\t while (!(I2C1-&gt;SR1 &amp; I2C_SR1_RXNE)){};  \t\t data_lsb = I2C1-&gt;DR;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\/\/ \u0447\u0438\u0442\u0430\u0435\u043c \u043c\u043b\u0430\u0434\u0448\u0438\u0439 \u0431\u0430\u0439\u0442  \t\t while(!(I2C1-&gt;SR1 &amp; I2C_SR1_RXNE)){}  \t\t data_msb = I2C1-&gt;DR;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\/\/ \u0447\u0438\u0442\u0430\u0435\u043c \u0441\u0442\u0430\u0440\u0448\u0438\u0439 \u0431\u0430\u0439\u0442   \t\t I2C1-&gt;CR1 |= I2C_CR1_STOP;   \t\tdata_result = ((data_msb &lt;&lt; 8) | data_lsb) ;  \t\t return data_result;   }<\/code><\/pre>\n<p>\u0427\u0442\u0435\u043d\u0438\u0435 \u0438\u0437 EEPROM \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e\u043c\u0443 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0443 \u0447\u0442\u0435\u043d\u0438\u044f \u0438\u0437 RAM. \u0420\u0430\u0437\u043d\u0438\u0446\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u0445 \u0432\u044b\u0431\u043e\u0440\u0430 \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 \u0430\u0434\u0440\u0435\u0441\u0430\u0445 \u044d\u0442\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438.<\/p>\n<p>\u0421 \u0437\u0430\u043f\u0438\u0441\u044c\u044e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0438\u043d\u0430\u0447\u0435. \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439:<\/p>\n<ol>\n<li>\n<p>START<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0430\u0434\u0440\u0435\u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u0430, \u0441\u0434\u0432\u0438\u043d\u0443\u0442\u044b\u0439 \u0432\u043b\u0435\u0432\u043e \u043f\u043b\u044e\u0441 \u0431\u0438\u0442 \u0437\u0430\u043f\u0438\u0441\u0438<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0430\u0434\u0440\u0435\u0441 EEPROM \u043f\u043b\u044e\u0441 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0432\u044b\u0431\u043e\u0440\u0430 EEPROM \u043f\u0430\u043c\u044f\u0442\u0438<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u043c\u043b\u0430\u0434\u0448\u0438\u0439 \u0431\u0430\u0439\u0442<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0441\u0442\u0430\u0440\u0448\u0438\u0439 \u0431\u0430\u0439\u0442<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0434\u0430\u0435\u043c PEC (\u0431\u0430\u0439\u0442 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u043e\u0439 \u0441\u0443\u043c\u043c\u044b )<\/p>\n<\/li>\n<li>\n<p>STOP<\/p>\n<p><null><\/p>\n<li>\n<\/li>\n<p><\/null><\/li>\n<\/ol>\n<p>\u0417\u0434\u0435\u0441\u044c \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0439 \u0441\u0442\u0430\u0440\u0442 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f, \u0430 \u0441\u0440\u0430\u0437\u0443 \u043f\u0438\u0448\u0435\u0442\u0441\u044f \u0434\u0432\u0430 \u0431\u0430\u0439\u0442\u0430 \u0430\u0434\u0440\u0435\u0441\u0430. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0430\u0434\u0440\u0435\u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u043b\u0430\u0434\u0448\u0438\u0439 \u0431\u0430\u0439\u0442, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u0441\u0442\u0430\u0440\u0448\u0438\u0439 \u043f\u0438\u0448\u0443\u0442\u0441\u044f \u043d\u0443\u043b\u0438.<\/p>\n<p><strong>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 EEPROM<\/strong><\/p>\n<pre><code class=\"cpp\">void writeEEPROM ( uint16_t address, uint16_t eeprom_address, uint16_t data ){   \t\t address = address&lt;&lt;1; \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\/\/ \u0441\u0434\u0432\u0438\u0433\u0430\u0435\u043c \u043d\u0430 \u043e\u0434\u0438\u043d \u0432\u043b\u0435\u0432\u043e (\u0442.\u043a. \u0434\u0430\u0442\u0447\u0438\u043a \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0430\u0434\u0440\u0435\u0441 + 1 \u0431\u0438\u0442 \u0447\u0442\u0435\u043d\u0438\u0435\/\u0437\u0430\u043f\u0438\u0441\u044c)  \t\t \t I2C1-&gt;CR1 |= I2C_CR1_START; \t\t\t while (!(I2C1-&gt;SR1 &amp; I2C_SR1_SB)){}  \t\t\t (void) I2C1-&gt;SR1;  \t\t\t I2C1-&gt;DR = address | MLX90614_WRITE; \t\t\t\t\t\t\t\/\/ \u0440\u0435\u0436\u0438\u043c \u0437\u0430\u043f\u0438\u0441\u0438 , \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0430\u0434\u0440\u0435\u0441\u0430 MLX90614 \t\t\t while (!(I2C1-&gt;SR1 &amp; I2C_SR1_ADDR)){}  \t\t\t (void) I2C1-&gt;SR1; \t\t\t (void) I2C1-&gt;SR2;  \t\t\t I2C1-&gt;DR= eeprom_address | MLX90614_EEPROM_ACCESS;\t\/\/ \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0430\u0434\u0440\u0435\u0441\u0430 EEPROM \u0434\u0430\u0442\u0447\u0438\u043a\u0430 MLX90614 \t\t\t while (!(I2C1-&gt;SR1 &amp; I2C_SR1_TXE)){}  \t\t\t I2C1-&gt;DR =  ( uint8_t ) ( data &amp; 0x00FF );\t\t\t\t\t\/\/ \u043f\u0438\u0448\u0435\u043c \u043c\u043b\u0430\u0434\u0448\u0438\u0439 \u0431\u0430\u0439\u0442  \t\t\t while(!(I2C1-&gt;SR1 &amp; I2C_SR1_BTF)){}  \t\t\t I2C1-&gt;DR = ( uint8_t ) ( data &gt;&gt; 8 )\t;\t\t\t\t\t\t\t\/\/ \u043f\u0438\u0448\u0435\u043c \u0441\u0442\u0430\u0440\u0448\u0438\u0439 \u0431\u0430\u0439\u0442 \t\t\t while(!(I2C1-&gt;SR1 &amp; I2C_SR1_BTF)){}  \t\t\t I2C1-&gt;CR1 |= I2C_CR1_PEC;\t\t\t\t\t\t\t\t\t\t\t\t\t\/\/ \u043f\u043e\u0441\u044b\u043b\u0430\u0435\u043c PEC \t\t\t I2C1-&gt;CR1 |= I2C_CR1_STOP;   \t\t\t return ; }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0434\u0432\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 EEPROM. \u041d\u0430 \u043d\u0438\u0445 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0430 \u0434\u0432\u0443\u0445 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u0430\u0434\u0440\u0435\u0441\u0430 \u0434\u0430\u0442\u0447\u0438\u043a\u0430. \u041d\u043e \u043e\u043d\u0438 \u0442\u0430\u043a \u0436\u0435 \u043c\u043e\u0433\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0440\u0435\u0436\u0438\u043c\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u0432 \u0441\u043f\u044f\u0449\u0438\u0439 \u0440\u0435\u0436\u0438\u043c.<\/p>\n<p><strong>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u0430\u0434\u0440\u0435\u0441\u0430 \u0434\u0430\u0442\u0447\u0438\u043a\u0430<\/strong><\/p>\n<pre><code class=\"cpp\">uint16_t getAddrFromEEPROM ( uint16_t address ){  \tuint16_t addr_eeprom; \taddr_eeprom = readEEPROM( address, MLX90614_SMBUS_ADDRESS );  \treturn addr_eeprom;  }<\/code><\/pre>\n<p>\u0422\u0443\u0442 \u0432\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e. \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0430\u0434\u0440\u0435\u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u0430, \u0447\u0438\u0442\u0430\u0435\u0442 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e readEEPROM() \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0430\u0434\u0440\u0435\u0441 \u0438\u0437 EEPROM \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0435\u0433\u043e.<\/p>\n<p>\u0421 \u0437\u0430\u043f\u0438\u0441\u044c\u044e \u043d\u043e\u0432\u043e\u0433\u043e \u0430\u0434\u0440\u0435\u0441\u0430 \u0432 EEPROM \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u0435\u0435. \u0414\u0430\u0442\u0430\u0448\u0438\u0442 \u043d\u0430 MLX90614 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 EEPROM:<\/p>\n<ol>\n<li>\n<p>\u0412\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043f\u0438\u0442\u0430\u043d\u0438\u044f<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u043f\u0438\u0441\u044c \u0432 \u044f\u0447\u0435\u0439\u043a\u0443 \u043d\u0443\u043b\u0435\u0439, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u0441\u0442\u0438\u0440\u0430\u044f \u0435\u0435<\/p>\n<\/li>\n<li>\n<p>\u0416\u0434\u0435\u043c 10 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434<\/p>\n<\/li>\n<li>\n<p>\u041f\u0438\u0448\u0435\u043c \u043d\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u044f\u0447\u0435\u0439\u043a\u0438<\/p>\n<\/li>\n<li>\n<p>\u0416\u0434\u0435\u043c \u0435\u0449\u0435 10 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434<\/p>\n<\/li>\n<li>\n<p>\u0427\u0438\u0442\u0430\u0435\u043c \u044f\u0447\u0435\u0439\u043a\u0443 \u0434\u043b\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0441 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c, \u0447\u0442\u043e\u0431\u044b \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0431\u0435\u0437 \u043e\u0448\u0438\u0431\u043e\u043a<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043f\u0438\u0442\u0430\u043d\u0438\u0435<\/p>\n<\/li>\n<\/ol>\n<p>\u041e\u0442 \u0441\u0435\u0431\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u044e. \u041d\u043e\u0432\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0433\u043e \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043f\u0438\u0442\u0430\u043d\u0438\u044f \u0434\u0430\u0442\u0447\u0438\u043a\u0430. \u0412 \u0441\u0432\u044f\u0437\u0438 \u0441 \u044d\u0442\u0438\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0438\u043d \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0438 \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u0447\u0435\u0440\u0435\u0437, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0440\u0430\u043d\u0437\u0438\u0441\u0442\u043e\u0440. \u0417\u0434\u0435\u0441\u044c \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0432\u043e\u043f\u0440\u043e\u0441 &#8212; \u0437\u0430\u0447\u0435\u043c \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0443\u0436\u0435\u043d \u0440\u0435\u0436\u0438\u043c \u0441\u043d\u0430, \u0435\u0441\u043b\u0438 \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 EEPROM \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0438\u0442\u0430\u043d\u0438\u0435\u043c \u0434\u0430\u0442\u0447\u0438\u043a\u0430? \u041d\u0435 \u043f\u0440\u043e\u0449\u0435 \u043b\u0438 \u0442\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u043f\u0438\u0442\u0430\u043d\u0438\u0435? \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043d\u0435 \u0441\u0442\u0430\u043b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0440\u0435\u0436\u0438\u043c \u0441\u043d\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u0432 \u0442\u0430\u043a\u0438\u0445 \u043e\u0431\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430\u0445 \u043e\u043d \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430. \u0422\u0430\u043a \u0436\u0435 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043d\u0435 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u044e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0438\u0442\u0430\u043d\u0438\u0435\u043c, \u0442\u0430\u043a \u043a\u0430\u043a \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u043e \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435.<\/p>\n<p><strong>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 EEPROM<\/strong><\/p>\n<pre><code class=\"cpp\">int setAddrToEEPROM ( uint16_t address, uint16_t new_address ){  \tuint16_t addr;  \twriteEEPROM ( address, MLX90614_SMBUS_ADDRESS, 0x0); \t\t\t\t\t\/\/ \u0441\u0442\u0438\u0440\u0430\u0435\u043c \u044f\u0447\u0435\u0439\u043a\u0443 \tdelay_ms(10); \twriteEEPROM (address, MLX90614_SMBUS_ADDRESS, new_address ); \t\/\/ \u043f\u0438\u0448\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 \tdelay_ms(10); \taddr = readEEPROM ( address, MLX90614_SMBUS_ADDRESS );\t\t\t \t\/\/ \u0447\u0438\u0442\u0430\u0435\u043c \u0434\u043b\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f  \tif ( addr == new_address){ \t\treturn 1; \t}  \telse return 0;  }<\/code><\/pre>\n<p>\u0418 \u043d\u0430\u043a\u043e\u043d\u0435\u0446 \u043f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0438\u0448\u0435\u043c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0441\u043a\u0435\u0442\u0447 \u0432 main() \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/p>\n<pre><code class=\"cpp\">#include \"main.h\" #include &lt;stdio.h&gt; int main (void){  \tclk_ini(); \t\t\t\t\t\t\t\t\t\t\/\/ \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u0444\u0435\u0440\u0438\u0438 \tlcd_2004a_init(); \t\t\t\t\t\t\/\/ \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u0438\u0441\u043f\u043b\u0435\u044f a2004 \tmlx90614Init(); \t\t\t\t\t\t\t\/\/ \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f I2C \u0434\u043b\u044f \u0434\u0430\u0442\u0447\u0438\u043a\u0430  \tuint16_t geted_eeprom_address; \tchar char_eeprom_address[20]; \tchar crystal_temp[10];   \t\t\t\/\/ \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u043b\u044f \u0441\u0442\u0440\u043e\u043a\u0438 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \tchar first_sensor_temp[10]; \/\/ \u0447\u0438\u0442\u0430\u0435\u043c \u0430\u0434\u0440\u0435\u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u0438\u0437 EEPROM \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u043d\u0430 LCD \tgeted_eeprom_address = getAddrFromEEPROM( 0x5A ); \tsprintf(char_eeprom_address, \"%x\", (uint8_t) geted_eeprom_address); \tsendStr(\"addr value:\", 3, 0); \tsendStr (char_eeprom_address, 3, 14 );  \tsetAddrToEEPROM (0x5A , 0xA); \/\/ \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 \/\/ \u0441\u043d\u043e\u0432\u0430 \u0447\u0438\u0442\u0430\u0435\u043c \u0430\u0434\u0440\u0435\u0441 \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u043d\u0430 LCD \tgeted_eeprom_address = getAddrFromEEPROM( 0x5A ); \tsprintf(char_eeprom_address, \"%x\", (uint8_t) geted_eeprom_address); \tsendStr(\"new addr :\", 4, 0); \tsendStr (char_eeprom_address, 4, 14 );    \twhile(1){ \/\/ \u0447\u0438\u0442\u0430\u0435\u043c \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0443 \u043a\u0440\u0438\u0441\u0442\u0430\u043b\u043b\u0430 \u0438 \u0441\u0435\u043d\u0441\u043e\u0440\u0430 \u0434\u0430\u0442\u0447\u0438\u043a\u0430 \t\t getTemp_Mlx90614_CharArray ( 0x5A,  MLX90614_TA, crystal_temp ); \t\t sendStr( \"Crystal Temp :\", 1, 0 ); \t\t sendStr( crystal_temp, 1, 14 );      \t\tdelay_s(1);      \t\t getTemp_Mlx90614_CharArray ( 0x5A,  MLX90614_TOBJ_1, first_sensor_temp ); \t\t sendStr( \"Sensor Temp  :\", 2, 0 ); \t\t sendStr( first_sensor_temp, 2, 14 );      \t\t\tdelay_s(1); \t} }<\/code><\/pre>\n<p>\u0412 main.h \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c <\/p>\n<pre><code class=\"cpp\">#ifndef CORE_INC_MAIN_H_ #define CORE_INC_MAIN_H_  #include \"stm32f1xx.h\" #include \"clk_ini.h\" \/\/ \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 #include \"delay.h\"\t\t\/\/ \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0438 #include \"lcd_20x4.h\" \/\/ \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 LCD A2004 #include \"mlx90614.h\" \/\/ \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u043c  #endif \/* CORE_INC_MAIN_H_ *\/<\/code><\/pre>\n<p>\u0423 \u043c\u0435\u043d\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0432\u043e\u0442 \u0442\u0430\u043a<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5e1\/c73\/f3b\/5e1c73f3bf70aa941f0a7ddeb2be032e.JPG\" width=\"3024\" height=\"4032\"><figcaption><\/figcaption><\/figure>\n<p>\u0412 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u043d\u044b\u0439 \u043b\u0438\u0441\u0442\u0438\u043d\u0433\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/p>\n<details class=\"spoiler\">\n<summary>mlx90614.h<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">#ifndef I2C_DEVICES_I2C_H_ #define I2C_DEVICES_I2C_H_  #include \"stm32f1xx.h\" #include &lt;stdio.h&gt; #include \"delay.h\"  #define F_APB1 36 \/\/ \u0447\u0430\u0441\u0442\u043e\u0442\u0430 \u0448\u0438\u043d\u044b APB1 #define TPCLK1 ( 1000\/F_APB1 ) \/\/ \u043f\u0435\u0440\u0438\u043e\u0434 \u0447\u0430\u0441\u0442\u043e\u0442\u044b APB1 ns. ~ 28 #define CCR_VALUE ( 10000 \/(TPCLK1 * 2 ) ) \/\/ \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 CCR \u0414\u043b\u044f 36 \u041c\u0433\u0446 ~ 179 #define TRISE_VALUE ( 1000 \/ TPCLK1)  \/\/---------------- RAM addresses -------------------------------------------- #define MLX90614_RAW_IR_1 0x04\t\t\/\/ \u0441\u044b\u0440\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u0441\u0435\u043d\u0441\u043e\u0440\u043e\u0432 #define MLX90614_RAW_IR_2 0x05 #define MLX90614_TA 0x06\t\t\t\/\/ \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 \u043a\u0440\u0438\u0441\u0442\u0430\u043b\u043b\u0430 \u0434\u0430\u0442\u0447\u0438\u043a\u0430 #define MLX90614_TOBJ_1 0x07\t\t\/\/ \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 \u0441 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0418\u041a \u0441\u0435\u043d\u0441\u043e\u0440\u0430 #define MLX90614_TOBJ_2 0x08\t\t\/\/ \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 \u0441\u043e \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0418\u041a \u0441\u0435\u043d\u0441\u043e\u0440\u0430  \/\/--------------- EEPROM addresses ------------------------------------------ #define MLX90614_TO_MAX 0x00 #define MLX90614_TO_MIN 0x01 #define MLX90614_PWM_CTRL 0x02 #define MLX90614_TA_RANGE 0x03 #define MLX90614_EMISSIVITY 0x04 #define MLX90614_CONFIG_REGISTER_1 0x05 #define MLX90614_SMBUS_ADDRESS 0x0E \/\/ LSByte only #define MLX90614_ID_NUMBER_1 0x1C #define MLX90614_ID_NUMBER_2 0x1D #define MLX90614_ID_NUMBER_3 0x1E #define MLX90614_ID_NUMBER_4 0x1F  \/\/--------------- Commands ------------------------------------------------ #define MLX90614_RAM_ACCESS 0 \t\t\t\/\/ \u0434\u043e\u0441\u0442\u0443\u043f \u043a RAM #define MLX90614_EEPROM_ACCESS 0x20 \t\/\/ \u0434\u043e\u0441\u0442\u0443\u043f \u043a EEPROM #define MLX90614_READ_FLAGS 0xF0 \t\t\/\/ \u0447\u0442\u0435\u043d\u0438\u0435 \u0444\u043b\u0430\u0433\u043e\u0432 #define MLX90614_ENTER_SLEEP_MODE 0xFF \t\/\/ \u0440\u0435\u0436\u0438\u043c \u0441\u043d\u0430 #define MLX90614_READ 1\t\t\t\t\t\/\/ \u0440\u0435\u0436\u0438\u043c \u0447\u0442\u0435\u043d\u0438\u044f \u0438\u0437 \u0434\u0430\u0442\u0447\u0438\u043a\u0430 #define MLX90614_WRITE 0\t\t\t\t\/\/ \u0440\u0435\u0436\u0438\u043c \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0434\u0430\u0442\u0447\u0438\u043a  void mlx90614Init( void ); double getTemp_Mlx90614_Double( uint16_t address, uint8_t ram_address ); void getTemp_Mlx90614_CharArray( uint16_t address, uint8_t ram_address, char* buf );  uint16_t getAddrFromEEPROM( uint16_t address ); int setAddrToEEPROM ( uint16_t address, uint16_t new_address );  uint16_t readEEPROM( uint16_t address, uint16_t eeprom_address ); void writeEEPROM ( uint16_t address, uint16_t eeprom_address, uint16_t data );  #endif \/* I2C_DEVICES_I2C_H_ *\/ <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>mlx90614.c<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">#include \"mlx90614.h\"  \/********************************************************************************************  * \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 I2C \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u043c MLX90614   \t\t\t\t\t*  * \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t\t\t\t\t*  ********************************************************************************************\/   void mlx90614Init(void){  \t delay_ms(120);\t\t\t\t\t\t\t\t\/\/ \u043d\u0430 \u0441\u0442\u0430\u0431\u0438\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043f\u0438\u0442\u0430\u043d\u0438\u044f \u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043d\u044b\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0432 \u0434\u0430\u0442\u0447\u0438\u043a\u0435  RCC-&gt;APB2ENR |= RCC_APB2ENR_IOPBEN;\t\t\t\t\/\/ \u0442\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c \u043f\u043e\u0440\u0442 RCC-&gt;APB1ENR |= RCC_APB1ENR_I2C1EN;\t\t\t\t\/\/ \u0442\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c i2c1  GPIOB-&gt;CRL |= GPIO_CRL_MODE6 | GPIO_CRL_MODE7;\t\/\/ \u0432\u044b\u0445\u043e\u0434 50 \u043c\u0433\u0446 GPIOB-&gt;CRL |= GPIO_CRL_CNF6 | GPIO_CRL_CNF7; \t\/\/ \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u0430\u044f \u0444-\u044f \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439 \u0441\u0442\u043e\u043a  I2C1-&gt;CR2 &amp;= ~I2C_CR2_FREQ; \t\t\t\t\t\/\/ \u0441\u043a\u0438\u0434\u044b\u0432\u0430\u0435\u043c \u0431\u0438\u0442\u044b \u0447\u0430\u0441\u0442\u043e\u0442\u044b \u0448\u0438\u043d\u044b \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f  APB1 I2C1-&gt;CR2 |= F_APB1; \t\t\t\t\t\t\t\/\/ \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0447\u0430\u0441\u0442\u043e\u0442\u0443 \u0448\u0438\u043d\u044b APB1 \u043e\u0442 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0442\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f I2C \u043c\u043e\u0434\u0443\u043b\u044c I2C1-&gt;CR1 &amp;= ~I2C_CR1_PE; \t\t\t\t\t\t\/\/ \u0432\u044b\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u044c I2C \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 CCR I2C1-&gt;CCR &amp;= ~I2C_CCR_CCR; I2C1-&gt;CCR |=  CCR_VALUE; I2C1-&gt;TRISE |=  TRISE_VALUE;  I2C1-&gt;CR1 |= I2C_CR1_ENPEC; \t\t\t\t\t\/\/ \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u043e\u0442\u0441\u044b\u043b\u043a\u0443 PEC I2C1-&gt;CR1 |= I2C_CR1_PE;\t\t\t\t\t\t\/\/ \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u044c I2C I2C1-&gt;CR1 |= I2C_CR1_ACK; \t\t\t\t\t\t\/\/ \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c ACK  }  \/********************************************************************************************  * \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \u0432 \u0433\u0440\u0430\u0434. \u0426\u0435\u043b\u044c\u0441\u0438\u044f \u0438 \u0442\u0438\u043f\u043e\u043c double. \t\t\t\t\t*  * \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  \t\t\t\t\t*  * \u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435: \t\t\t\t\t\t\t\t\t\t\t\t\t\t   \t\t\t\t\t*  * address - \t\t\t\t\u0430\u0434\u0440\u0435\u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u0430 MLX90614\t\t\t\t\t\t   \t\t\t\t\t*  * \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t   \t\t\t\t\t*  * ram_address RAM-\u0430\u0434\u0440\u0435\u0441 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f ( \u0441\u043c. \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u0432 .h \u0444\u0430\u0439\u043b\u0435 ) : \t\t   \t\t\t\t\t*  * \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t   \t\t\t\t\t*  * \tMLX90614_TA - \t\t\u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 \u043a\u0440\u0438\u0441\u0442\u0430\u043b\u043b\u0430 \u0434\u0430\u0442\u0447\u0438\u043a\u0430\t\t\t\t\t   \t\t\t\t\t*  * \tMLX90614_TOBJ_1 - \t\u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0418\u041a \u0441\u0435\u043d\u0441\u043e\u0440\u0430\t\t\t\t\t   \t\t\t\t\t*  * \tMLX90614_TOBJ_2 - \t\u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0418\u041a \u0441\u0435\u043d\u0441\u043e\u0440\u0430\t\t\t\t\t  \t\t\t\t\t*   *******************************************************************************************\/  double getTemp_Mlx90614_Double( uint16_t address, \t\t\t\t\t\t\t\tuint8_t ram_address){  \t uint16_t\ttemp ; \t\t\t\t\t\t\/\/ \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 \t uint8_t\ttemp_lsb ;\t\t\t\t\t\/\/ \u043c\u043b\u0430\u0434\u0448\u0438\u0435 \u0431\u0438\u0442\u044b \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \t double temp_result ; \t\t\t\t\t\/\/ \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0430\u044f \u043f\u0435\u0440\u0435\u0441\u0447\u0438\u0442\u0430\u043d\u043d\u0430\u044f \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 \t double temp_double ;\t\t\t\t\t\/\/ \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430, \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u0430\u044f \u043a \u0444\u043e\u0440\u043c\u0430\u0442\u0443 double  \t address = address&lt;&lt;1; \t\t\t\t\t\t\/\/ \u0441\u0434\u0432\u0438\u0433\u0430\u0435\u043c \u043d\u0430 \u043e\u0434\u0438\u043d \u0432\u043b\u0435\u0432\u043e (\u0442\u0430\u043a \u0434\u0430\u0442\u0447\u0438\u043a \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \t \t \t \t \t \t \t \t \t \t \t \t\/\/ \u0430\u0434\u0440\u0435\u0441 \u043f\u043b\u044e\u0441 1-\u0439 \u0431\u0438\u0442 \u0437\u0430\u043f\u0438\u0441\u044c\/\u0447\u0442\u0435\u043d\u0438\u0435) \t I2C1-&gt;CR1 |= I2C_CR1_START; \t while (!(I2C1-&gt;SR1 &amp; I2C_SR1_SB)){}  \t (void) I2C1-&gt;SR1;  \t I2C1-&gt;DR = address | MLX90614_WRITE; \t\t\/\/ \u0440\u0435\u0436\u0438\u043c \u0437\u0430\u043f\u0438\u0441\u0438 , \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0430\u0434\u0440\u0435\u0441\u0430 MLX90614 \t while (!(I2C1-&gt;SR1 &amp; I2C_SR1_ADDR)){}  \t (void) I2C1-&gt;SR1; \t (void) I2C1-&gt;SR2;  \t I2C1-&gt;DR= ram_address;\t\t\t\t\t\t\/\/ \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0430\u0434\u0440\u0435\u0441\u0430 RAM  \u0434\u0430\u0442\u0447\u0438\u043a\u0430 MLX90614 \t while (!(I2C1-&gt;SR1 &amp; I2C_SR1_TXE)){}  \t I2C1-&gt;CR1 |= I2C_CR1_START;\t\t\t\t\/\/ \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0439 \u0441\u0442\u0430\u0440\u0442 \t while (!(I2C1-&gt;SR1 &amp; I2C_SR1_SB)){}  \t (void) I2C1-&gt;SR1;  \t I2C1-&gt;DR = address | MLX90614_READ;\t\t\t\/\/ \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \u0434\u0430\u0442\u0447\u0438\u043a\u0443 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \t while (!(I2C1-&gt;SR1 &amp; I2C_SR1_ADDR)){}  \t (void) I2C1-&gt;SR1; \t (void) I2C1-&gt;SR2;  \t while(!(I2C1-&gt;SR1 &amp; I2C_SR1_RXNE)){}  \t temp_lsb = I2C1-&gt;DR;\t\t\t\t\t\t\t\/\/ \u0447\u0438\u0442\u0430\u0435\u043c \u043c\u043b\u0430\u0434\u0448\u0438\u0439 \u0431\u0430\u0439\u0442  \t while(!(I2C1-&gt;SR1 &amp; I2C_SR1_RXNE)){}  \t temp = I2C1-&gt;DR;\t\t\t\t\t\t\t\t\/\/ \u0447\u0438\u0442\u0430\u0435\u043c \u0441\u0442\u0430\u0440\u0448\u0438\u0439 \u0431\u0430\u0439\u0442  \t I2C1-&gt;CR1 |= I2C_CR1_STOP;  \t temp = (temp &amp; 0x007F) &lt;&lt; 8;\t\t\t\t\t\/\/ \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u0431\u0438\u0442 \u043e\u0448\u0438\u0431\u043a\u0438, \u0441\u0434\u0432\u0438\u0433\u0430\u0435\u043c \u0432 \u0441\u0442\u0430\u0440\u0448\u0438\u0439 \u0431\u0430\u0439\u0442 \t temp |= temp_lsb; \t temp_double = (double) temp; \t\t\t\t\t\/\/ \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043c \u043a \u0444\u043e\u0440\u043c\u0430\u0442\u0443 double \t temp_result =  ((temp_double * 0.02)- 0.01 );\t\/\/ \u0443\u043c\u043d\u043e\u0436\u0430\u0435\u043c \u043d\u0430 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0439 \t temp_result = temp_result - 273.15; \t\t\t\/\/ \u0438 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043c \u043a \u0433\u0440\u0430\u0434. \u0426\u0435\u043b\u044c\u0441\u0438\u044f    return temp_result;    }   \/********************************************************************************************  * \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0432, \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435, \u043c\u0430\u0441\u0441\u0438\u0432 \u0442\u0438\u043f\u0430 char \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0443 \u0432 \u0433\u0440\u0430\u0434. \u0426\u0435\u043b\u044c\u0441\u0438\u044f *  * \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t*  * \u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435: \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t*  * address - \t\t\t\u0430\u0434\u0440\u0435\u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u0430 MLX90614\t\t\t\t\t\t\t\t\t\t\t\t*  * \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t*  * ram_address RAM-\u0430\u0434\u0440\u0435\u0441 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f ( \u0441\u043c. \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u0432 .h \u0444\u0430\u0439\u043b\u0435 ) : \t\t\t\t\t\t\t*  * \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t*  * \tMLX90614_TA - \t\t\u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 \u043a\u0440\u0438\u0441\u0442\u0430\u043b\u043b\u0430 \u0434\u0430\u0442\u0447\u0438\u043a\u0430\t\t\t\t\t\t\t\t\t\t*  * \tMLX90614_TOBJ_1 - \t\u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0418\u041a \u0441\u0435\u043d\u0441\u043e\u0440\u0430\t\t\t\t\t\t\t\t\t\t*  * \tMLX90614_TOBJ_2 - \t\u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0418\u041a \u0441\u0435\u043d\u0441\u043e\u0440\u0430\t\t\t\t\t\t\t\t\t\t*  * \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t*  * \t*buf - \t\t\t\t\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\t\t\t\t\t\t\t\t\t\t\t\t\t*  *******************************************************************************************\/  void getTemp_Mlx90614_CharArray( uint16_t address, uint8_t ram_address, char* buf){  \tdouble t; \tt = getTemp_Mlx90614_Double(address,ram_address);  \t sprintf(buf, \"%.1f\",t);  \treturn ;  }    \/********************************************************************************************  * \u0427\u0442\u0435\u043d\u0438\u0435  EEPROM \u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u043f\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u043c\u0443 \u0430\u0434\u0440\u0435\u0441\u0443\t\t\t\t\t\t\t\t\t\t\t*  * \u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435:\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t*  * address - \u0430\u0434\u0440\u0435\u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u0430\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t*  * eeprom_address - \u0430\u0434\u0440\u0435\u0441 \u0432 EEPROM\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t*  * \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t*  * \u0412\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435:\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t*  * \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u044f\u0447\u0435\u0439\u043a\u0435 EEPROM \u0444\u043e\u0440\u043c\u0430\u0442 uint16_t\t\t\t\t\t\t\t\t\t\t\t\t\t*  *\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t*  * ******************************************************************************************\/  uint16_t readEEPROM( uint16_t address, uint16_t eeprom_address ){  \t uint16_t\tdata_msb; \t uint16_t\tdata_lsb; \t uint16_t data_result;  \t address = address&lt;&lt;1; \t\t\t\t\t\t\t\t\t\/\/ \u0441\u0434\u0432\u0438\u0433\u0430\u0435\u043c \u043d\u0430 \u043e\u0434\u0438\u043d \u0432\u043b\u0435\u0432\u043e (\u0442\u0430\u043a \u0434\u0430\u0442\u0447\u0438\u043a \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0430\u0434\u0440\u0435\u0441 + 1 \u0431\u0438\u0442 \u0447\u0442\u0435\u043d\u0438\u0435\/\u0437\u0430\u043f\u0438\u0441\u044c)  \t \t I2C1-&gt;CR1 |= I2C_CR1_START; \t\t while (!(I2C1-&gt;SR1 &amp; I2C_SR1_SB)){}  \t\t (void) I2C1-&gt;SR1;  \t\t I2C1-&gt;DR = address | MLX90614_WRITE; \t\t\t\t\/\/ \u0440\u0435\u0436\u0438\u043c \u0437\u0430\u043f\u0438\u0441\u0438 , \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0430\u0434\u0440\u0435\u0441\u0430 MLX90614 \t\t while (!(I2C1-&gt;SR1 &amp; I2C_SR1_ADDR)){}  \t\t (void) I2C1-&gt;SR1; \t\t (void) I2C1-&gt;SR2;  \t\t I2C1-&gt;DR= eeprom_address | MLX90614_EEPROM_ACCESS;\t\/\/ \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0430\u0434\u0440\u0435\u0441\u0430 EEPROM \u0434\u0430\u0442\u0447\u0438\u043a\u0430 MLX90614 \t\t while (!(I2C1-&gt;SR1 &amp; I2C_SR1_TXE)){}  \t\t I2C1-&gt;CR1 |= I2C_CR1_START;\t\t\t\t\t\t\/\/ \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0439 \u0441\u0442\u0430\u0440\u0442 \t\t while (!(I2C1-&gt;SR1 &amp; I2C_SR1_SB)){}  \t\t (void) I2C1-&gt;SR1;  \t\t I2C1-&gt;DR = address | MLX90614_READ;\t\t\t\t\/\/ \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \u0434\u0430\u0442\u0447\u0438\u043a\u0443 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \t\t while (!(I2C1-&gt;SR1 &amp; I2C_SR1_ADDR)){}  \t\t (void) I2C1-&gt;SR1; \t\t (void) I2C1-&gt;SR2;  \t\t \/\/I2C1-&gt;CR1 &amp;= ~I2C_CR1_ACK; \t\t while (!(I2C1-&gt;SR1 &amp; I2C_SR1_RXNE)){};  \t\t data_lsb = I2C1-&gt;DR;\t\t\t\t\t\t\t\t\/\/ \u0447\u0438\u0442\u0430\u0435\u043c \u043c\u043b\u0430\u0434\u0448\u0438\u0439 \u0431\u0430\u0439\u0442  \t\t while(!(I2C1-&gt;SR1 &amp; I2C_SR1_RXNE)){}  \t\t data_msb = I2C1-&gt;DR;\t\t\t\t\t\t\t\t\t\/\/ \u0447\u0438\u0442\u0430\u0435\u043c \u0441\u0442\u0430\u0440\u0448\u0438\u0439 \u0431\u0430\u0439\u0442   \t\t I2C1-&gt;CR1 |= I2C_CR1_STOP;   \t\tdata_result = ((data_msb &lt;&lt; 8) | data_lsb) ;\/\/&amp; 0x1F;  \t\t return data_result;   }  \/********************************************************************************************  * \u0417\u0430\u043f\u0438\u0441\u044c \u0432 EEPROM \u043f\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u043c\u0443 \u0430\u0434\u0440\u0435\u0441\u0443 \t\t\t\t\t\t\t\t\t\t\t\t    *  * \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t    *  * \u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435:\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t    *  * address - \t\t\u0430\u0434\u0440\u0435\u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u0430\t\t\t\t\t\t\t\t\t\t\t\t\t\t    *  * eeprom_address - \u0430\u0434\u0440\u0435\u0441 \u0432 EEPROM\t\t\t\t\t\t\t\t\t\t\t\t\t\t    *  * data - \t\t\t\u0434\u0430\u043d\u043d\u044b\u0435\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t    *  ********************************************************************************************\/ void writeEEPROM ( uint16_t address, uint16_t eeprom_address, uint16_t data ){   \t\t address = address&lt;&lt;1; \t\t\t\t\t\t\t\t\t\/\/ \u0441\u0434\u0432\u0438\u0433\u0430\u0435\u043c \u043d\u0430 \u043e\u0434\u0438\u043d \u0432\u043b\u0435\u0432\u043e (\u0442.\u043a. \u0434\u0430\u0442\u0447\u0438\u043a \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0430\u0434\u0440\u0435\u0441 + 1 \u0431\u0438\u0442 \u0447\u0442\u0435\u043d\u0438\u0435\/\u0437\u0430\u043f\u0438\u0441\u044c)  \t\t \t I2C1-&gt;CR1 |= I2C_CR1_START; \t\t\t while (!(I2C1-&gt;SR1 &amp; I2C_SR1_SB)){}  \t\t\t (void) I2C1-&gt;SR1;  \t\t\t I2C1-&gt;DR = address | MLX90614_WRITE; \t\t\t\t\/\/ \u0440\u0435\u0436\u0438\u043c \u0437\u0430\u043f\u0438\u0441\u0438 , \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0430\u0434\u0440\u0435\u0441\u0430 MLX90614 \t\t\t while (!(I2C1-&gt;SR1 &amp; I2C_SR1_ADDR)){}  \t\t\t (void) I2C1-&gt;SR1; \t\t\t (void) I2C1-&gt;SR2;  \t\t\t I2C1-&gt;DR= eeprom_address | MLX90614_EEPROM_ACCESS;\t\/\/ \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0430\u0434\u0440\u0435\u0441\u0430 EEPROM \u0434\u0430\u0442\u0447\u0438\u043a\u0430 MLX90614 \t\t\t while (!(I2C1-&gt;SR1 &amp; I2C_SR1_TXE)){}  \t\t\t I2C1-&gt;DR =  ( uint8_t ) ( data &amp; 0x00FF );\t\t\t\/\/ \u043f\u0438\u0448\u0435\u043c \u043c\u043b\u0430\u0434\u0448\u0438\u0439 \u0431\u0430\u0439\u0442  \t\t\t while(!(I2C1-&gt;SR1 &amp; I2C_SR1_BTF)){}  \t\t\t I2C1-&gt;DR = ( uint8_t ) ( data &gt;&gt; 8 )\t;\t\t\t\/\/ \u043f\u0438\u0448\u0435\u043c \u0441\u0442\u0430\u0440\u0448\u0438\u0439 \u0431\u0430\u0439\u0442 \t\t\t while(!(I2C1-&gt;SR1 &amp; I2C_SR1_BTF)){}  \t\t\t I2C1-&gt;CR1 |= I2C_CR1_PEC;\t\t\t\t\t\t\t\/\/ \u043f\u043e\u0441\u044b\u043b\u0430\u0435\u043c PEC \t\t\t I2C1-&gt;CR1 |= I2C_CR1_STOP;   \t\t\t return ; }  \/********************************************************************************************  * \u0427\u0442\u0435\u043d\u0438\u0435 \u0430\u0434\u0440\u0435\u0441\u0430 \u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u0438\u0437 EEPROM\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t*  * \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t*  * \u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435:\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t*  * address - \u0430\u0434\u0440\u0435\u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u0430\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t*  *\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t*  * \u0412\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435:\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t*  * \u0430\u0434\u0440\u0435\u0441 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 uint8_t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t*  *  \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t*  *******************************************************************************************\/  uint16_t getAddrFromEEPROM ( uint16_t address ){  \tuint16_t addr_eeprom; \taddr_eeprom = readEEPROM( address, MLX90614_SMBUS_ADDRESS );  \treturn addr_eeprom;  }  \/********************************************************************************************  * \u0417\u0430\u043f\u0438\u0441\u044c \u043d\u043e\u0432\u043e\u0433\u043e \u0430\u0434\u0440\u0435\u0441\u0430 \u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u0432 EEPROM\t\t\t\t\t\t\t\t\t\t\t\t\t*  * \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t*  * \u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435:\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t*  * address - \t\t\u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0430\u0434\u0440\u0435\u0441 \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t*  * new_address -\t\u043d\u043e\u0432\u044b\u0439 \u0430\u0434\u0440\u0435\u0441\u0441\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t*  * \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t*  * \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 1 - \u0443\u0441\u043f\u0435\u0448\u043d\u043e\/ 0 - \u043d\u0435\u0443\u0434\u0430\u0447\u0430\t\t\t\t\t\t\t\t\t\t\t\t\t\t*  ********************************************************************************************\/  int setAddrToEEPROM ( uint16_t address, uint16_t new_address ){  \tuint16_t addr;  \twriteEEPROM ( address, MLX90614_SMBUS_ADDRESS, 0x0); \/\/ \u0441\u0442\u0438\u0440\u0430\u0435\u043c \u044f\u0447\u0435\u0439\u043a\u0443 \tdelay_ms(10); \twriteEEPROM (address, MLX90614_SMBUS_ADDRESS, new_address ); \/\/ \u043f\u0438\u0448\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 \tdelay_ms(10); \taddr = readEEPROM ( address, MLX90614_SMBUS_ADDRESS ); \/\/ \u0447\u0438\u0442\u0430\u0435\u043c \u0434\u043b\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f  \tif ( addr == new_address){ \t\treturn 1; \t}  \telse return 0;  } <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>clk_ini.h<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">#ifndef INC_CLK_INI_H_ #define INC_CLK_INI_H_ #include \"stm32f1xx.h\"  int clk_ini(void); #endif \/* INC_CLK_INI_H_ *\/<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>clk_ini.c<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">#include \"clk_ini.h\"  int clk_ini(void){  \tRCC-&gt;CR |= (1 &lt;&lt; RCC_CR_HSEON_Pos);  \t__IO int startCounter; \tfor(startCounter = 0; ; startCounter++){  \t\tif(RCC-&gt;CR &amp; (1 &lt;&lt; RCC_CR_HSERDY_Pos)){  \t\t\tbreak; \t\t}\/\/ if  \t\tif(startCounter &gt; 0x1000){  \t\t\tRCC-&gt;CR &amp;= ~(1 &lt;&lt; RCC_CR_HSEON_Pos); \t\t\treturn 1; \t\t} \t}\/\/ for  \tRCC-&gt;CFGR |= (0x07 &lt;&lt; RCC_CFGR_PLLMULL_Pos) \/\/ PLL x9 \t\t\t \t |(0x01 &lt;&lt; RCC_CFGR_PLLSRC_Pos); \/\/ start clocking PLL of HSE  \tRCC-&gt;CR |= (1 &lt;&lt; RCC_CR_PLLON_Pos);  \tfor(startCounter = 0; ; startCounter++){  \t\tif(RCC-&gt;CR &amp; (1 &lt;&lt; RCC_CR_PLLRDY_Pos)){  \t\t\tbreak; \t\t}\/\/if  \t\tif(startCounter &gt; 0x1000){  \t\t\tRCC-&gt;CR &amp;= ~(1 &lt;&lt; RCC_CR_HSEON_Pos); \t\t\tRCC-&gt;CR &amp;= ~(1 &lt;&lt; RCC_CR_PLLON_Pos); \t\t\treturn 2; \t\t}\/\/ if \t}\/\/ for  \t\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ \t  \/\/\u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c FLASH \u0438 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u0438 \t  \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/  \t  \/\/\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c 2 \u0446\u0438\u043a\u043b\u0430 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f \u0434\u043b\u044f Flash \t  \/\/\u0442\u0430\u043a \u043a\u0430\u043a \u0447\u0430\u0441\u0442\u043e\u0442\u0430 \u044f\u0434\u0440\u0430 \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 48 MHz &lt; SYSCLK &lt;= 72 MHz \t  FLASH-&gt;ACR |= (0x02&lt;&lt;FLASH_ACR_LATENCY_Pos);  \t  \/\/\u0414\u0435\u043b\u0438\u0442\u0435\u043b\u0438 \t  RCC-&gt;CFGR |= (0x00&lt;&lt;RCC_CFGR_PPRE2_Pos) \/\/\u0414\u0435\u043b\u0438\u0442\u0435\u043b\u044c \u0448\u0438\u043d\u044b APB2 \u0440\u0430\u0432\u0435\u043d 1 \t            | (0x04&lt;&lt;RCC_CFGR_PPRE1_Pos) \/\/\u0414\u0435\u043b\u0438\u0442\u0435\u043b\u044c \u043d\u0438\u0448\u044b APB1 \u0440\u0430\u0432\u0435\u043d 2 \t            | (0x00&lt;&lt;RCC_CFGR_HPRE_Pos); \/\/\u0414\u0435\u043b\u0438\u0442\u0435\u043b\u044c AHB \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d   \t  RCC-&gt;CFGR |= (0x02&lt;&lt;RCC_CFGR_SW_Pos); \/\/\u041f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0443 \u043e\u0442 PLL  \t  \/\/\u0416\u0434\u0435\u043c, \u043f\u043e\u043a\u0430 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0438\u043c\u0441\u044f \t  while((RCC-&gt;CFGR &amp; RCC_CFGR_SWS_Msk) != (0x02&lt;&lt;RCC_CFGR_SWS_Pos)) \t  { \t  }  \t  \/\/\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0438\u043b\u0438\u0441\u044c \u043d\u0430 \t  \/\/\u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0442\u0430\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \t  \/\/\u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 RC-\u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \t  \/\/\u0434\u043b\u044f \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0438 \u044d\u043d\u0435\u0440\u0433\u0438\u0438 \t  RCC-&gt;CR &amp;= ~(1&lt;&lt;RCC_CR_HSION_Pos);  \t  \/\/\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0438 \u043f\u0435\u0440\u0435\u043a\u043b\u0431\u044e\u0447\u0435\u043d\u0438\u0435 \u0441\u0438\u0441\u0435\u043c\u044b \t  \/\/\u043d\u0430 \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u0432\u0430\u0440\u0446\u0435\u0432\u044b\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \t  \/\/\u0438 PLL \u0437\u0430\u043f\u0435\u0440\u0448\u0438\u043b\u043e\u0441\u044c \u0443\u0441\u043f\u0435\u0445\u043e\u043c. \t  \/\/\u0412\u044b\u0445\u043e\u0434\u0438\u043c  \treturn 0; }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>delay.h<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">#ifndef DELAY_DELAY_H_ #define DELAY_DELAY_H_  #include \"stm32f1xx.h\"  #define F_CPU 72000000UL #define US F_CPU\/1000000 #define MS F_CPU\/1000 #define SYSTICK_MAX_VALUE 16777215 #define US_MAX_VALUE SYSTICK_MAX_VALUE\/(US) #define MS_MAX_VALUE SYSTICK_MAX_VALUE\/(MS)   void delay_us(uint32_t us); \/\/ \u0434\u043e 233 \u043c\u043a\u0441 void delay_ms(uint32_t ms); \/\/ \u0434\u043e 233 \u043c\u0441 void delay_s(uint32_t s);<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>delay.c<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">#include \"delay.h\"   \/* \u0424\u0443\u043d\u043a\u0446\u0438\u0438 \u0437\u0430\u0434\u0435\u0440\u0436\u0435\u043a \u043d\u0430 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u043a\u0443\u043d\u0434\u044b \u0438 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u044b*\/  void delay_us(uint32_t us){ \/\/ \u0434\u043e 233&nbsp;016 \u043c\u043a\u0441  \tif (us &gt; US_MAX_VALUE || us == 0) \t\treturn;  \tSysTick-&gt;CTRL &amp;= ~SysTick_CTRL_TICKINT_Msk; \/\/ \u0437\u0430\u043f\u0440\u0435\u0442\u0438\u0442\u044c \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f \u043f\u043e \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u0438 0 \tSysTick-&gt;CTRL |= SysTick_CTRL_CLKSOURCE_Msk; \/\/ \u0441\u0442\u0430\u0432\u0438\u043c \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430 \tSysTick-&gt;LOAD = (US * us-1); \/\/ \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440 \u0447\u0438\u0441\u043b\u043e \u043e\u0442 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0441\u0447\u0438\u0442\u0430\u0442\u044c \tSysTick-&gt;VAL = 0; \/\/ \u043e\u0431\u043d\u0443\u043b\u044f\u0435\u043c \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 SYST_CVR \tSysTick-&gt;CTRL |= SysTick_CTRL_ENABLE_Msk; \/\/ \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0441\u0447\u0435\u0442\u0447\u0438\u043a  \twhile(!(SysTick-&gt;CTRL &amp; SysTick_CTRL_COUNTFLAG_Msk)); \/\/ \u0436\u0434\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u0444\u043b\u0430\u0433\u0430 COUNFLAG \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435 SYST_CSR  \tSysTick-&gt;CTRL &amp;= ~SysTick_CTRL_COUNTFLAG_Msk;\t\/\/ \u0441\u043a\u0438\u0434\u044b\u0432\u0430\u0435\u043c \u0431\u0438\u0442 COUNTFLAG \tSysTick-&gt;CTRL &amp;= ~SysTick_CTRL_ENABLE_Msk; \/\/ \u0432\u044b\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0441\u0447\u0435\u0442\u0447\u0438\u043a \treturn;  }  void delay_ms(uint32_t ms){ \/\/ \u0434\u043e 233 \u043c\u0441  \tif(ms &gt; MS_MAX_VALUE || ms ==0) \t\treturn;  \tSysTick-&gt;CTRL &amp;= ~SysTick_CTRL_TICKINT_Msk; \tSysTick-&gt;CTRL |= SysTick_CTRL_CLKSOURCE_Msk; \tSysTick-&gt;LOAD = (MS * ms); \tSysTick-&gt;VAL = 0; \tSysTick-&gt;CTRL |= SysTick_CTRL_ENABLE_Msk;  \twhile(!(SysTick-&gt;CTRL &amp; SysTick_CTRL_COUNTFLAG_Msk));  \tSysTick-&gt;CTRL &amp;= ~SysTick_CTRL_COUNTFLAG_Msk; \tSysTick-&gt;CTRL &amp;= ~SysTick_CTRL_ENABLE_Msk; return;  }  void delay_s(uint32_t s){  \tfor(int i=0; i&lt;s*5;i++) delay_ms(200); \treturn; }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>lcd_20x4.h<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">#ifndef LCD_LCD_20X4_2004A_LCD_20X4_H_ #define LCD_LCD_20X4_2004A_LCD_20X4_H_  #include \"stm32f1xx.h\" #include \"delay.h\"  \/\/ display commands  #define CLEAR_DISPLAY 0x1 #define RETURN_HOME 0x2 #define ENTRY_MODE_SET 0x6 \/\/ mode cursor shift rihgt, display non shift #define DISPLAY_ON 0xC \/\/ non cursor #define DISPLAY_OFF 0x8 #define CURSOR_SHIFT_LEFT 0x10 #define CURSOR_SHIFT_RIGHT 0x14 #define DISPLAY_SHIFT_LEFT 0x18 #define DISPLAY_SHIFT_RIGHT 0x1C #define DATA_BUS_4BIT_PAGE0 0x28 #define DATA_BUS_4BIT_PAGE1 0x2A #define DATA_BUS_8BIT_PAGE0 0x38 #define SET_CGRAM_ADDRESS 0x40 \/\/ usage address |= SET_CGRAM_ADDRESS #define SET_DDRAM_ADDRESS 0x80  \/\/ \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u0438\u0442\u043e\u0432 \u0432 \u043f\u043e\u0440\u0442\u0435 ODR #define PIN_RS 0x1 #define PIN_EN 0x2 #define PIN_D4 0x1000 #define PIN_D5 0x2000 #define PIN_D6 0x4000 #define PIN_D7 0x8000  #define     LCD_PORT               \tGPIOB #define\t\tLCD_ODR \t\t\t\tLCD_PORT-&gt;ODR  #define     LCD_PIN_RS()     \t\tLCD_PORT-&gt;CRL |= GPIO_CRL_MODE0_0;\\ \t\t\t\t\t\t\t\t\tLCD_PORT-&gt;CRL &amp;= ~GPIO_CRL_CNF0; \/\/ PB0  \u0432\u044b\u0445\u043e\u0434 \u0442\u044f\u043d\u0438-\u0442\u043e\u043b\u043a\u0430\u0439, \u0447\u0430\u0441\u0442\u043e\u0442\u0430 10 \u041c\u0433\u0446  #define     LCD_PIN_EN()            LCD_PORT-&gt;CRL |= GPIO_CRL_MODE1_0;\\ \t\t\t\t\t\t\t\t\tLCD_PORT-&gt;CRL &amp;= ~GPIO_CRL_CNF1;        \/\/ PB1  #define     LCD_PIN_D4()            LCD_PORT-&gt;CRH |= GPIO_CRH_MODE12_0;\\ \t\t\t\t\t\t\t\t\tLCD_PORT-&gt;CRH &amp;= ~GPIO_CRH_CNF12;          \/\/ PB7  #define     LCD_PIN_D5()           \tLCD_PORT-&gt;CRH |= GPIO_CRH_MODE13_0;\\ \t\t\t\t\t\t\t\t\tLCD_PORT-&gt;CRH &amp;= ~GPIO_CRH_CNF13;      \/\/ PB6  #define     LCD_PIN_D6()            LCD_PORT-&gt;CRH |= GPIO_CRH_MODE14_0;\\ \t\t\t\t\t\t\t\t\tLCD_PORT-&gt;CRH &amp;= ~GPIO_CRH_CNF14;         \/\/ PB5  #define     LCD_PIN_D7()            LCD_PORT-&gt;CRH |= GPIO_CRH_MODE15_0;\\ \t\t\t\t\t\t\t\t\tLCD_PORT-&gt;CRH &amp;= ~GPIO_CRH_CNF15;         \/\/ PB10  #define     LCD_PIN_MASK   (PIN_RS | PIN_EN | PIN_D7 | PIN_D6 | PIN_D5 | PIN_D4) \/\/ 0b0000000011110011 \u043c\u0430\u0441\u043a\u0430 \u043f\u0438\u043d\u043e\u0432 \u0434\u043b\u044f \u044d\u043a\u0440\u0430\u043d\u0430  void lcd_2004a_init(void); \/\/ \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u043e\u0436\u0435\u043a \u043f\u043e\u0440\u0442\u0430 \u043f\u043e\u0434 \u044d\u043a\u0440\u0430\u043d void sendByte(char byte, int isData); void sendStr(char *str, int row , int position); \/\/ \u0432\u044b\u0432\u043e\u0434 \u0441\u0442\u0440\u043e\u043a\u0438   #endif \/* LCD_LCD_20X4_2004A_LCD_20X4_H_ *\/ <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>lcd_20x4.c<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">#include \"lcd_20x4.h\"  \/\/ \u043f\u043e\u0441\u044b\u043b\u043a\u0430 \u0431\u0430\u0439\u0442\u0430 \u0432 \u043f\u043e\u0440\u0442 LCD  void lcdInit(void); \/\/ \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u0438\u0441\u043f\u043b\u0435\u044f   void sendByte(char byte, int isData){  \t\/\/\u043e\u0431\u043d\u0443\u043b\u044f\u0435\u043c \u0432\u0441\u0435 \u043f\u0438\u043d\u044b \u0434\u0438\u0441\u043f\u043b\u0435\u044f \tLCD_ODR &amp;= ~LCD_PIN_MASK;  \tif(isData == 1) LCD_ODR |= PIN_RS; \/\/ \u0435\u0441\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u0442\u0430\u0432\u043c\u0438\u043c RS \t\telse LCD_ODR &amp;= ~(PIN_RS);\t\t   \/\/ \u0438\u043d\u0430\u0447\u0435 \u0441\u043a\u0438\u0434\u044b\u0432\u0430\u0435\u043c RS  \t\/\/ \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0435\u043c \u043f\u0438\u043d E \t\tLCD_ODR |= PIN_EN;  \t\/\/ \u0441\u0442\u0430\u0432\u0438\u043c \u0441\u0442\u0430\u0440\u0448\u0443\u044e \u0442\u0435\u0442\u0440\u0430\u0434\u0443 \u043d\u0430 \u043f\u043e\u0440\u0442 \tif(byte &amp; 0x80) LCD_ODR |= PIN_D7; \tif(byte &amp; 0x40) LCD_ODR |= PIN_D6; \tif(byte &amp; 0x20) LCD_ODR |= PIN_D5; \tif(byte &amp; 0x10) LCD_ODR |= PIN_D4; \t \tLCD_ODR &amp;= ~PIN_EN; \/\/ \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u043f\u0438\u043d \u0415  \t\/\/\u043e\u0431\u043d\u0443\u043b\u044f\u0435\u043c \u0432\u0441\u0435 \u043f\u0438\u043d\u044b \u0434\u0438\u0441\u043f\u043b\u0435\u044f \u043a\u0440\u043e\u043c\u0435 RS \tLCD_ODR &amp;= ~(LCD_PIN_MASK &amp; ~PIN_RS);  \t\/\/ \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0435\u043c \u043f\u0438\u043d E  \t\tLCD_ODR |= PIN_EN; \t\/\/ \u0441\u0442\u0430\u0432\u0438\u043c \u043c\u043b\u0430\u0434\u0448\u0443\u044e \u0442\u0435\u0442\u0440\u0430\u0434\u0443 \u043d\u0430 \u043f\u043e\u0440\u0442 \tif(byte &amp; 0x8) LCD_ODR |= PIN_D7; \tif(byte &amp; 0x4) LCD_ODR |= PIN_D6; \tif(byte &amp; 0x2) LCD_ODR |= PIN_D5; \tif(byte &amp; 0x1) LCD_ODR |= PIN_D4;  \t\/\/ \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u043f\u0438\u043d \u0415  \tLCD_ODR &amp;= ~(PIN_EN); \tdelay_us(40);   \treturn; }  \/\/ \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0442\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u0442 \u043f\u043e\u0440\u0442 \u043f\u043e\u0434 \u0434\u0438\u0441\u043f\u043b\u0435\u0439 \u0438 \u0437\u0430\u0434\u0430\u0435\u0442 \u043f\u0438\u043d\u044b \u043d\u0430 \u0432\u044b\u0445\u043e\u0434 \u0442\u044f\u043d\u0438 \u0442\u043e\u043b\u043a\u0430\u0439 \u0438 \u0447\u0430\u0441\u0442\u043e\u0442\u0443 50 \u041c\u0433\u0446  void lcd_2004a_init(void){  \/\/----------------------\u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u0440\u0442\u0430----------------------------------------------------  \tif(LCD_PORT == GPIOB) RCC-&gt;APB2ENR |= RCC_APB2ENR_IOPBEN; \telse if (LCD_PORT == GPIOA) RCC-&gt;APB2ENR |= RCC_APB2ENR_IOPAEN; \telse return;  \/\/--------------------- \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0438\u043d\u043e\u0432 \u0434\u043b\u044f LCD-----------------------------------------------------  \t\tLCD_PIN_RS(); \t\tLCD_PIN_EN(); \t\tLCD_PIN_D7(); \t\tLCD_PIN_D6(); \t\tLCD_PIN_D5(); \t\tLCD_PIN_D4();   \t\tlcdInit();       \treturn ; }  \/\/--------------------- \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u0438\u0441\u043f\u043b\u0435\u044f----------------------------------------------------------- void lcdInit(void){    \t\t\tdelay_ms(200); \/\/ \u0436\u0434\u0435\u043c \u043f\u043e\u043a\u0430 \u0441\u0442\u0430\u0431\u0438\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u0438\u0442\u0430\u043d\u0438\u0435  \t\t\tsendByte(0x33, 0); \/\/ \u0448\u043b\u0435\u043c \u0432 \u043e\u0434\u043d\u043e\u043c \u0431\u0430\u0439\u0442\u0435 \u0434\u0432\u0430 0011 \t\t\tdelay_us(120);  \t\t\tsendByte(0x32, 0); \/\/ \u0448\u043b\u0435\u043c \u0432 \u043e\u0434\u043d\u043e\u043c \u0431\u0430\u0439\u0442\u0435  00110010 \t\t\tdelay_us(40);  \t\t\tsendByte(DATA_BUS_4BIT_PAGE0, 0); \/\/ \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0440\u0435\u0436\u0438\u043c 4 \u0431\u0438\u0442 \t\t\tdelay_us(40); \t\t\tsendByte(DISPLAY_OFF, 0); \/\/ \u0432\u044b\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0434\u0438\u0441\u043f\u043b\u0435\u0439 \t\t\tdelay_us(40); \t\t\tsendByte(CLEAR_DISPLAY, 0); \/\/ \u043e\u0447\u0438\u0449\u0430\u0435\u043c \u0434\u0438\u0441\u043f\u043b\u0435\u0439 \t\t\tdelay_ms(2); \t\t\tsendByte(ENTRY_MODE_SET, 0); \/\/\u0441\u0442\u0430\u0432\u0438\u043c \u0440\u0435\u0436\u0438\u043c \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043a\u0443\u0440\u0441\u043e\u0440\u0430 \u044d\u043a\u0440\u0430\u043d \u043d\u0435 \u0441\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \t\t\tdelay_us(40); \t\t\tsendByte(DISPLAY_ON, 0);\/\/ \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0434\u0438\u0441\u043f\u043b\u0435\u0439 \u0438 \u0443\u0431\u0438\u0440\u0430\u0435\u043c \u043a\u0443\u0440\u0441\u043e\u0440 \t\t\tdelay_us(40);   \treturn ; }  void sendStr( char *str, int row , int position ){  \tchar start_address;  \tswitch (row) {  \tcase 1: \t\tstart_address = 0x0; \/\/ 1 \u0441\u0442\u0440\u043e\u043a\u0430 \t\tbreak;  \tcase 2: \t\tstart_address = 0x40; \/\/ 2 \u0441\u0442\u0440\u043e\u043a\u0430 \t\tbreak;  \tcase 3: \t\tstart_address = 0x14; \/\/ 3 \u0441\u0442\u0440\u043e\u043a\u0430 \t\tbreak;  \tcase 4: \t\tstart_address = 0x54; \/\/ 4 \u0441\u0442\u0440\u043e\u043a\u0430 \t\tbreak;  \t}  \tstart_address += position; \/\/ \u043a \u043d\u0430\u0447\u0430\u043b\u0443 \u0441\u0442\u0440\u043e\u043a\u0438 \u043f\u0440\u0438\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0432 \u0441\u0442\u0440\u043e\u043a\u0435  \tsendByte((start_address |= SET_DDRAM_ADDRESS), 0); \/\/ \u0441\u0442\u0430\u0432\u0438\u043c \u043a\u0443\u0440\u0441\u043e\u0440 \u043d\u0430 \u043d\u0430\u0447\u0430\u043b\u043e \u043d\u0443\u0436\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438  \u0432 DDRAM  \tdelay_ms(4); \twhile(*str != '\\0'){  \t\tsendByte(*str, 1); \t\tstr++;   \t}\/\/ while }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<\/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=\"https:\/\/habr.com\/ru\/post\/528792\/\"> https:\/\/habr.com\/ru\/post\/528792\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<p>\u0414\u0430\u0442\u0447\u0438\u043a MLX90614 &#8212; \u044d\u0442\u043e \u0434\u0430\u0442\u0447\u0438\u043a \u0441 \u0431\u0435\u0441\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u043d\u044b\u043c \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u0435\u043c \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u043f\u0440\u0438\u0435\u043c\u0430 \u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u043d\u0444\u0440\u0430\u043a\u0440\u0430\u0441\u043d\u043e\u0433\u043e \u0438\u0437\u043b\u0443\u0447\u0435\u043d\u0438\u044f. \u041e\u043d \u0443\u043c\u0435\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u0442\u0440\u0435\u0445 \u0440\u0435\u0436\u0438\u043c\u0430\u0445: \u0442\u0435\u0440\u043c\u043e\u0441\u0442\u0430\u0442, \u0428\u0418\u041c \u0432\u044b\u0445\u043e\u0434 \u0438 SMBus. \u0412 \u0440\u0435\u0436\u0438\u043c\u0435 \u0442\u0435\u0440\u043c\u043e\u0441\u0442\u0430\u0442 \u0434\u0430\u0442\u0447\u0438\u043a\u0443 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440, \u043e\u043d \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u0435\u0440\u0436\u0438\u0442 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0443 \u0432 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445, \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044f \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u043c \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u0441\u0442\u043e\u043a\u043e\u043c. \u0412 \u0440\u0435\u0436\u0438\u043c\u0435 \u0428\u0418\u041c \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0438\u0433\u043d\u0430\u043b \u0428\u0418\u041c, \u0441\u043a\u0432\u0430\u0436\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b. \u0412 \u0446\u0435\u043b\u044f\u0445 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0443 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0435\u043d \u0440\u0435\u0436\u0438\u043c SMBus. \u0422\u0430\u043a \u043a\u0430\u043a \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u044d\u043b\u0435\u043a\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u0438 \u0438 \u0441\u0438\u0433\u043d\u0430\u043b\u044c\u043d\u043e \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c \u0441 I2C \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u043c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u044b\u0439 I2C. \u041e \u043d\u0435\u043c \u0438 \u043f\u043e\u0439\u0434\u0435\u0442 \u0440\u0435\u0447\u044c \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435. \u0412\u0441\u0435 \u0440\u0435\u0436\u0438\u043c\u044b \u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0437\u0430\u043f\u0438\u0441\u044c\u044e \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u044f\u0447\u0435\u0439\u043a\u0438 EEPROM. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0434\u0430\u0442\u0447\u0438\u043a \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 SMBus. <\/p>\n<hr>\n<h2>\u0412\u043d\u0435\u0448\u043d\u0438\u0439 \u0432\u0438\u0434 \u0438 \u0441\u0445\u0435\u043c\u0430 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f <\/h2>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<p>\u0412 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u043d\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e. \u0423 \u043c\u0435\u043d\u044f \u0435\u0441\u0442\u044c \u043f\u043b\u0430\u0442\u0430 &#171;\u0421\u0438\u043d\u044f\u044f \u0442\u0430\u0431\u043b\u0435\u0442\u043a\u0430&#187; \u0441 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u043c STM32F103C8T6 \u043d\u0430 \u0431\u043e\u0440\u0442\u0443, \u0432\u043e\u0442 \u043a \u043d\u0435\u0439 \u0438 \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0434\u0430\u0442\u0447\u0438\u043a. \u0423 \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 2 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 I2C. \u0414\u043b\u044f \u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0435\u0440\u0432\u044b\u0439 \u043d\u0430 \u0432\u044b\u0432\u043e\u0434\u0430\u0445 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e. \u042d\u0442\u043e PB6 &#8212; SCL, PB7 &#8212; SDA. \u041f\u0440\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0435 \u0437\u0430\u0431\u044b\u0442\u044c \u043f\u043e\u0434\u0442\u044f\u043d\u0443\u0442\u044c \u044d\u0442\u0438 \u0432\u044b\u0432\u043e\u0434\u044b \u043a \u043f\u0438\u0442\u0430\u043d\u0438\u044e \u0432\u043d\u0435\u0448\u043d\u0438\u043c\u0438 \u0440\u0435\u0437\u0438\u0441\u0442\u043e\u0440\u0430\u043c\u0438, \u0443 \u043c\u0435\u043d\u044f \u0438\u0445 \u0441\u043e\u043f\u0440\u043e\u0442\u0438\u0432\u043b\u0435\u043d\u0438\u0435 4.7 \u043a\u041e\u043c. <\/p>\n<h2>\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c<\/h2>\n<p>\u0412\u0435\u0441\u044c \u043a\u043e\u0434 \u044f \u0440\u0435\u0448\u0438\u043b \u043e\u0444\u043e\u0440\u043c\u0438\u0442\u044c \u0432 \u0432\u0438\u0434\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0435\u0439 \u0438\u0437 \u0434\u0432\u0443\u0445 \u0444\u0430\u0439\u043b\u043e\u0432: mlx90614.h \u0438 mlx90614.c . \u0422\u0430\u043a\u0436\u0435 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u0442\u0430\u0439\u043c\u0435\u0440\u0430 \u0434\u043b\u044f \u0437\u0430\u0434\u0435\u0440\u0436\u0435\u043a \u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 LCD \u0434\u0438\u0441\u043f\u043b\u0435\u044f A2004 \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b. \u041e\u043d\u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0432 <a href=\"https:\/\/habr.com\/ru\/post\/522938\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a>.<\/p>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430. <\/p>\n<pre><code class=\"cpp\">#ifndef I2C_DEVICES_I2C_H_ #define I2C_DEVICES_I2C_H_  #include \"stm32f1xx.h\" #include &lt;stdio.h&gt; #include \"delay.h\"  #define F_APB1 36 \t\t\t\t\t\t\t\t\t\t\t\t\t\/\/ \u0447\u0430\u0441\u0442\u043e\u0442\u0430 \u0448\u0438\u043d\u044b APB1 #define TPCLK1 ( 1000\/F_APB1 ) \t\t\t\t\t\t\t\/\/ \u043f\u0435\u0440\u0438\u043e\u0434 \u0447\u0430\u0441\u0442\u043e\u0442\u044b APB1 ns. ~ 28 #define CCR_VALUE ( 10000 \/(TPCLK1 * 2 ) ) \t\/\/ \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 CCR \u0414\u043b\u044f 36 \u041c\u0433\u0446 ~ 179 #define TRISE_VALUE ( 1000 \/ TPCLK1)<\/code><\/pre>\n<p>\u0412 \u043d\u0430\u0447\u0430\u043b\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0434\u043b\u044f \u0441\u0432\u043e\u0435\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430. \u0423 \u043c\u0435\u043d\u044f \u044d\u0442\u043e stm32f1xx.h. \u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0421\u0418 stdio.h \u043d\u0443\u0436\u043d\u0430 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442\u044c \u0434\u0440\u043e\u0431\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 \u0432 char \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u043d\u0430 LCD. delay.h &#8212; \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0437\u0430\u0434\u0435\u0440\u0436\u0435\u043a. <\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0438\u0434\u0443\u0442 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u0434\u043b\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e\u0433\u043e I2C. \u0412 \u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0438 \u0432 \u043a\u043e\u0434\u0435 \u043e\u043d\u0438 \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u044f\u0442\u0441\u044f \u0432 \u043d\u0443\u0436\u043d\u044b\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u044b. \u042d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043c\u0435\u043d\u044f\u044f \u0447\u0430\u0441\u0442\u043e\u0442\u0443 \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u0430\u043a\u0440\u043e\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 F_APB1, \u0430 \u043d\u0435 \u043a\u043e\u043f\u0430\u0442\u044c\u0441\u044f \u0432 \u043a\u043e\u0434\u0435 \u0438 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u0430 \u043d\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0438\u0434\u0435\u043c \u0432 \u0434\u0430\u0442\u0430\u0448\u0438\u0442 \u0438 \u0443\u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u0434\u0430\u0442\u0447\u0438\u043a \u0438\u043c\u0435\u0435\u0442 \u0434\u0432\u0435 \u0440\u0430\u0437\u043d\u044b\u0435 \u043f\u0430\u043c\u044f\u0442\u0438: RAM \u0438 EEPROM. RAM \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b. \u0412\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 \u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0443 \u0441 \u0441\u0435\u043d\u0441\u043e\u0440\u043e\u0432, \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0438 \u043a\u043b\u0430\u0434\u0435\u0442 \u0432 \u044f\u0447\u0435\u0439\u043a\u0438 RAM \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0443 \u0432 \u041a\u0435\u043b\u044c\u0432\u0438\u043d\u0430\u0445. \u0412 \u043f\u0435\u0440\u0432\u044b\u0445 \u0434\u0432\u0443\u0445 \u044f\u0447\u0435\u0439\u043a\u0430\u0445 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f &#171;\u0441\u044b\u0440\u0430\u044f \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430&#187;. \u042f \u043d\u0435 \u043f\u043e\u043d\u044f\u043b \u0447\u0442\u043e \u043e\u043d\u0430 \u0438\u0437 \u0441\u0435\u0431\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442. \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u044f\u0447\u0435\u0439\u043a\u0430\u0445 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 \u043a\u0440\u0438\u0441\u0442\u0430\u043b\u043b\u0430 \u0434\u0430\u0442\u0447\u0438\u043a\u0430, \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0438 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0441\u0435\u043d\u0441\u043e\u0440\u0430. \u0414\u0430\u0442\u0447\u0438\u043a\u0438 MLX90614 \u0431\u044b\u0432\u0430\u044e\u0442 \u0441 \u043e\u0434\u043d\u0438\u043c \u0438 \u0434\u0432\u0443\u043c\u044f \u0434\u0430\u0442\u0447\u0438\u043a\u0430\u043c\u0438. \u0423 \u043c\u0435\u043d\u044f \u0441 \u043e\u0434\u043d\u0438\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 \u0431\u0443\u0434\u0435\u0442 \u0447\u0438\u0442\u0430\u0442\u044c\u0441\u044f \u0441 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0441\u0435\u043d\u0441\u043e\u0440\u0430. \u0412 EEPROM \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u0434\u0430\u0442\u0447\u0438\u043a\u0430. \u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u0430\u0434\u0440\u0435\u0441\u0430\u0446\u0438\u044e \u043f\u0430\u043c\u044f\u0442\u0438 \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u0432 \u0432\u0438\u0434\u0435 \u043c\u0430\u043a\u0440\u043e\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439.<\/p>\n<pre><code class=\"cpp\">\/\/---------------- RAM addresses -------------------------------------------- #define MLX90614_RAW_IR_1 0x04\t\t\/\/ \u0441\u044b\u0440\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u0441\u0435\u043d\u0441\u043e\u0440\u043e\u0432 #define MLX90614_RAW_IR_2 0x05 #define MLX90614_TA 0x06\t\t\t\t\t\/\/ \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 \u043a\u0440\u0438\u0441\u0442\u0430\u043b\u043b\u0430 \u0434\u0430\u0442\u0447\u0438\u043a\u0430 #define MLX90614_TOBJ_1 0x07\t\t\t\/\/ \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 \u0441 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0418\u041a \u0441\u0435\u043d\u0441\u043e\u0440\u0430 #define MLX90614_TOBJ_2 0x08\t\t\t\/\/ \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 \u0441\u043e \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0418\u041a \u0441\u0435\u043d\u0441\u043e\u0440\u0430  \/\/--------------- EEPROM addresses ------------------------------------------ #define MLX90614_TO_MAX 0x00 #define MLX90614_TO_MIN 0x01 #define MLX90614_PWM_CTRL 0x02 #define MLX90614_TA_RANGE 0x03 #define MLX90614_EMISSIVITY 0x04 #define MLX90614_CONFIG_REGISTER_1 0x05 #define MLX90614_SMBUS_ADDRESS 0x0E \/\/ LSByte only #define MLX90614_ID_NUMBER_1 0x1C #define MLX90614_ID_NUMBER_2 0x1D #define MLX90614_ID_NUMBER_3 0x1E #define MLX90614_ID_NUMBER_4 0x1F<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0438\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043a \u0434\u0430\u0442\u0447\u0438\u043a\u0443 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043e\u043d \u0443\u043c\u0435\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c.<\/p>\n<pre><code class=\"cpp\">\/\/--------------- Commands ------------------------------------------------ #define MLX90614_RAM_ACCESS 0 \t\t\t\t\t\/\/ \u0434\u043e\u0441\u0442\u0443\u043f \u043a RAM #define MLX90614_EEPROM_ACCESS 0x20 \t\t\/\/ \u0434\u043e\u0441\u0442\u0443\u043f \u043a EEPROM #define MLX90614_READ_FLAGS 0xF0 \t\t\t\t\/\/ \u0447\u0442\u0435\u043d\u0438\u0435 \u0444\u043b\u0430\u0433\u043e\u0432 #define MLX90614_ENTER_SLEEP_MODE 0xFF \t\/\/ \u0440\u0435\u0436\u0438\u043c \u0441\u043d\u0430 #define MLX90614_READ 1\t\t\t\t\t\t\t\t\t\/\/ \u0440\u0435\u0436\u0438\u043c \u0447\u0442\u0435\u043d\u0438\u044f \u0438\u0437 \u0434\u0430\u0442\u0447\u0438\u043a\u0430 #define MLX90614_WRITE 0\t\t\t\t\t\t\t\t\/\/ \u0440\u0435\u0436\u0438\u043c \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0434\u0430\u0442\u0447\u0438\u043a<\/code><\/pre>\n<p>\u0421 \u043c\u0430\u043a\u0440\u043e\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f\u043c\u0438 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0438. \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0431\u0443\u0434\u0435\u0442 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u043c. \u0427\u0442\u043e\u0431\u044b \u043a\u043e\u043c\u0444\u043e\u0440\u0442\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u043c \u043d\u0443\u0436\u043d\u043e \u0443\u043c\u0435\u0442\u044c \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0443 \u0438 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0438 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0430\u0434\u0440\u0435\u0441 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u043d\u0430 \u0448\u0438\u043d\u0435 I2C \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0430\u043a\u0438\u0445 \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u0432, \u0430 \u0430\u0434\u0440\u0435\u0441 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0443 \u0432\u0441\u0435\u0445 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0439 &#8212; 5A. \u042f \u0437\u0430\u0434\u0443\u043c\u044b\u0432\u0430\u043b \u0432 \u0441\u0432\u043e\u0435\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0432\u0430 \u0442\u0430\u043a\u0438\u0445 \u0434\u0430\u0442\u0447\u0438\u043a\u0430, \u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0432 \u0444\u043e\u0440\u0443\u043c\u044b \u043f\u043e\u043d\u044f\u043b, \u0447\u0442\u043e \u043e\u043d\u0438 \u0434\u043b\u044f \u043c\u043e\u0438\u0445 \u0446\u0435\u043b\u0435\u0439 \u043d\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0442. \u0422\u0430\u043a \u043a\u0430\u043a \u0434\u0430\u0442\u0447\u0438\u043a\u0438 \u0443\u0436\u0435 \u0431\u044b\u043b\u0438 \u0443 \u043c\u0435\u043d\u044f \u044f \u0440\u0435\u0448\u0438\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u043e\u0434 \u043d\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u043d\u0430 \u0431\u0443\u0434\u0443\u0449\u0435\u0435.<\/p>\n<p><strong>\u0418\u0442\u0430\u043a \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0438:<\/strong><\/p>\n<pre><code class=\"cpp\">void mlx90614Init( void ); double getTemp_Mlx90614_Double( uint16_t address, uint8_t ram_address ); void getTemp_Mlx90614_CharArray( uint16_t address, uint8_t ram_address, char* buf );  uint16_t getAddrFromEEPROM( uint16_t address ); int setAddrToEEPROM ( uint16_t address, uint16_t new_address );  uint16_t readEEPROM( uint16_t address, uint16_t eeprom_address ); void writeEEPROM ( uint16_t address, uint16_t eeprom_address, uint16_t data );  #endif \/* I2C_DEVICES_I2C_H_ *\/<\/code><\/pre>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"368\" width=\"368\">\n<p>void mlx90614Init( void )<\/p>\n<\/td>\n<td>\n<p>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f I2C \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u043c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"368\" width=\"368\">\n<p>double getTemp<em>Mlx90614<\/em>Double( uint16<em>t address, uint8<\/em>t ram_address )<\/p>\n<\/td>\n<td>\n<p>\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0443 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 double \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u0443\u044e \u043a \u0433\u0440\u0430\u0434\u0443\u0441\u0430\u043c \u0426\u0435\u043b\u044c\u0441\u0438\u044f. \u041f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u0430 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0430\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u041f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0430\u0434\u0440\u0435\u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u0438 \u0430\u0434\u0440\u0435\u0441 RAM \u043f\u0430\u043c\u044f\u0442\u0438 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0447\u0438\u0442\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435.  \u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0430\u0434\u0440\u0435\u0441\u0430 RAM \u0432\u0435\u0440\u043d\u0435\u0442 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0443 \u043a\u0440\u0438\u0441\u0442\u0430\u043b\u043b\u0430, \u0441\u0435\u043d\u0441\u043e\u0440\u0430 1 \u0438\u043b\u0438 2.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"368\" width=\"368\">\n<p>void getTemp<em>Mlx90614<\/em>CharArray( uint16<em>t address, uint8<\/em>t ram_address, char* buf )<\/p>\n<\/td>\n<td>\n<p>\u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0430\u044f \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 char \u043c\u0430\u0441\u0441\u0438\u0432, \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435. \u0423\u0434\u043e\u0431\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \u043d\u0430 LCD<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"368\" width=\"368\">\n<p>uint16<em>t getAddrFromEEPROM( uint16<\/em>t address )<\/p>\n<\/td>\n<td>\n<p>\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0430\u0434\u0440\u0435\u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u0430, \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0432 \u0435\u0433\u043e EEPROM. \u041f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0430\u0434\u0440\u0435\u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u0430. <\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"368\" width=\"368\">\n<p>int setAddrToEEPROM ( uint16<em>t address, uint16<\/em>t new_address )<\/p>\n<\/td>\n<td>\n<p>\u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0430\u0434\u0440\u0435\u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u0432 EEPROM. \u041f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0430\u0434\u0440\u0435\u0441\u0430 \u0434\u0430\u0442\u0447\u0438\u043a\u0430.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"368\" width=\"368\">\n<p>uint16<em>t readEEPROM( uint16<\/em>t address, uint16<em>t eeprom<\/em>address )<\/p>\n<\/td>\n<td>\n<p>\u0423\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0447\u0442\u0435\u043d\u0438\u044f EEPROM<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"368\" width=\"368\">\n<p>void writeEEPROM ( uint16<em>t address, uint16<\/em>t eeprom<em>address, uint16<\/em>t data )<\/p>\n<\/td>\n<td>\n<p>\u0423\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 EEPROM<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u0421 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u044b\u043c \u0444\u0430\u0439\u043b\u043e\u043c \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0438. \u0421\u0430\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0439.<\/p>\n<pre><code class=\"cpp\">void mlx90614Init(void){  \t delay_ms(120);\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\/\/ \u043d\u0430 \u0441\u0442\u0430\u0431\u0438\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043f\u0438\u0442\u0430\u043d\u0438\u044f \u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043d\u044b\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0432 \u0434\u0430\u0442\u0447\u0438\u043a\u0435  RCC-&gt;APB2ENR |= RCC_APB2ENR_IOPBEN;\t\t\t\t\t\t\t\/\/ \u0442\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c \u043f\u043e\u0440\u0442 RCC-&gt;APB1ENR |= RCC_APB1ENR_I2C1EN;\t\t\t\t\t\t\t\/\/ \u0442\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c i2c1  GPIOB-&gt;CRL |= GPIO_CRL_MODE6 | GPIO_CRL_MODE7;\t\/\/ \u0432\u044b\u0445\u043e\u0434 50 \u043c\u0433\u0446 GPIOB-&gt;CRL |= GPIO_CRL_CNF6 | GPIO_CRL_CNF7; \t\t\/\/ \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u0430\u044f \u0444-\u044f \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439 \u0441\u0442\u043e\u043a  I2C1-&gt;CR2 &amp;= ~I2C_CR2_FREQ; \t\t\t\t\t\t\t\t\t\t\/\/ \u0441\u043a\u0438\u0434\u044b\u0432\u0430\u0435\u043c \u0431\u0438\u0442\u044b \u0447\u0430\u0441\u0442\u043e\u0442\u044b \u0448\u0438\u043d\u044b \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f  APB1 I2C1-&gt;CR2 |= F_APB1; \t\t\t\t\t\t\t\t\t\t\t\t\t\t\/\/ \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0447\u0430\u0441\u0442\u043e\u0442\u0443 \u0448\u0438\u043d\u044b APB1 \u043e\u0442 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0442\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f I2C \u043c\u043e\u0434\u0443\u043b\u044c I2C1-&gt;CR1 &amp;= ~I2C_CR1_PE; \t\t\t\t\t\t\t\t\t\t\t\/\/ \u0432\u044b\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u044c I2C \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 CCR I2C1-&gt;CCR &amp;= ~I2C_CCR_CCR; I2C1-&gt;CCR |=  CCR_VALUE; I2C1-&gt;TRISE |=  TRISE_VALUE;  I2C1-&gt;CR1 |= I2C_CR1_ENPEC; \t\t\t\t\t\t\t\t\t\t\/\/ \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u043e\u0442\u0441\u044b\u043b\u043a\u0443 PEC I2C1-&gt;CR1 |= I2C_CR1_PE;\t\t\t\t\t\t\t\t\t\t\t\t\/\/ \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u044c I2C I2C1-&gt;CR1 |= I2C_CR1_ACK; \t\t\t\t\t\t\t\t\t\t\t\/\/ \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c ACK  }<\/code><\/pre>\n<p>\u0418\u0437 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u043e \u0447\u0442\u043e \u0432 \u043d\u0435\u0439 \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f. \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 F_APB1, CCR_VALUE \u0438 TRISE_VALUE \u043e\u043d\u0438 \u0431\u0435\u0440\u0443\u0442\u0441\u044f \u0438\u0437 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430, \u0442\u0430\u043c \u0438 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u043e\u0442\u044b \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0422\u0430\u043a \u0436\u0435 \u0432\u0430\u0436\u043d\u043e \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c I2C \u043f\u0435\u0440\u0435\u0434 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u043e\u0439 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 CCR ( \u044d\u0442\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043d\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 ) \u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c ACK \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043c\u043e\u0434\u0443\u043b\u044f I2C , \u0438\u043d\u0430\u0447\u0435 ACK \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0435\u0442.<\/p>\n<pre><code class=\"cpp\">double getTemp_Mlx90614_Double( uint16_t address, \t\t\t\t\t\t\t\tuint8_t ram_address){  \t uint16_t\ttemp ; \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\/\/ \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 \t uint8_t\ttemp_lsb ;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\/\/ \u043c\u043b\u0430\u0434\u0448\u0438\u0435 \u0431\u0438\u0442\u044b \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \t double temp_result ; \t\t\t\t\t\t\t\t\t\t\t\t\t\/\/ \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0430\u044f \u043f\u0435\u0440\u0435\u0441\u0447\u0438\u0442\u0430\u043d\u043d\u0430\u044f \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 \t double temp_double ;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\/\/ \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430, \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u0430\u044f \u043a \u0444\u043e\u0440\u043c\u0430\u0442\u0443 double  \t address = address&lt;&lt;1; \t\t\t\t\t\t\t\t\t\t\t\t\t\/\/ \u0441\u0434\u0432\u0438\u0433\u0430\u0435\u043c \u043d\u0430 \u043e\u0434\u0438\u043d \u0432\u043b\u0435\u0432\u043e (\u0442\u0430\u043a \u0434\u0430\u0442\u0447\u0438\u043a \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \t \t \t \t \t \t \t \t \t \t \t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\/\/ \u0430\u0434\u0440\u0435\u0441 \u043f\u043b\u044e\u0441 1-\u0439 \u0431\u0438\u0442 \u0437\u0430\u043f\u0438\u0441\u044c\/\u0447\u0442\u0435\u043d\u0438\u0435) \t I2C1-&gt;CR1 |= I2C_CR1_START; \t while (!(I2C1-&gt;SR1 &amp; I2C_SR1_SB)){}  \t (void) I2C1-&gt;SR1;  \t I2C1-&gt;DR = address | MLX90614_WRITE; \t\t\t\t\t\/\/ \u0440\u0435\u0436\u0438\u043c \u0437\u0430\u043f\u0438\u0441\u0438 , \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0430\u0434\u0440\u0435\u0441\u0430 MLX90614 \t while (!(I2C1-&gt;SR1 &amp; I2C_SR1_ADDR)){}  \t (void) I2C1-&gt;SR1; \t (void) I2C1-&gt;SR2;  \t I2C1-&gt;DR= ram_address;\t\t\t\t\t\t\t\t\t\t\t\t\t\/\/ \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0430\u0434\u0440\u0435\u0441\u0430 RAM  \u0434\u0430\u0442\u0447\u0438\u043a\u0430 MLX90614 \t while (!(I2C1-&gt;SR1 &amp; I2C_SR1_TXE)){}  \t I2C1-&gt;CR1 |= I2C_CR1_START;\t\t\t\t\t\t\t\t\t\t\/\/ \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0439 \u0441\u0442\u0430\u0440\u0442 \t while (!(I2C1-&gt;SR1 &amp; I2C_SR1_SB)){}  \t (void) I2C1-&gt;SR1;  \t I2C1-&gt;DR = address | MLX90614_READ;\t\t\t\t\t\t\/\/ \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \u0434\u0430\u0442\u0447\u0438\u043a\u0443 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \t while (!(I2C1-&gt;SR1 &amp; I2C_SR1_ADDR)){}  \t (void) I2C1-&gt;SR1; \t (void) I2C1-&gt;SR2;  \t while(!(I2C1-&gt;SR1 &amp; I2C_SR1_RXNE)){}  \t temp_lsb = I2C1-&gt;DR;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\/\/ \u0447\u0438\u0442\u0430\u0435\u043c \u043c\u043b\u0430\u0434\u0448\u0438\u0439 \u0431\u0430\u0439\u0442  \t while(!(I2C1-&gt;SR1 &amp; I2C_SR1_RXNE)){}  \t temp = I2C1-&gt;DR;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\/\/ \u0447\u0438\u0442\u0430\u0435\u043c \u0441\u0442\u0430\u0440\u0448\u0438\u0439 \u0431\u0430\u0439\u0442  \t I2C1-&gt;CR1 |= I2C_CR1_STOP;  \t temp = (temp &amp; 0x007F) &lt;&lt; 8;\t\t\t\t\t\t\t\t\t\t\/\/ \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u0431\u0438\u0442 \u043e\u0448\u0438\u0431\u043a\u0438, \u0441\u0434\u0432\u0438\u0433\u0430\u0435\u043c \u0432 \u0441\u0442\u0430\u0440\u0448\u0438\u0439 \u0431\u0430\u0439\u0442 \t temp |= temp_lsb; \t temp_double = (double) temp; \t\t\t\t\t\t\t\t\t\/\/ \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043c \u043a \u0444\u043e\u0440\u043c\u0430\u0442\u0443 double \t temp_result =  ((temp_double * 0.02)- 0.01 );\t\/\/ \u0443\u043c\u043d\u043e\u0436\u0430\u0435\u043c \u043d\u0430 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0439 \t temp_result = temp_result - 273.15; \t\t\t\t\t\t\/\/ \u0438 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043c \u043a \u0433\u0440\u0430\u0434. \u0426\u0435\u043b\u044c\u0441\u0438\u044f    return temp_result;    }<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0430\u0434\u0440\u0435\u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u0441\u0434\u0432\u0438\u0433\u0430\u0435\u0442\u0441\u044f \u043d\u0430 1 \u0431\u0438\u0442 \u0432\u043b\u0435\u0432\u043e, \u0430 \u043f\u043e\u0442\u043e\u043c \u0432 \u043f\u0435\u0440\u0432\u044b\u0439 \u0431\u0438\u0442 \u0430\u0434\u0440\u0435\u0441\u0430 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f 1 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f, 0 &#8212; \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438. \u0412<\/p>\n<\/hr>\n<\/div>\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-313385","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/313385","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=313385"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/313385\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=313385"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=313385"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=313385"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}