{"id":193456,"date":"2013-09-12T13:31:02","date_gmt":"2013-09-12T09:31:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=193456"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=193456","title":{"rendered":"<span class=\"post_title\">\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u044c\u044e\u0442\u0435\u043a\u0441\u0430 \u0432\u043d\u0435 \u041e\u0421 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 AVR \u0438 \u0448\u0438\u043d\u044b TWI<\/span>"},"content":{"rendered":"<div class=\"content html_format\"> \t\t\t\u0420\u0435\u0448\u0438\u043b \u043e\u0434\u043d\u0430\u0436\u0434\u044b \u0434\u043b\u044f \u0441\u0435\u0431\u044f \u044f \u0441\u043e\u043e\u0440\u0443\u0434\u0438\u0442\u044c \u043f\u043e\u0433\u043e\u0434\u043d\u0443\u044e \u0441\u0442\u0430\u043d\u0446\u0438\u044e. \u0414\u0430\u0442\u0447\u0438\u043a\u0438 \u0442\u0430\u043c \u0440\u0430\u0437\u043d\u044b\u0435, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u043d\u0430 \u0448\u0438\u043d\u0435 I2C. \u0418 \u043a\u0430\u043a \u0433\u043e\u0434\u0438\u0442\u0441\u044f, \u043e\u0431\u044b\u0447\u043d\u043e \u0432\u043d\u0430\u0447\u0430\u043b\u0435, \u0441\u0434\u0435\u043b\u0430\u043b \u0432\u0441\u0435 \u043d\u0430 \u0444\u043b\u0430\u0433\u0430\u0445 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f. \u041d\u043e \u043f\u0443\u0442\u044c \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0433\u043e \u0434\u0436\u0435\u0434\u0430\u044f \u0438\u043d\u043e\u0439, \u0438 \u0431\u044b\u043b\u043e \u0440\u0435\u0448\u0435\u043d\u043e \u0432\u0441\u0435 \u043f\u043e\u0432\u0435\u0441\u0438\u0442\u044c \u043d\u0430 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f. \u0412\u043e\u0442 \u0442\u0443\u0442 \u0438 \u043d\u0430\u0447\u0430\u043b\u0441\u044f \u0433\u0435\u043c\u043e\u0440\u0440\u043e\u0439. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u044f \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u044d\u0442\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u043e\u0434\u0440\u044f\u0434 \u0438\u0434\u0443\u0449\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u0430\u0442\u0447\u0438\u043a \u0434\u0430\u0432\u043b\u0435\u043d\u0438\u044f <a href=\"https:\/\/www.sparkfun.com\/datasheets\/Components\/General\/BST-BMP085-DS000-05.pdf\">BMP085<\/a> \u0434\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043d\u0438\u043c, \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0432\u044b\u0442\u044f\u043d\u0443\u0442\u044c \u0438\u0437 \u0435\u0433\u043e EEPROM 11 \u043a\u0430\u043b\u0438\u0431\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u0445 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\"  src=\"http:\/\/habrastorage.org\/storage3\/33b\/6f6\/b6f\/33b6f6b6f9354b2e85738a72aa27044d.png\"\/><\/div>\n<p>  \u041e \u0442\u043e\u043c \u043a\u0430\u043a \u044f \u043f\u0440\u0438\u0448\u0435\u043b \u043a \u0440\u0435\u0448\u0435\u043d\u0438\u044e \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0445\u043e\u0434\u0430 \u043c\u044b\u0441\u043b\u0435\u0439 \u0438\u0437\u043b\u043e\u0436\u0435\u043d\u044b \u043d\u0438\u0436\u0435.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h4>\u0424\u043b\u0430\u0433\u0438 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f<\/h4>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <b>get_AC1, get_AC2,\u2026, get_MD<\/b>. \u041a\u0430\u0436\u0434\u0430\u044f \u0438\u0437 \u043d\u0438\u0445 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0443 \u0438\u0437 EEPROM \u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u043f\u043e \u0448\u0438\u043d\u0435 I2C. \u0424\u043e\u0440\u043c\u0430\u0442 \u043f\u043e\u0441\u044b\u043b\u043a\u0438 \u0438\u0437 \u0434\u0430\u0442\u0430\u0448\u0438\u0442\u0430:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\"  src=\"http:\/\/habrastorage.org\/storage3\/45d\/da2\/5ce\/45dda25ce93a6f95e381a9f60678de80.png\"\/><\/div>\n<p>  \u0418 \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430 \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <b>get_AC1<\/b>:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">get_AC1<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">int get_AC1(void) { \tunion { \t\tunsigned int Word; \t\tunsigned char Byte[2]; \t} AC1;\t\t\t\t\t\t\/\/ \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c AC1 \t\/\/ ---------------------------------------- \tTWCR =  (1&lt;&lt;TWEN)|\t\t\t\t\t\/\/ \u041c\u043e\u0434\u0443\u043b\u044c TWI \u0432\u043a\u043b\u044e\u0447\u0435\u043d \t\t\t(0&lt;&lt;TWIE)|(1&lt;&lt;TWINT)|\t\t\t\/\/ \u041e\u0447\u0438\u0449\u0430\u0435\u043c \u0444\u043b\u0430\u0433 \t\t\t(0&lt;&lt;TWEA)|(1&lt;&lt;TWSTA)|(0&lt;&lt;TWSTO)|\t\t\/\/ \u0414\u0430\u0435\u043c START \u0441\u0438\u0433\u043d\u0430\u043b \t\t\t(0&lt;&lt;TWWC); \twhile (!(TWCR & (1&lt;&lt;TWINT)))\t\t\t\/\/ \u0416\u0434\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0444\u043b\u0430\u0433\u0430 TWINT \t\t; \t\/\/ ---------------------------------------- \tTWDR = 0xEE;\t\t\t\t\t\/\/ \u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c SLA+W \tTWCR =  (1&lt;&lt;TWEN)|\t\t\t\t\t\/\/ \u041c\u043e\u0434\u0443\u043b\u044c TWI \u0432\u043a\u043b\u044e\u0447\u0435\u043d \t\t\t(0&lt;&lt;TWIE)|(1&lt;&lt;TWINT)|\t\t\t\/\/ \u041e\u0447\u0438\u0449\u0430\u0435\u043c \u0444\u043b\u0430\u0433 \t\t\t(0&lt;&lt;TWEA)|(0&lt;&lt;TWSTA)|(0&lt;&lt;TWSTO)|\t\t\/\/ \u041e\u0442\u0441\u044b\u043b\u0430\u0435\u043c SLA+W \t\t\t(0&lt;&lt;TWWC); \twhile (!(TWCR & (1&lt;&lt;TWINT)))\t\t\t\/\/ \u0416\u0434\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0444\u043b\u0430\u0433\u0430 TWINT \t\t; \t\/\/ ---------------------------------------- \tTWDR = 0xAA;\t\t\t\t\t\/\/ \u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c 0xAA \tTWCR =  (1&lt;&lt;TWEN)|\t\t\t\t\t\/\/ \u041c\u043e\u0434\u0443\u043b\u044c TWI \u0432\u043a\u043b\u044e\u0447\u0435\u043d \t\t\t(0&lt;&lt;TWIE)|(1&lt;&lt;TWINT)|\t\t\t\/\/ \u041e\u0447\u0438\u0449\u0430\u0435\u043c \u0444\u043b\u0430\u0433 \t\t\t(0&lt;&lt;TWEA)|(0&lt;&lt;TWSTA)|(0&lt;&lt;TWSTO)|\t\t\/\/ \u041e\u0442\u0441\u044b\u043b\u0430\u0435\u043c 0xAA \t\t\t(0&lt;&lt;TWWC); \twhile (!(TWCR & (1&lt;&lt;TWINT)))\t\t\t\/\/ \u0416\u0434\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0444\u043b\u0430\u0433\u0430 TWINT \t\t; \t\/\/ ---------------------------------------- \tTWCR =  (1&lt;&lt;TWEN)|\t\t\t\t\t\/\/ \u041c\u043e\u0434\u0443\u043b\u044c TWI \u0432\u043a\u043b\u044e\u0447\u0435\u043d \t\t\t(0&lt;&lt;TWIE)|(1&lt;&lt;TWINT)|\t\t\t\/\/ \u041e\u0447\u0438\u0449\u0430\u0435\u043c \u0444\u043b\u0430\u0433 \t\t\t(0&lt;&lt;TWEA)|(1&lt;&lt;TWSTA)|(0&lt;&lt;TWSTO)|\t\t\/\/ \u0414\u0430\u0435\u043c REPEATED START \u0441\u0438\u0433\u043d\u0430\u043b \t\t\t(0&lt;&lt;TWWC); \twhile (!(TWCR & (1&lt;&lt;TWINT)))\t\t\t\/\/ \u0416\u0434\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0444\u043b\u0430\u0433\u0430 TWINT \t\t; \t\/\/ ---------------------------------------- \tTWDR = 0xEF;\t\t\t\t\t\/\/ \u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c SLA+R \tTWCR =\t(1&lt;&lt;TWEN)|\t\t\t\t\/\/ \u041c\u043e\u0434\u0443\u043b\u044c TWI \u0432\u043a\u043b\u044e\u0447\u0435\u043d \t\t\t(0&lt;&lt;TWIE)|(1&lt;&lt;TWINT)|\t\t\t\/\/ \u041e\u0447\u0438\u0449\u0430\u0435\u043c \u0444\u043b\u0430\u0433 \t\t\t(0&lt;&lt;TWEA)|(0&lt;&lt;TWSTA)|(0&lt;&lt;TWSTO)|\t\t\/\/ \u041e\u0442\u0441\u044b\u043b\u0430\u0435\u043c SLA+R \t\t\t(0&lt;&lt;TWWC); \twhile (!(TWCR & (1&lt;&lt;TWINT)))\t\t\t\/\/ \u0416\u0434\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0444\u043b\u0430\u0433\u0430 TWINT \t\t; \t\/\/ ---------------------------------------- \tTWCR =  (1&lt;&lt;TWEN)|\t\t\t\t\t\/\/ \u041c\u043e\u0434\u0443\u043b\u044c TWI \u0432\u043a\u043b\u044e\u0447\u0435\u043d \t\t\t(0&lt;&lt;TWIE)|(1&lt;&lt;TWINT)|\t\t\t\/\/ \u041e\u0447\u0438\u0449\u0430\u0435\u043c \u0444\u043b\u0430\u0433 \t\t\t(1&lt;&lt;TWEA)|(0&lt;&lt;TWSTA)|(0&lt;&lt;TWSTO)|\t\t\/\/ \u041f\u043e\u0441\u044b\u043b\u0430\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 \u0431\u0430\u0439\u0442\u0430 \u0438 ACK \t\t\t(0&lt;&lt;TWWC); \twhile (!(TWCR & (1&lt;&lt;TWINT)))\t\t\t\/\/ \u0416\u0434\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0444\u043b\u0430\u0433\u0430 TWINT \t\t; \t\/\/ ---------------------------------------- \tAC1.Byte[1] = TWDR;\t\t\t\t\t\/\/ \u0427\u0438\u0442\u0430\u0435\u043c MSB \tTWCR =  (1&lt;&lt;TWEN)|\t\t\t\t\t\/\/ \u041c\u043e\u0434\u0443\u043b\u044c TWI \u0432\u043a\u043b\u044e\u0447\u0435\u043d \t\t\t(0&lt;&lt;TWIE)|(1&lt;&lt;TWINT)|\t\t\t\/\/ \u041e\u0447\u0438\u0449\u0430\u0435\u043c \u0444\u043b\u0430\u0433 \t\t\t(0&lt;&lt;TWEA)|(0&lt;&lt;TWSTA)|(0&lt;&lt;TWSTO)|\t\t\/\/ \u041f\u043e\u0441\u044b\u043b\u0430\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 \u0431\u0430\u0439\u0442\u0430 \u0438 NACK \t\t\t(0&lt;&lt;TWWC); \twhile (!(TWCR & (1&lt;&lt;TWINT)))\t\t\t\/\/ \u0416\u0434\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0444\u043b\u0430\u0433\u0430 TWINT \t\t; \t\/\/ ---------------------------------------- \tAC1.Byte[0] = TWDR;\t\t\t\t\t\/\/ \u0427\u0438\u0442\u0430\u0435\u043c LSB \tTWCR =  (1&lt;&lt;TWEN)|\t\t\t\t\t\/\/ \u041c\u043e\u0434\u0443\u043b\u044c TWI \u0432\u043a\u043b\u044e\u0447\u0435\u043d \t\t\t(0&lt;&lt;TWIE)|(1&lt;&lt;TWINT)|\t\t\t\/\/ \u041e\u0447\u0438\u0449\u0430\u0435\u043c \u0444\u043b\u0430\u0433 \t\t\t(0&lt;&lt;TWEA)|(0&lt;&lt;TWSTA)|(1&lt;&lt;TWSTO)|\t\t\/\/ \u041f\u043e\u0441\u044b\u043b\u0430\u0435\u043c STOP \u0441\u0438\u0433\u043d\u0430\u043b \t\t\t(0&lt;&lt;TWWC); \t\/\/ ---------------------------------------- \treturn AC1.Word; } <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u0410 \u0432\u043e\u0442 \u0435\u0435 \u043e\u0441\u0446\u0438\u043b\u043b\u043e\u0433\u0440\u0430\u043c\u043c\u0430:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\"  src=\"http:\/\/habrastorage.org\/storage3\/d11\/312\/aaa\/d11312aaa645350e640b4a307359b1ec.png\"\/><\/div>\n<p>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u043e\u044e\u0437\u0430 union \u0434\u043b\u044f AC1 \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u0440\u0430\u0437\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u043e\u0440\u044f\u0434\u043a\u0430 \u0431\u0430\u0439\u0442. \u0414\u043b\u044f TWI \u044d\u0442\u043e big-endian, \u0434\u043b\u044f AVR \u2014 little-endian. \u0424\u0443\u043d\u043a\u0446\u0438\u044f <b>get_AC2<\/b> \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043b\u0438\u0448\u044c \u043f\u043e\u0441\u044b\u043b\u043a\u043e\u0439 \u0431\u0430\u0439\u0442\u0430 <b>0xAC<\/b> (\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432 \u0434\u0430\u0442\u0430\u0448\u0438\u0442) \u0432\u043c\u0435\u0441\u0442\u043e <b>0xAA<\/b> \u043f\u043e\u0441\u043b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b <b>SLA+W<\/b>. \u0412\u043e \u0432\u0441\u0435\u043c \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u044b. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043e\u0434\u043d\u0443 <b>get_Data<\/b>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0442\u0435 \u0441\u0430\u043c\u044b\u0435 Register address \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0434\u0430\u0442\u0430\u0448\u0438\u0442\u043e\u043c:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">get_Data<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">int get_Data(unsigned char Register_adress) { \tunion { \t\tunsigned int Word; \t\tunsigned char Byte[2]; \t} Data;\t\t\t\t\t\t\/\/ \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c Data \t\/\/ ---------------------------------------- \tTWCR =  (1&lt;&lt;TWEN)|\t\t\t\t\t\/\/ \u041c\u043e\u0434\u0443\u043b\u044c TWI \u0432\u043a\u043b\u044e\u0447\u0435\u043d \t\t\t(0&lt;&lt;TWIE)|(1&lt;&lt;TWINT)|\t\t\t\/\/ \u041e\u0447\u0438\u0449\u0430\u0435\u043c \u0444\u043b\u0430\u0433 \t\t\t(0&lt;&lt;TWEA)|(1&lt;&lt;TWSTA)|(0&lt;&lt;TWSTO)|\t\t\/\/ \u0414\u0430\u0435\u043c START \u0441\u0438\u0433\u043d\u0430\u043b \t\t\t(0&lt;&lt;TWWC); \twhile (!(TWCR & (1&lt;&lt;TWINT)))\t\t\t\/\/ \u0416\u0434\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0444\u043b\u0430\u0433\u0430 TWINT \t\t; \t\/\/ ---------------------------------------- \tTWDR = 0xEE;\t\t\t\t\t\/\/ \u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c SLA+W \tTWCR =  (1&lt;&lt;TWEN)|\t\t\t\t\t\/\/ \u041c\u043e\u0434\u0443\u043b\u044c TWI \u0432\u043a\u043b\u044e\u0447\u0435\u043d \t\t\t(0&lt;&lt;TWIE)|(1&lt;&lt;TWINT)|\t\t\t\/\/ \u041e\u0447\u0438\u0449\u0430\u0435\u043c \u0444\u043b\u0430\u0433 \t\t\t(0&lt;&lt;TWEA)|(0&lt;&lt;TWSTA)|(0&lt;&lt;TWSTO)|\t\t\/\/ \u041e\u0442\u0441\u044b\u043b\u0430\u0435\u043c SLA+W \t\t\t(0&lt;&lt;TWWC); \twhile (!(TWCR & (1&lt;&lt;TWINT)))\t\t\t\/\/ \u0416\u0434\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0444\u043b\u0430\u0433\u0430 TWINT \t\t; \t\/\/ ---------------------------------------- \tTWDR = Register_adress;\t\t\t\t\/\/ \u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c Register_adress \tTWCR =  (1&lt;&lt;TWEN)|\t\t\t\t\t\/\/ \u041c\u043e\u0434\u0443\u043b\u044c TWI \u0432\u043a\u043b\u044e\u0447\u0435\u043d \t\t\t(0&lt;&lt;TWIE)|(1&lt;&lt;TWINT)|\t\t\t\/\/ \u041e\u0447\u0438\u0449\u0430\u0435\u043c \u0444\u043b\u0430\u0433 \t\t\t(0&lt;&lt;TWEA)|(0&lt;&lt;TWSTA)|(0&lt;&lt;TWSTO)|\t\t\/\/ \u041e\u0442\u0441\u044b\u043b\u0430\u0435\u043c Register_adress \t\t\t(0&lt;&lt;TWWC); \twhile (!(TWCR & (1&lt;&lt;TWINT)))\t\t\t\/\/ \u0416\u0434\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0444\u043b\u0430\u0433\u0430 TWINT \t\t; \t\/\/ ---------------------------------------- \tTWCR =  (1&lt;&lt;TWEN)|\t\t\t\t\t\/\/ \u041c\u043e\u0434\u0443\u043b\u044c TWI \u0432\u043a\u043b\u044e\u0447\u0435\u043d \t\t\t(0&lt;&lt;TWIE)|(1&lt;&lt;TWINT)|\t\t\t\/\/ \u041e\u0447\u0438\u0449\u0430\u0435\u043c \u0444\u043b\u0430\u0433 \t\t\t(0&lt;&lt;TWEA)|(1&lt;&lt;TWSTA)|(0&lt;&lt;TWSTO)|\t\t\/\/ \u0414\u0430\u0435\u043c REPEATED START \u0441\u0438\u0433\u043d\u0430\u043b \t\t\t(0&lt;&lt;TWWC); \twhile (!(TWCR & (1&lt;&lt;TWINT)))\t\t\t\/\/ \u0416\u0434\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0444\u043b\u0430\u0433\u0430 TWINT \t\t; \t\/\/ ---------------------------------------- \tTWDR = 0xEF;\t\t\t\t\t\/\/ \u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c SLA+R \tTWCR =  (1&lt;&lt;TWEN)|\t\t\t\t\t\/\/ \u041c\u043e\u0434\u0443\u043b\u044c TWI \u0432\u043a\u043b\u044e\u0447\u0435\u043d \t\t\t(0&lt;&lt;TWIE)|(1&lt;&lt;TWINT)|\t\t\t\/\/ \u041e\u0447\u0438\u0449\u0430\u0435\u043c \u0444\u043b\u0430\u0433 \t\t\t(0&lt;&lt;TWEA)|(0&lt;&lt;TWSTA)|(0&lt;&lt;TWSTO)|\t\t\/\/ \u041e\u0442\u0441\u044b\u043b\u0430\u0435\u043c SLA+R \t\t\t(0&lt;&lt;TWWC); \twhile (!(TWCR & (1&lt;&lt;TWINT)))\t\t\t\/\/ \u0416\u0434\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0444\u043b\u0430\u0433\u0430 TWINT \t\t; \t\/\/ ---------------------------------------- \tTWCR =  (1&lt;&lt;TWEN)|\t\t\t\t\t\/\/ \u041c\u043e\u0434\u0443\u043b\u044c TWI \u0432\u043a\u043b\u044e\u0447\u0435\u043d \t\t\t(0&lt;&lt;TWIE)|(1&lt;&lt;TWINT)|\t\t\t\/\/ \u041e\u0447\u0438\u0449\u0430\u0435\u043c \u0444\u043b\u0430\u0433 \t\t\t(1&lt;&lt;TWEA)|(0&lt;&lt;TWSTA)|(0&lt;&lt;TWSTO)|\t\t\/\/ \u041f\u043e\u0441\u044b\u043b\u0430\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 \u0431\u0430\u0439\u0442\u0430 \u0438 ACK \t\t\t(0&lt;&lt;TWWC); \twhile (!(TWCR & (1&lt;&lt;TWINT)))\t\t\t\/\/ \u0416\u0434\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0444\u043b\u0430\u0433\u0430 TWINT \t\t; \t\/\/ ---------------------------------------- \tData.Byte[1] = TWDR;\t\t\t\t\/\/ \u0427\u0438\u0442\u0430\u0435\u043c MSB \tTWCR =  (1&lt;&lt;TWEN)|\t\t\t\t\t\/\/ \u041c\u043e\u0434\u0443\u043b\u044c TWI \u0432\u043a\u043b\u044e\u0447\u0435\u043d \t\t\t(0&lt;&lt;TWIE)|(1&lt;&lt;TWINT)|\t\t\t\/\/ \u041e\u0447\u0438\u0449\u0430\u0435\u043c \u0444\u043b\u0430\u0433 \t\t\t(0&lt;&lt;TWEA)|(0&lt;&lt;TWSTA)|(0&lt;&lt;TWSTO)|\t\t\/\/ \u041f\u043e\u0441\u044b\u043b\u0430\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 \u0431\u0430\u0439\u0442\u0430 \u0438 NACK \t\t\t(0&lt;&lt;TWWC); \twhile (!(TWCR & (1&lt;&lt;TWINT)))\t\t\t\/\/ \u0416\u0434\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0444\u043b\u0430\u0433\u0430 TWINT \t\t; \t\/\/ ---------------------------------------- \tData.Byte[0] = TWDR;\t\t\t\t\/\/ \u0427\u0438\u0442\u0430\u0435\u043c LSB \tTWCR =  (1&lt;&lt;TWEN)|\t\t\t\t\t\/\/ \u041c\u043e\u0434\u0443\u043b\u044c TWI \u0432\u043a\u043b\u044e\u0447\u0435\u043d \t\t\t(0&lt;&lt;TWIE)|(1&lt;&lt;TWINT)|\t\t\t\/\/ \u041e\u0447\u0438\u0449\u0430\u0435\u043c \u0444\u043b\u0430\u0433 \t\t\t(0&lt;&lt;TWEA)|(0&lt;&lt;TWSTA)|(1&lt;&lt;TWSTO)|\t\t\/\/ \u041f\u043e\u0441\u044b\u043b\u0430\u0435\u043c STOP \u0441\u0438\u0433\u043d\u0430\u043b \t\t\t(0&lt;&lt;TWWC); \t\/\/ ---------------------------------------- \treturn Data.Word; } <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u0430 \u0434\u0430\u043b\u044c\u0448\u0435 \u043f\u0440\u043e\u0441\u0442\u043e:<\/p>\n<pre><code class=\"cpp\">struct { \tshort AC1; \tshort AC2; \tshort AC3; \tunsigned short AC4; \tunsigned short AC5; \tunsigned short AC6; \tshort B1; \tshort B2; \tshort MB; \tshort MC; \tshort MD; } BMP085_EEPROM; ... static void get_EEPROM(void) { \tBMP085_EEPROM.AC1 = get_Data(0xAA); \tBMP085_EEPROM.AC2 = get_Data(0xAC); \tBMP085_EEPROM.AC3 = get_Data(0xAE); \tBMP085_EEPROM.AC4 = get_Data(0xB0); \tBMP085_EEPROM.AC5 = get_Data(0xB2); \tBMP085_EEPROM.AC6 = get_Data(0xB4); \tBMP085_EEPROM.B1 = get_Data(0xB6); \tBMP085_EEPROM.B2 = get_Data(0xB8); \tBMP085_EEPROM.MB = get_Data(0xBA); \tBMP085_EEPROM.MC = get_Data(0xBC); \tBMP085_EEPROM.MD = get_Data(0xBE); } <\/code><\/pre>\n<p>  \u0412\u043e\u0442 \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0432 \u0438\u0442\u043e\u0433\u0435:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\"  src=\"http:\/\/habrastorage.org\/storage3\/076\/f53\/ebe\/076f53ebe0c0957a88216ef363296525.png\"\/><\/div>\n<p>  <\/p>\n<h4>\u0420\u0430\u0431\u043e\u0442\u0430 \u043d\u0430 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f\u0445<\/h4>\n<p>  <\/p>\n<h5>\u041f\u0440\u0435\u0434\u0438\u0441\u043b\u043e\u0432\u0438\u0435<\/h5>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\"  src=\"http:\/\/habrastorage.org\/storage3\/dfe\/f0c\/03e\/dfef0c03ed7b3a099b852d7d91e9f891.png\"\/><\/div>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u0438\u0437 \u0440\u0438\u0441\u0443\u043d\u043a\u0430 \u0432\u044b\u0448\u0435, \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043e\u0434\u043d\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 <b>488 \u043c\u043a\u0441<\/b>, \u0434\u043b\u044f \u0447\u0430\u0441\u0442\u043e\u0442\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0448\u0438\u043d\u044b \u0432 <b>100 \u043a\u0413\u0446<\/b>, \u0447\u0442\u043e \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 <b>3094 \u0442\u0430\u043a\u0442\u0430<\/b> \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430 \u043d\u0430 \u0447\u0430\u0441\u0442\u043e\u0442\u0435 <b>8 \u041c\u0413\u0446<\/b>. \u041d\u0443 \u044d\u0442\u043e \u043d\u0438 \u0432 \u043a\u0430\u043a\u0438\u0435 \u0432\u043e\u0440\u043e\u0442\u0430 \u0440\u0435\u0431\u044f\u0442\u0430. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0432\u044b\u0441\u0438\u0442\u044c \u0447\u0430\u0441\u0442\u043e\u0442\u0443, \u0435\u0441\u043b\u0438 \u0446\u0435\u043b\u0435\u0432\u043e\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043b\u044f <b>400 \u043a\u0413\u0446<\/b> \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 <b>128 \u043c\u043a\u0441<\/b> \u0438\u043b\u0438 <b>1024 \u0442\u0430\u043a\u0442\u0430<\/b><\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\"  src=\"http:\/\/habrastorage.org\/storage3\/dea\/c6a\/2d6\/deac6a2d688d4fe6203d5dd857c136c8.png\"\/><\/div>\n<p>  \u041e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 \u043f\u043e\u0434\u043d\u044f\u0442\u0438\u044f \u0444\u043b\u0430\u0433\u0430 \u2014 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u0431\u0435\u0441\u043f\u043e\u043b\u0435\u0437\u043d\u0430\u044f. \u0417\u0430 \u0442\u044b\u0441\u044f\u0447\u0438 \u0442\u0430\u043a\u0442\u043e\u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 \u043c\u043e\u0436\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0447\u0438\u0441\u0435\u043b \u0441 \u043f\u043b\u0430\u0432\u0430\u044e\u0449\u0435\u0439 \u0437\u0430\u043f\u044f\u0442\u043e\u0439. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u0430\u0434\u0435\u043a\u0432\u0430\u0442\u043d\u044b\u043c \u0432\u044b\u0445\u043e\u0434\u043e\u043c \u0438\u0437 \u044d\u0442\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f.<\/p>\n<h5>\u0420\u0430\u0431\u043e\u0442\u0430 \u043d\u0430 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f\u0445<\/h5>\n<p>  \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443:  <\/p>\n<pre><code class=\"cpp\">struct { \tunsigned char SLA;\t\t\/\/ Slave address \tunsigned char *pW;\t\t\/\/ \u041e\u0442\u043a\u0443\u0434\u0430? \tunsigned char nW;\t\t\/\/ \u0421\u043a\u043e\u043b\u044c\u043a\u043e? \tunsigned char *pR;\t\t\/\/ \u041a\u0443\u0434\u0430? \tunsigned char nR;\t\t\/\/ \u0421\u043a\u043e\u043b\u044c\u043a\u043e? } TWI; <\/code><\/pre>\n<p>  \u0430 \u0442\u0435\u043f\u0435\u0440\u044c \u0438 \u043d\u0430\u0448\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e <b>get_AC1<\/b>:  <\/p>\n<pre><code class=\"cpp\">unsigned char Register_address; ... void get_AC1(void) { \tRegister_address = 0xAA;\t\t\t\t\/\/ \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c Register address \tTWI.SLA = 0x77;\t\t\t\t\t\/\/ Slave address \u043d\u0430\u0448\u0435\u0433\u043e BMP085 \tTWI.pW = &Register_address;\t\t\t\t\/\/ \u0423\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043e\u0442\u043a\u0443\u0434\u0430 \u0431\u0440\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \tTWI.nW = 1;\t\t\t\t\t\t\/\/ \u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u0430\u0439\u0442 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c? \tTWI.pR = &BMP085_EEPROM.AC1;\t\t\t\/\/ \u0423\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043a\u0443\u0434\u0430 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c? \tTWI.nR = 2;\t\t\t\t\t\t\/\/ \u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u0430\u0439\u0442 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c? \tTWCR =  (1&lt;&lt;TWEN)|\t\t\t\t\t\/\/ \u041c\u043e\u0434\u0443\u043b\u044c TWI \u0432\u043a\u043b\u044e\u0447\u0435\u043d \t\t\t(1&lt;&lt;TWIE)|(1&lt;&lt;TWINT)|\t\t\t\/\/ \u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f! \u041e\u0447\u0438\u0449\u0430\u0435\u043c \u0444\u043b\u0430\u0433 \t\t\t(0&lt;&lt;TWEA)|(1&lt;&lt;TWSTA)|(0&lt;&lt;TWSTO)|\t\t\/\/ \u0414\u0430\u0435\u043c START \u0441\u0438\u0433\u043d\u0430\u043b \t\t\t(0&lt;&lt;TWWC); } <\/code><\/pre>\n<p>  \u041f\u0430\u0440\u0430 \u0441\u043b\u043e\u0432 \u043e\u0431 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0435 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f. \u0415\u0441\u043b\u0438 <b>nW = n<\/b>, <b>nR = 0<\/b>, \u0444\u043e\u0440\u043c\u0430\u0442 \u0444\u0440\u0435\u0439\u043c\u0430:  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\"  src=\"http:\/\/habrastorage.org\/storage3\/a61\/ac9\/6de\/a61ac96dec25a3254af38a34d38a723e.png\"\/><\/div>\n<p>  \u0435\u0441\u043b\u0438 <b>nW = 0<\/b>, <b>nR = m<\/b>:  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\"  src=\"http:\/\/habrastorage.org\/storage3\/03b\/90f\/b78\/03b90fb78407808e746645fe3c58dd3f.png\"\/><\/div>\n<p>  \u0438, \u0435\u0441\u043b\u0438 <b>nW = n<\/b>, <b>nR = m<\/b>:  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\"  src=\"http:\/\/habrastorage.org\/storage3\/142\/7a0\/295\/1427a029546a9e357e28aeea339b4190.png\"\/><\/div>\n<p>  \u041a \u0441\u043b\u043e\u0432\u0443 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a\u0430\u043a\u0438\u043c \u0443\u0433\u043e\u0434\u043d\u043e. \u041b\u043e\u0433\u0438\u043a\u0443 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0433\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0430 \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e-\u0440\u0430\u0437\u043d\u043e\u043c\u0443. \u041f\u0440\u0438\u043c\u0435\u0440 \u043c\u043e\u0435\u0433\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u043d \u043d\u0438\u0436\u0435:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">ISR(TWI_vect) { \/* ----------------------------------------------------------------------------------- \tJump table which is stored in flash ------------------------------------------------------------------------------------*\/ \tstatic const void * const twi_list[] PROGMEM = {&&TWI_00, &&TWI_08, \t\t\t\t\t\t\t\t\t\t\t\t\t&&TWI_10, &&TWI_18, \t\t\t\t\t\t\t\t\t\t\t\t\t&&TWI_20, &&TWI_28, \t\t\t\t\t\t\t\t\t\t\t\t\t&&TWI_30, &&TWI_38, \t\t\t\t\t\t\t\t\t\t\t\t\t&&TWI_40, &&TWI_48, \t\t\t\t\t\t\t\t\t\t\t\t\t&&TWI_50, &&TWI_58, \t\t\t\t\t\t\t\t\t\t\t\t\t&&TWI_60, &&TWI_68, \t\t\t\t\t\t\t\t\t\t\t\t\t&&TWI_70, &&TWI_78, \t\t\t\t\t\t\t\t\t\t\t\t\t&&TWI_80, &&TWI_88, \t\t\t\t\t\t\t\t\t\t\t\t\t&&TWI_90, &&TWI_98, \t\t\t\t\t\t\t\t\t\t\t\t\t&&TWI_A0, &&TWI_A8, \t\t\t\t\t\t\t\t\t\t\t\t\t&&TWI_B0, &&TWI_B8, \t\t\t\t\t\t\t\t\t\t\t\t\t&&TWI_C0, &&TWI_C8, \t\t\t\t\t\t\t\t\t\t\t\t\t&&TWI_F8}; \t\t\t\t\t\t\t\t\t\t\t\t\t\t   \/* ----------------------------------------------------------------------------------- \tJump to label, address of which is in twi_list[TWSR&gt;&gt;3] ------------------------------------------------------------------------------------*\/ \tgoto *(pgm_read_word(&(twi_list[TWSR&gt;&gt;3]))); \t \/* ----------------------------------------------------------------------------------- \tBus error handler ------------------------------------------------------------------------------------*\/ TWI_00: \t\/\/ STOP condition will be generated \tgoto STOP;  \/* ----------------------------------------------------------------------------------- \tA START condition has been transmitted \tA repeated START condition has been transmitted \t \tnW = nR = 0:\t\tSTOP condition will be generated \tnW &gt; 0, nR - don't care:\tSLA+W will be send \tnW = 0, nR &gt; 0:\t\tSLA+R will be send ------------------------------------------------------------------------------------*\/ TWI_08: TWI_10: \tif (TWI.nW != 0) \t\t\/\/ SLA+W will be send \t\tTWDR = (TWI.SLA)&lt;&lt;1; \telse if (TWI.nR != 0) \t\t\/\/ SLA+R will be send \t\tTWDR = (TWI.SLA)&lt;&lt;1 | 1&lt;&lt;0; \telse \t\t\/\/ STOP condition will be generated \t\tgoto STOP; \tTWCR =  (1&lt;&lt;TWEN)|\t\t\t\t\t\/\/ \u041c\u043e\u0434\u0443\u043b\u044c TWI \u0432\u043a\u043b\u044e\u0447\u0435\u043d \t\t\t(1&lt;&lt;TWIE)|(1&lt;&lt;TWINT)|\t\t\t\/\/ \u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f! \u041e\u0447\u0438\u0449\u0430\u0435\u043c \u0444\u043b\u0430\u0433 \t\t\t(0&lt;&lt;TWEA)|(0&lt;&lt;TWSTA)|(0&lt;&lt;TWSTO)|\t\t\/\/ \u041e\u0442\u0441\u044b\u043b\u0430\u0435\u043c SLA+R\/W \t\t\t(0&lt;&lt;TWWC); \treturn;  \/* ----------------------------------------------------------------------------------- \tSLA+W has been transmitted; ACK has been received \tData byte has been transmitted;\tACK has been received \t \tnW &gt; 0, nR - don't care:\tData byte will be transmitted and ACK or NOT ACK will be received \tnW = 0, nR &gt; 0:\t\tRepeated START will be transmitted \tnW = nR = 0:\t\tSTOP condition will be generated ------------------------------------------------------------------------------------*\/ TWI_18: TWI_28: \tif (TWI.nW != 0) \t{ \t\t\/\/ Data byte will be transmitted and ACK or NOT ACK will be received \t\tTWDR = *TWI.pW++; \t\tTWCR =  (1&lt;&lt;TWEN)|\t\t\t\t\/\/ \u041c\u043e\u0434\u0443\u043b\u044c TWI \u0432\u043a\u043b\u044e\u0447\u0435\u043d \t\t\t\t(1&lt;&lt;TWIE)|(1&lt;&lt;TWINT)|\t\t\t\/\/ \u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f! \u041e\u0447\u0438\u0449\u0430\u0435\u043c \u0444\u043b\u0430\u0433 \t\t\t\t(0&lt;&lt;TWEA)|(0&lt;&lt;TWSTA)|(0&lt;&lt;TWSTO)|\t\/\/ \u041e\u0442\u0441\u044b\u043b\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \t\t\t\t(0&lt;&lt;TWWC); \t\tTWI.nW--; \t} \telse if (TWI.nR != 0) \t\t\/\/ Repeated START will be transmitted \t\tTWCR =  (1&lt;&lt;TWEN)|\t\t\t\t\/\/ \u041c\u043e\u0434\u0443\u043b\u044c TWI \u0432\u043a\u043b\u044e\u0447\u0435\u043d \t\t\t\t(1&lt;&lt;TWIE)|(1&lt;&lt;TWINT)|\t\t\t\/\/ \u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f! \u041e\u0447\u0438\u0449\u0430\u0435\u043c \u0444\u043b\u0430\u0433 \t\t\t\t(0&lt;&lt;TWEA)|(1&lt;&lt;TWSTA)|(0&lt;&lt;TWSTO)|\t\/\/ \u0414\u0430\u0435\u043c START \u0441\u0438\u0433\u043d\u0430\u043b \t\t\t\t(0&lt;&lt;TWWC); \telse \t\t\/\/ STOP condition will be generated \t\tgoto STOP; \treturn; \t \/* ----------------------------------------------------------------------------------- \tSLA+W has been transmitted; NOT ACK has been received ------------------------------------------------------------------------------------*\/ TWI_20: \t\/\/ STOP condition will be generated \tgoto STOP; \t \/* ----------------------------------------------------------------------------------- \tData byte has been transmitted; NOT ACK has been received ------------------------------------------------------------------------------------*\/ TWI_30: \t\/\/ STOP condition will be generated \tgoto STOP;  \/* ----------------------------------------------------------------------------------- \tArbitration lost in SLA+W or data bytes \tArbitration lost in SLA+R or NOT ACK bit ------------------------------------------------------------------------------------*\/ TWI_38: \t\/\/ STOP condition will be generated \tgoto STOP;  \/* ----------------------------------------------------------------------------------- \tSLA+R has been transmitted; ACK has been received \t \tnR = 1:\t\t\tData byte will be received and NOT ACK will be returned \tnR &gt; 1:\t\t\tData byte will be received and ACK will be returned ------------------------------------------------------------------------------------*\/ TWI_40: \tif (TWI.nR == 1) \t\t\/\/ Data byte will be received and NOT ACK will be returned \t\tTWCR =  (1&lt;&lt;TWEN)|\t\t\t\t\/\/ \u041c\u043e\u0434\u0443\u043b\u044c TWI \u0432\u043a\u043b\u044e\u0447\u0435\u043d \t\t\t\t(1&lt;&lt;TWIE)|(1&lt;&lt;TWINT)|\t\t\t\/\/ \u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f! \u041e\u0447\u0438\u0449\u0430\u0435\u043c \u0444\u043b\u0430\u0433 \t\t\t\t(0&lt;&lt;TWEA)|(0&lt;&lt;TWSTA)|(0&lt;&lt;TWSTO)|\t\/\/ \u0417\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 + NACK \t\t\t\t(0&lt;&lt;TWWC); \telse \t\t\/\/ Data byte will be received and ACK will be returned \t\tTWCR =  (1&lt;&lt;TWEN)|\t\t\t\t\/\/ \u041c\u043e\u0434\u0443\u043b\u044c TWI \u0432\u043a\u043b\u044e\u0447\u0435\u043d \t\t\t\t(1&lt;&lt;TWIE)|(1&lt;&lt;TWINT)|\t\t\t\/\/ \u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f! \u041e\u0447\u0438\u0449\u0430\u0435\u043c \u0444\u043b\u0430\u0433 \t\t\t\t(1&lt;&lt;TWEA)|(0&lt;&lt;TWSTA)|(0&lt;&lt;TWSTO)|\t\/\/ \u0417\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 + ACK \t\t\t\t(0&lt;&lt;TWWC); \treturn;  \/* ----------------------------------------------------------------------------------- \tSLA+R has been transmitted; NOT ACK has been received ------------------------------------------------------------------------------------*\/ TWI_48: \t\/\/ STOP condition will be generated \tgoto STOP;  \/* ----------------------------------------------------------------------------------- \tData byte has been received; ACK has been returned \t \tnR = 2:\t\tData byte will be received and NOT ACK will be returned \tnR &gt; 2:\t\tData byte will be received and ACK will be returned ------------------------------------------------------------------------------------*\/ TWI_50: \t\/\/ Read data \t*TWI.pR++ = TWDR; \tif (TWI.nR-- == 2) \t\t\/\/ Data byte will be received and NOT ACK will be returned \t\tTWCR =  (1&lt;&lt;TWEN)|\t\t\t\t\/\/ \u041c\u043e\u0434\u0443\u043b\u044c TWI \u0432\u043a\u043b\u044e\u0447\u0435\u043d \t\t\t\t(1&lt;&lt;TWIE)|(1&lt;&lt;TWINT)|\t\t\t\/\/ \u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f! \u041e\u0447\u0438\u0449\u0430\u0435\u043c \u0444\u043b\u0430\u0433 \t\t\t\t(0&lt;&lt;TWEA)|(0&lt;&lt;TWSTA)|(0&lt;&lt;TWSTO)|\t\/\/ \u0417\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 + NACK \t\t\t\t(0&lt;&lt;TWWC); \telse \t\t\/\/ Data byte will be received and ACK will be returned \t\tTWCR =  (1&lt;&lt;TWEN)|\t\t\t\t\/\/ \u041c\u043e\u0434\u0443\u043b\u044c TWI \u0432\u043a\u043b\u044e\u0447\u0435\u043d \t\t\t\t(1&lt;&lt;TWIE)|(1&lt;&lt;TWINT)|\t\t\t\/\/ \u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f! \u041e\u0447\u0438\u0449\u0430\u0435\u043c \u0444\u043b\u0430\u0433 \t\t\t\t(1&lt;&lt;TWEA)|(0&lt;&lt;TWSTA)|(0&lt;&lt;TWSTO)|\t\/\/ \u0417\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 + ACK \t\t\t\t(0&lt;&lt;TWWC); \treturn;  \/* ----------------------------------------------------------------------------------- \tData byte has been received; NOT ACK has been returned \t \tRepeated START will be transmitted \tSTOP condition will be transmitted and TWSTO Flag will be reset \tSTOP condition followed by a START condition will be transmitted and TWSTO Flag will be reset ------------------------------------------------------------------------------------*\/ TWI_58: \t\/\/ Read data \t*TWI.pR = TWDR; TWI_60: TWI_68: TWI_70: TWI_78: TWI_80: TWI_88: TWI_90: TWI_98: TWI_A0: TWI_A8: TWI_B0: TWI_B8: TWI_C0: TWI_C8: TWI_F8: \t\/\/ STOP condition will be transmitted and TWSTO Flag will be reset STOP: \tTWCR =  (1&lt;&lt;TWEN)|\t\t\t\t\/\/ \u041c\u043e\u0434\u0443\u043b\u044c TWI \u0432\u043a\u043b\u044e\u0447\u0435\u043d \t\t\t(1&lt;&lt;TWIE)|(1&lt;&lt;TWINT)|\t\t\/\/ \u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f! \u041e\u0447\u0438\u0449\u0430\u0435\u043c \u0444\u043b\u0430\u0433 \t\t\t(0&lt;&lt;TWEA)|(0&lt;&lt;TWSTA)|(1&lt;&lt;TWSTO)|\t\/\/ \u0417\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 + NACK \t\t\t(0&lt;&lt;TWWC); } <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u043d\u0443 \u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\"  src=\"http:\/\/habrastorage.org\/storage3\/d51\/ac2\/b96\/d51ac2b9683e5c2912f44561d989ca55.png\"\/><\/div>\n<p>  \u043a\u0430\u043a \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u043b\u043e\u0441\u044c \u0441 <b>488 \u043c\u043a\u0441<\/b> \u0434\u043e <b>538 \u043c\u043a\u0441<\/b>. \u0421\u0432\u044f\u0437\u0430\u043d\u043e \u044d\u0442\u043e \u0441 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043e\u043c \u0432 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u043e\u043c \u0438\u0437 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435\u043c \u0430\u0434\u0440\u0435\u0441\u0430 \u043f\u0440\u044b\u0436\u043a\u0430 \u043f\u043e lookup table. \u041d\u043e \u0441\u0430\u043c\u043e\u0435 \u0432\u0430\u0436\u043d\u043e\u0435 \u0447\u0442\u043e \u0432\u0441\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0432\u0435\u0434\u0435\u0442\u0441\u044f \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e. \u0410 \u0437\u043d\u0430\u0447\u0438\u0442 \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <b>get_AC1<\/b>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u043b\u0438\u0442\u0441\u044f \u0432\u0441\u0435\u0433\u043e <b>3,5 \u043c\u043a\u0441<\/b> \u0438\u043b\u0438 <b>28 \u0442\u0430\u043a\u0442\u043e\u0432<\/b>, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043c\u0435\u043b\u043e \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c\u0441\u044f \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0434\u0435\u043b\u0430\u043c\u0438, \u0430 \u043d\u0435 \u0442\u0443\u043f\u0438\u0442\u044c \u0432 \u0446\u0438\u043a\u043b\u0435 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\"  src=\"http:\/\/habrastorage.org\/storage3\/43e\/ca2\/24a\/43eca224a7781bea53b82b07ae795442.png\"\/><\/div>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0435\u0441\u043b\u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <b>get_AC1<\/b>, <b>get_AC2<\/b>,\u2026, <b>get_MD<\/b> \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\"  src=\"http:\/\/habrastorage.org\/storage3\/172\/d1c\/1d4\/172d1c1d43b65c74b193d394dca8d27f.png\"\/><\/div>\n<p>  \u0412\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f \u043b\u0438\u0448\u044c \u043e\u0434\u043d\u0430, <b>get_MD<\/b>, \u0430 \u0432\u0441\u0435 \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\"  src=\"http:\/\/habrastorage.org\/storage3\/6dd\/335\/f68\/6dd335f68cf1fc699f26e93f2474e00a.png\"\/><\/div>\n<p>  \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0434\u0430\u043d\u043d\u044b\u0435 \u0435\u0449\u0435 \u0434\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f SLA+W, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 Register_address \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0435\u0439 \u0438 \u0440\u0430\u0432\u0435\u043d <b>0xBE<\/b>. \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u044d\u0442\u043e \u043f\u043e\u0436\u0430\u043b\u0443\u0439 \u0441\u0430\u043c\u044b\u0439 \u0431\u0435\u0437\u043e\u0431\u0438\u0434\u043d\u044b\u0439 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439. \u0412\u0435\u0434\u044c \u0431\u0443\u0434\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0447\u0443\u0442\u044c \u0431\u044b\u0441\u0442\u0440\u0435\u0435 Register_address \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u043b \u0431\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <b>get_AC5<\/b> \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0430 \u0437\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u0431\u044b \u043c\u044b \u0435\u0433\u043e \u0438 \u0432\u043e\u0432\u0441\u0435 \u0432 <b>BMP085_EEPROM.MD<\/b>. \u0422\u043e \u0435\u0441\u0442\u044c \u043e\u0436\u0438\u0434\u0430\u0435\u043c <b>AC1<\/b>, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c <b>AC5<\/b>, \u0441\u043e\u0445\u0440\u0430\u043d\u0451\u043d\u043d\u043e\u0435 \u0432 <b>MD<\/b>. \u0410 \u0435\u0441\u043b\u0438 \u0431\u044b \u0432\u043c\u0435\u0441\u0442\u043e <b>get_AC5<\/b> \u0431\u044b\u043b\u0430 \u0431\u044b \u0434\u0440\u0443\u0433\u0430\u044f, \u0441\u043e \u0441\u0432\u043e\u0438\u043c SLA, \u043c\u044b \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u043e\u0442\u043e\u0441\u043b\u0430\u0442\u044c \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0443 \u0430\u0434\u0440\u0435\u0441\u0430 \u043e\u0434\u043d\u043e\u0433\u043e, \u0430 \u0432\u0442\u043e\u0440\u0443\u044e \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0431\u044b NACK, \u0430 \u0442\u0430\u043c \u043e\u0442 \u043b\u043e\u0433\u0438\u043a\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f, \u043b\u0438\u0431\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0437\u0430\u0446\u0438\u043a\u043b\u0438\u0442\u044c\u0441\u044f, \u043b\u0438\u0431\u043e \u0432\u044b\u043a\u0438\u043d\u0435\u0442 \u0421\u0422\u041e\u041f. \u0418\u0437 \u044d\u0442\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u0435\u0441\u0442\u044c \u043e\u0434\u0438\u043d \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u0439 \u0432\u044b\u0445\u043e\u0434. \u041d\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043f\u043e\u043a\u0430 \u043d\u0435 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0430\u0441\u044c \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0430\u044f. \u0422\u043e \u0435\u0441\u0442\u044c \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044f <b>get_AC1<\/b> \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0444\u043b\u0430\u0433 \u0432 1, \u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a, \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u0432 \u0421\u0422\u041e\u041f \u0435\u0433\u043e \u0441\u0431\u0440\u043e\u0441\u0438\u0442. \u0410 <b>get_AC2<\/b> \u043d\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0441\u044f, \u043f\u043e\u043a\u0430 \u044d\u0442\u043e\u0442 \u0444\u043b\u0430\u0433 \u043d\u0435 \u0441\u0431\u0440\u043e\u0448\u0435\u043d. \u0414\u0430, \u044d\u0442\u043e \u0432\u044b\u0445\u043e\u0434, \u043d\u043e \u0442\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u0432\u0441\u044f \u043f\u0440\u0435\u043b\u0435\u0441\u0442\u044c \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0430\u0436 \u043d\u0430 0%. \u0423\u0436 \u043b\u0443\u0447\u0448\u0435 \u0444\u043b\u0430\u0433\u043e\u0432\u044b\u0439 \u0430\u0432\u0442\u043e\u043c\u0430\u0442. \u041d\u043e \u0435\u0441\u0442\u044c \u0435\u0449\u0435 \u043e\u0434\u043d\u043e \u043a\u0440\u0430\u0441\u0438\u0432\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435.<\/p>\n<h5>\u0410\u043d\u0430\u043b\u043e\u0433 \u043c\u044c\u044e\u0442\u0435\u043a\u0441\u0430<\/h5>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u0438 <b>get_AC1<\/b>,\u2026, <b>get_MD<\/b> \u043d\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e. \u041e\u043d\u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442 \u0434\u0440\u0443\u0433\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043a\u043b\u0430\u0434\u0435\u0442 \u0438\u0445 \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0438 \u0441\u0430\u043c\u0430 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u043d\u0430\u0447\u0430\u043b\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438, \u0435\u0441\u043b\u0438 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043d\u0435 \u043f\u0443\u0441\u0442\u0430. \u041f\u0435\u0440\u0435\u043f\u0438\u0448\u0435\u043c \u043d\u0430\u0448\u0443 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443, \u0441\u043e\u0437\u0434\u0430\u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440:  <\/p>\n<pre><code class=\"cpp\">#define size 8 ... typedef struct { \tunsigned char SLA;\t\t\/\/ Slave address \tunsigned char *pW;\t\t\/\/ \u041e\u0442\u043a\u0443\u0434\u0430? \tunsigned char nW;\t\t\/\/ \u0421\u043a\u043e\u043b\u044c\u043a\u043e? \tunsigned char *pR;\t\t\/\/ \u041a\u0443\u0434\u0430? \tunsigned char nR;\t\t\/\/ \u0421\u043a\u043e\u043b\u044c\u043a\u043e? } twi; twi TWI[size]; <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0430\u043a \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044f <b>get_AC1<\/b> \u0442\u0435\u043f\u0435\u0440\u044c:  <\/p>\n<pre><code class=\"cpp\">unsigned char buf[size]; ... void get_AC1(void) { \tvolatile twi *pl;\t\t\/\/ \u0423\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0442\u0438\u043f\u0430 twi\t \tbuf[0] = 0xAA;\t\t\/\/ \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c Register address \tpl-&gt;SLA = 0x77;\t\t\/\/ Slave address \u043d\u0430\u0448\u0435\u0433\u043e BMP085 \tpl-&gt;pW = buf;\t\t\/\/ \u0423\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043e\u0442\u043a\u0443\u0434\u0430 \u0431\u0440\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \tpl-&gt;nW = 1;\t\t\t\/\/ \u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u0430\u0439\u0442 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c? \tpl-&gt;pR = buf;\t\t\/\/ \u0423\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043a\u0443\u0434\u0430 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c? \tpl-&gt;nR = 2;\t\t\t\/\/ \u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u0430\u0439\u0442 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c? \tScheduler(pl);\t\t\/\/ \u0412\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u043e\u0447\u0435\u0440\u0435\u0434\u0438 } <\/code><\/pre>\n<p>  \u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0442\u0430\u043a\u0436\u0435, \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0421\u0422\u0410\u0420\u0422 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043c\u044b \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <b>Scheduler<\/b>, \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u044f \u0435\u0439 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0442\u0438\u043f\u0430 <b>twi<\/b>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c\u0441\u044f \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u043b\u044f TWI \u0444\u0440\u0435\u0439\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0435. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0430 \u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430:  <\/p>\n<ul>\n<li> \u043f\u043e\u043b\u0443\u0447\u0430\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442 \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 TWI[i], \u0433\u0434\u0435 i \u2014 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043d\u043e\u043c\u0435\u0440 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043e\u043d \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 1; \u0435\u0441\u043b\u0438 i \u0432\u044b\u0432\u0430\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u044b \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u043e\u043d \u043e\u0431\u043d\u0443\u043b\u044f\u0435\u0442\u0441\u044f; \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u044b \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440 \u0432 \u043a\u043e\u043b\u044c\u0446\u0435\u0432\u043e\u0439 \u0431\u0443\u0444\u0435\u0440; <\/li>\n<li> \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f j \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0435 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043e\u043d\u0430 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 1; \u0435\u0441\u043b\u0438 j \u0432\u044b\u0432\u0430\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u044b \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u043e\u043d\u0430 \u043e\u0431\u043d\u0443\u043b\u044f\u0435\u0442\u0441\u044f;<\/li>\n<li> \u0435\u0441\u043b\u0438 i \u0434\u043e\u0433\u043e\u043d\u044f\u0435\u0442 j (\u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043e\u0447\u0435\u0440\u0435\u0434\u0438) \u2014 \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440 \u043d\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0430; <\/li>\n<li> \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f flag \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f 0;<\/li>\n<li> \u0435\u0441\u043b\u0438 i \u043d\u0435 \u0440\u0430\u0432\u043d\u043e j (\u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043d\u0435 \u043f\u0443\u0441\u0442\u0430) \u0438 flag = 0, \u0442\u043e flag = 1, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0421\u0422\u0410\u0420\u0422 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435;<\/li>\n<li> \u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0435 \u043f\u043e\u0441\u043b\u0435 \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0444\u0440\u0435\u0439\u043c\u0430 j \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u043c \u043d\u0430 1, \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0444\u0440\u0435\u0439\u043c; <\/li>\n<li> \u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0435 \u043f\u043e\u0441\u043b\u0435 \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0444\u0440\u0435\u0439\u043c\u0430 \u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f j, \u0435\u0441\u043b\u0438 i \u043d\u0435 \u0440\u0430\u0432\u043d\u043e j, \u0434\u0430\u0435\u043c \u0421\u0422\u041e\u041f-\u0421\u0422\u0410\u0420\u0422 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435, \u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0421\u0422\u041e\u041f \u0438 flag = 0; <\/li>\n<\/ul>\n<p>  \u041d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0431\u0440\u0430\u0442\u044c \u0432 \u0433\u043e\u043b\u043e\u0432\u0443 \u0442\u043e \u0447\u0442\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0432\u044b\u0448\u0435. \u041b\u0443\u0447\u0448\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e \u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0430\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u044f\u0441\u043d\u0438\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u044b \u0432\u044b\u0448\u0435\u0441\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e:<\/p>\n<div class=\"slideshow\"><iframe loading=\"lazy\" src=\"http:\/\/www.slideshare.net\/slideshow\/embed_code\/26105311\" width=\"425\" height=\"355\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/div>\n<p>   \u0424\u0443\u043d\u043a\u0446\u0438\u044f-\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a <b>Sheduler<\/b>:  <\/p>\n<pre><code class=\"cpp\">void Scheduler(twi *pl) { \tif (tail-head !=1 && head-tail != size-1)\t\t\/\/ \u0415\u0441\u043b\u0438 \u0431\u0443\u0444\u0435\u0440 \u043d\u0435 \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d, \u0442\u043e \t{ \t\ttwi *pg = &TWI[head];\t\t\t\t\/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0443\u044e \u044f\u0447\u0435\u0439\u043a\u0443 \t\tpg-&gt;SLA = pl-&gt;SLA;\t\t\t\t\/\/ \u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c SLA \t\tpg-&gt;pW = pl-&gt;pW;\t\t\t\t\/\/ \u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c *pW \t\tpg-&gt;nW = pl-&gt;nW;\t\t\t\t\/\/ \u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c nW \t\tpg-&gt;pR = pl-&gt;pR;\t\t\t\t\/\/ \u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c *pR \t\tpg-&gt;nR = pl-&gt;nR;\t\t\t\t\/\/ \u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c nR \t\thead = (head+1)&(size-1);\t\t\t\/\/ \u0415\u0441\u043b\u0438 \u043d\u043e\u043c\u0435\u0440 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c - \u043e\u0431\u043d\u0443\u043b\u044f\u0435\u043c \t\tif (!flag.twi_run)\t\t\t\t\/\/ \u0415\u0441\u043b\u0438 \u043c\u043e\u0434\u0443\u043b\u044c TWI \u0435\u0449\u0435 \u043d\u0435 \u0437\u0430\u043f\u0443\u0449\u0435\u043d (\u0444\u043b\u0430\u0433 \u0440\u0430\u0432\u0435\u043d 0) \t\t{ \t\t\tflag.twi_run = 1;\t\t\t\t\/\/ \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0444\u043b\u0430\u0433 \u0432 1 \t\t\tTWCR =  (1&lt;&lt;TWEN)|\t\t\t\t\/\/ \u0417\u0430\u0443\u043f\u0441\u043a\u0430\u0435\u043c TWI \u043c\u043e\u0434\u0443\u043b\u044c \t\t\t\t\t(1&lt;&lt;TWIE)|(1&lt;&lt;TWINT)| \t\t\t\t\t(0&lt;&lt;TWEA)|(1&lt;&lt;TWSTA)|(0&lt;&lt;TWSTO)| \t\t\t\t\t(0&lt;&lt;TWWC); \t\t} \t} } <\/code><\/pre>\n<p>  \u041d\u0443 \u0438 \u0441\u0430\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0435\u0440\u0435\u0434\u0435\u043b\u0430\u043d\u043d\u044b\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">ISR(TWI_vect) { \ttwi *p = &TWI[tail]; \/* ----------------------------------------------------------------------------------- \tJump table which is stored in flash ------------------------------------------------------------------------------------*\/ \tstatic const void * const twi_list[] PROGMEM = {&&TWI_00, &&TWI_08, \t\t\t\t\t\t\t\t\t\t\t\t\t&&TWI_10, &&TWI_18, \t\t\t\t\t\t\t\t\t\t\t\t\t&&TWI_20, &&TWI_28, \t\t\t\t\t\t\t\t\t\t\t\t\t&&TWI_30, &&TWI_38, \t\t\t\t\t\t\t\t\t\t\t\t\t&&TWI_40, &&TWI_48, \t\t\t\t\t\t\t\t\t\t\t\t\t&&TWI_50, &&TWI_58, \t\t\t\t\t\t\t\t\t\t\t\t\t&&TWI_60, &&TWI_68, \t\t\t\t\t\t\t\t\t\t\t\t\t&&TWI_70, &&TWI_78, \t\t\t\t\t\t\t\t\t\t\t\t\t&&TWI_80, &&TWI_88, \t\t\t\t\t\t\t\t\t\t\t\t\t&&TWI_90, &&TWI_98, \t\t\t\t\t\t\t\t\t\t\t\t\t&&TWI_A0, &&TWI_A8, \t\t\t\t\t\t\t\t\t\t\t\t\t&&TWI_B0, &&TWI_B8, \t\t\t\t\t\t\t\t\t\t\t\t\t&&TWI_C0, &&TWI_C8, \t\t\t\t\t\t\t\t\t\t\t\t\t&&TWI_F8}; \t\t\t\t\t\t\t\t\t\t\t\t\t\t   \/* ----------------------------------------------------------------------------------- \tJump to label, address of which is in twi_list[TWSR&gt;&gt;3] ------------------------------------------------------------------------------------*\/ \tgoto *(pgm_read_word(&(twi_list[TWSR&gt;&gt;3]))); \t \/* ----------------------------------------------------------------------------------- \tBus error handler ------------------------------------------------------------------------------------*\/ TWI_00: \t\/\/ STOP condition will be generated \tgoto STOP;  \/* ----------------------------------------------------------------------------------- \tA START condition has been transmitted \tA repeated START condition has been transmitted \t \tnW = nR = 0:\t\tSTOP condition will be generated \tnW &gt; 0, nR - don't care:\tSLA+W will be send \tnW = 0, nR &gt; 0:\t\tSLA+R will be send ------------------------------------------------------------------------------------*\/ TWI_08: TWI_10: \tif (p-&gt;nW != 0) \t\t\/\/ SLA+W will be send \t\tTWDR = p-&gt;SLA&lt;&lt;1; \telse if (p-&gt;nR != 0) \t\t\/\/ SLA+R will be send \t\tTWDR = p-&gt;SLA&lt;&lt;1 | 1&lt;&lt;0; \telse \t\t\/\/ STOP condition will be generated \t\tgoto STOP; \tTWCR =  (1&lt;&lt;TWEN)|\t\t\t\t\t\/\/ \u041c\u043e\u0434\u0443\u043b\u044c TWI \u0432\u043a\u043b\u044e\u0447\u0435\u043d \t\t\t(1&lt;&lt;TWIE)|(1&lt;&lt;TWINT)|\t\t\t\/\/ \u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f! \u041e\u0447\u0438\u0449\u0430\u0435\u043c \u0444\u043b\u0430\u0433 \t\t\t(0&lt;&lt;TWEA)|(0&lt;&lt;TWSTA)|(0&lt;&lt;TWSTO)|\t\t\/\/ \u041e\u0442\u0441\u044b\u043b\u0430\u0435\u043c SLA+R\/W \t\t\t(0&lt;&lt;TWWC); \treturn;  \/* ----------------------------------------------------------------------------------- \tSLA+W has been transmitted; ACK has been received \tData byte has been transmitted;\tACK has been received \t \tnW &gt; 0, nR - don't care:\tData byte will be transmitted and ACK or NOT ACK will be received \tnW = 0, nR &gt; 0:\t\tRepeated START will be transmitted \tnW = nR = 0:\t\tSTOP condition will be generated ------------------------------------------------------------------------------------*\/ TWI_18: TWI_28: \tif (p-&gt;nW != 0) \t{ \t\t\/\/ Data byte will be transmitted and ACK or NOT ACK will be received \t\tTWDR = *p-&gt;pW; \t\tp-&gt;pW++; \t\tTWCR =  (1&lt;&lt;TWEN)|\t\t\t\t\/\/ \u041c\u043e\u0434\u0443\u043b\u044c TWI \u0432\u043a\u043b\u044e\u0447\u0435\u043d \t\t\t\t(1&lt;&lt;TWIE)|(1&lt;&lt;TWINT)|\t\t\t\/\/ \u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f! \u041e\u0447\u0438\u0449\u0430\u0435\u043c \u0444\u043b\u0430\u0433 \t\t\t\t(0&lt;&lt;TWEA)|(0&lt;&lt;TWSTA)|(0&lt;&lt;TWSTO)|\t\/\/ \u041e\u0442\u0441\u044b\u043b\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \t\t\t\t(0&lt;&lt;TWWC); \t\tp-&gt;nW--; \t} \telse if (p-&gt;nR != 0) \t\t\/\/ Repeated START will be transmitted \t\tTWCR =  (1&lt;&lt;TWEN)|\t\t\t\t\/\/ \u041c\u043e\u0434\u0443\u043b\u044c TWI \u0432\u043a\u043b\u044e\u0447\u0435\u043d \t\t\t\t(1&lt;&lt;TWIE)|(1&lt;&lt;TWINT)|\t\t\t\/\/ \u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f! \u041e\u0447\u0438\u0449\u0430\u0435\u043c \u0444\u043b\u0430\u0433 \t\t\t\t(0&lt;&lt;TWEA)|(1&lt;&lt;TWSTA)|(0&lt;&lt;TWSTO)|\t\/\/ \u0414\u0430\u0435\u043c START \u0441\u0438\u0433\u043d\u0430\u043b \t\t\t\t(0&lt;&lt;TWWC); \telse \t\t\/\/ STOP condition will be generated \t\tgoto STOP; \treturn; \t \/* ----------------------------------------------------------------------------------- \tSLA+W has been transmitted; NOT ACK has been received ------------------------------------------------------------------------------------*\/ TWI_20: \t\/\/ STOP condition will be generated \tgoto STOP; \t \/* ----------------------------------------------------------------------------------- \tData byte has been transmitted; NOT ACK has been received ------------------------------------------------------------------------------------*\/ TWI_30: \t\/\/ STOP condition will be generated \tgoto STOP;  \/* ----------------------------------------------------------------------------------- \tArbitration lost in SLA+W or data bytes \tArbitration lost in SLA+R or NOT ACK bit ------------------------------------------------------------------------------------*\/ TWI_38: \t\/\/ STOP condition will be generated \tgoto STOP;  \/* ----------------------------------------------------------------------------------- \tSLA+R has been transmitted; ACK has been received \t \tnR = 1:\t\tData byte will be received and NOT ACK will be returned \tnR &gt; 1:\t\tData byte will be received and ACK will be returned ------------------------------------------------------------------------------------*\/ TWI_40: \tif (p-&gt;nR == 1) \t\t\/\/ Data byte will be received and NOT ACK will be returned \t\tTWCR =  (1&lt;&lt;TWEN)|\t\t\t\t\/\/ \u041c\u043e\u0434\u0443\u043b\u044c TWI \u0432\u043a\u043b\u044e\u0447\u0435\u043d \t\t\t\t(1&lt;&lt;TWIE)|(1&lt;&lt;TWINT)|\t\t\t\/\/ \u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f! \u041e\u0447\u0438\u0449\u0430\u0435\u043c \u0444\u043b\u0430\u0433 \t\t\t\t(0&lt;&lt;TWEA)|(0&lt;&lt;TWSTA)|(0&lt;&lt;TWSTO)|\t\/\/ \u0417\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 + NACK \t\t\t\t(0&lt;&lt;TWWC); \telse \t\t\/\/ Data byte will be received and ACK will be returned \t\tTWCR =  (1&lt;&lt;TWEN)|\t\t\t\t\/\/ \u041c\u043e\u0434\u0443\u043b\u044c TWI \u0432\u043a\u043b\u044e\u0447\u0435\u043d \t\t\t\t(1&lt;&lt;TWIE)|(1&lt;&lt;TWINT)|\t\t\t\/\/ \u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f! \u041e\u0447\u0438\u0449\u0430\u0435\u043c \u0444\u043b\u0430\u0433 \t\t\t\t(1&lt;&lt;TWEA)|(0&lt;&lt;TWSTA)|(0&lt;&lt;TWSTO)|\t\/\/ \u0417\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 + ACK \t\t\t\t(0&lt;&lt;TWWC); \treturn;  \/* ----------------------------------------------------------------------------------- \tSLA+R has been transmitted; NOT ACK has been received ------------------------------------------------------------------------------------*\/ TWI_48: \t\/\/ STOP condition will be generated \tgoto STOP;  \/* ----------------------------------------------------------------------------------- \tData byte has been received; ACK has been returned \t \tnR = 2:\t\tData byte will be received and NOT ACK will be returned \tnR &gt; 2:\t\tData byte will be received and ACK will be returned ------------------------------------------------------------------------------------*\/ TWI_50: \t\/\/ Read data \t*p-&gt;pR = TWDR; \tp-&gt;pR++; \tif (p-&gt;nR-- == 2) \t\t\/\/ Data byte will be received and NOT ACK will be returned \t\tTWCR =  (1&lt;&lt;TWEN)|\t\t\t\t\/\/ \u041c\u043e\u0434\u0443\u043b\u044c TWI \u0432\u043a\u043b\u044e\u0447\u0435\u043d \t\t\t\t(1&lt;&lt;TWIE)|(1&lt;&lt;TWINT)|\t\t\t\/\/ \u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f! \u041e\u0447\u0438\u0449\u0430\u0435\u043c \u0444\u043b\u0430\u0433 \t\t\t\t(0&lt;&lt;TWEA)|(0&lt;&lt;TWSTA)|(0&lt;&lt;TWSTO)|\t\/\/ \u0417\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 + NACK \t\t\t\t(0&lt;&lt;TWWC); \telse \t\t\/\/ Data byte will be received and ACK will be returned \t\tTWCR =  (1&lt;&lt;TWEN)|\t\t\t\t\/\/ \u041c\u043e\u0434\u0443\u043b\u044c TWI \u0432\u043a\u043b\u044e\u0447\u0435\u043d \t\t\t\t(1&lt;&lt;TWIE)|(1&lt;&lt;TWINT)|\t\t\t\/\/ \u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f! \u041e\u0447\u0438\u0449\u0430\u0435\u043c \u0444\u043b\u0430\u0433 \t\t\t\t(1&lt;&lt;TWEA)|(0&lt;&lt;TWSTA)|(0&lt;&lt;TWSTO)|\t\/\/ \u0417\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 + ACK \t\t\t\t(0&lt;&lt;TWWC); \treturn;  \/* ----------------------------------------------------------------------------------- \tData byte has been received; NOT ACK has been returned \t \tRepeated START will be transmitted \tSTOP condition will be transmitted and TWSTO Flag will be reset \tSTOP condition followed by a START condition will be transmitted and TWSTO Flag will be reset ------------------------------------------------------------------------------------*\/ TWI_58: \t\/\/ Read data \t*p-&gt;pR = TWDR; TWI_60: TWI_68: TWI_70: TWI_78: TWI_80: TWI_88: TWI_90: TWI_98: TWI_A0: TWI_A8: TWI_B0: TWI_B8: TWI_C0: TWI_C8: TWI_F8: \t\/\/ STOP condition will be transmitted and TWSTO Flag will be reset STOP: \t\ttail = (tail+1)&(size-1);\t\t\t\/\/ \u0423\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u043c tail \u043d\u0430 1, \u0435\u0441\u043b\u0438 \u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u044b, \u0442\u043e \u043e\u0431\u043d\u0443\u043b\u044f\u0435\u043c \t\tif (head != tail)\t\t\t\t\/\/ \u0415\u0441\u043b\u0438 head \u0438 tail \u043d\u0435 \u0440\u0430\u0432\u043d\u044b, \u0442\u043e \t\t\tTWCR =  (1&lt;&lt;TWEN)|\t\t\t\t\/\/ \u041c\u043e\u0434\u0443\u043b\u044c TWI \u0432\u043a\u043b\u044e\u0447\u0435\u043d \t\t\t\t\t(1&lt;&lt;TWIE)|(1&lt;&lt;TWINT)|\t\t\/\/ \u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f! \u041e\u0447\u0438\u0449\u0430\u0435\u043c \u0444\u043b\u0430\u0433 \t\t\t\t\t(0&lt;&lt;TWEA)|(1&lt;&lt;TWSTA)|(1&lt;&lt;TWSTO)|\t\/\/ \u0421\u0422\u0410\u0420\u0422-\u0421\u0422\u041e\u041f \t\t\t\t\t(0&lt;&lt;TWWC); \t\telse\t\t\t\t\t\t\/\/ \u0438\u043d\u0430\u0447\u0435 \t\t{ \t\t\tTWCR =  (1&lt;&lt;TWEN)|\t\t\t\t\/\/ \u041c\u043e\u0434\u0443\u043b\u044c TWI \u0432\u043a\u043b\u044e\u0447\u0435\u043d \t\t\t\t\t(1&lt;&lt;TWIE)|(1&lt;&lt;TWINT)|\t\t\/\/ \u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f! \u041e\u0447\u0438\u0449\u0430\u0435\u043c \u0444\u043b\u0430\u0433 \t\t\t\t\t(0&lt;&lt;TWEA)|(0&lt;&lt;TWSTA)|(1&lt;&lt;TWSTO)|\t\/\/ \u0421\u0422\u041e\u041f \t\t\t\t\t(0&lt;&lt;TWWC); \t\t\tflag.twi_run = 0;\t\t\t\t\/\/ \u041e\u0447\u0438\u0449\u0430\u0435\u043c \u0444\u043b\u0430\u0433 \t\t} } <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u043d\u0443 \u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f <b>get_AC1<\/b>:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\"  src=\"http:\/\/habrastorage.org\/storage3\/22a\/4bd\/c0d\/22a4bdc0dd3678388c94a23e62674b65.png\"\/><\/div>\n<p>  <\/p>\n<h5>\u041f\u043e\u0441\u043b\u0435\u0441\u043b\u043e\u0432\u0438\u0435<\/h5>\n<p>  \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0435\u0441\u043b\u0438 \u043f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 <b>get_AC1<\/b> \u0441\u0434\u0435\u043b\u0430\u0442\u044c <b>get_AC2<\/b> \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c 2 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043e\u0434\u0440\u044f\u0434, \u0442\u043e \u0434\u0432\u0430 \u0440\u0430\u0437\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f. \u0421\u0432\u044f\u0437\u0430\u043d\u043d\u043e \u044d\u0442\u043e \u0441 \u0442\u0435\u043c \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u043c\u044b \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u043c \u0432 buf[0]. \u0427\u0442\u043e\u0431\u044b \u044d\u0442\u043e\u0433\u043e \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043c\u044b \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 buf[1] \u0438 \u0432\u0441\u0435 \u0431\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u043a\u0430\u043a \u043d\u0443\u0436\u043d\u043e. \u041d\u043e \u0442\u0430\u043a \u043d\u0435 \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f. \u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043e\u0442\u043a\u0443\u0434\u0430 \u0431\u0440\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u0441\u043a\u043e\u043b\u044c\u043a\u043e, \u0430 \u043d\u0435\u043a\u0430\u044f \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u044f\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u043a\u043b\u0430\u0441\u0442\u044c \u044d\u0442\u043e \u0432 \u0431\u0443\u0444\u0435\u0440 \u0434\u043b\u044f TWI \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043e\u0442\u043a\u0443\u0434\u0430 \u0432 \u043d\u0435\u043c \u0431\u0440\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0435. \u0412 \u043e\u0431\u0449\u0435\u043c \u043a\u043e\u0434 \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">unsigned char bufTx[size]; unsigned char pos = 0; ... void get_AC1(void) { \tvolatile twi *pl;\t\t\t\t\t\/\/ \u0423\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0442\u0438\u043f\u0430 twi\t \tvolatile uint8_t buf[] = {0xAA};\t\t\t\/\/ \u041b\u043e\u0436\u0438\u043c Register address \u0432 buf \tpl-&gt;SLA = 0x77;\t\t\t\t\t\/\/ Slave address \u043d\u0430\u0448\u0435\u0433\u043e BMP085 \tpl-&gt;pW = buf;\t\t\t\t\t\/\/ \u0423\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043e\u0442\u043a\u0443\u0434\u0430 \u0431\u0440\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \tpl-&gt;nW = 1;\t\t\t\t\t\t\/\/ \u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u0430\u0439\u0442 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c? \tpl-&gt;pR = buf;\t\t\t\t\t\/\/ \u0423\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043a\u0443\u0434\u0430 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c? \tpl-&gt;nR = 2;\t\t\t\t\t\t\/\/ \u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u0430\u0439\u0442 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c? \tScheduler(pl);\t\t\t\t\t\/\/ \u0412\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u043e\u0447\u0435\u0440\u0435\u0434\u0438 } \/\/ ============================================ void get_AC2(void) { \tvolatile twi *pl;\t\t\t\t\t\/\/ \u0423\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0442\u0438\u043f\u0430 twi \tvolatile uint8_t buf[] = {0xAC};\t\t\t\/\/ \u041b\u043e\u0436\u0438\u043c Register address \u0432 buf \tpl-&gt;SLA = 0x77;\t\t\t\t\t\/\/ Slave address \u043d\u0430\u0448\u0435\u0433\u043e BMP085 \tpl-&gt;pW = buf;\t\t\t\t\t\/\/ \u0423\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043e\u0442\u043a\u0443\u0434\u0430 \u0431\u0440\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \tpl-&gt;nW = 1;\t\t\t\t\t\t\/\/ \u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u0430\u0439\u0442 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c? \tpl-&gt;pR = buf;\t\t\t\t\t\/\/ \u0423\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043a\u0443\u0434\u0430 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c? \tpl-&gt;nR = 2;\t\t\t\t\t\t\/\/ \u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u0430\u0439\u0442 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c? \tScheduler(pl);\t\t\t\t\t\/\/ \u0412\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u043e\u0447\u0435\u0440\u0435\u0434\u0438 } \/\/ ============================================ void Scheduler(volatile twi *pl) { \tif (tail-head !=1 && head-tail != size-1)\t\t\/\/ \u0415\u0441\u043b\u0438 \u0431\u0443\u0444\u0435\u0440 \u043d\u0435 \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d, \u0442\u043e \t{ \t\ttwi *pg = &TWI[head];\t\t\t\t\/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0443\u044e \u044f\u0447\u0435\u0439\u043a\u0443 \t\tpg-&gt;SLA = pl-&gt;SLA;\t\t\t\t\/\/ \u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c SLA \t\tpg-&gt;pW = pushToBuf(pl-&gt;pW,pl-&gt;nW);\t\t\/\/ \u0412\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \/\/\t\t\t\t\t\t\t\u0438\u0437 buf \u0432 bufTX \u0438 \u0432\u043e\u0437\u0440\u0430\u0449\u0430\u0435\u0442 \u0443\u043a\u0437\u0430\u0430\u0442\u0435\u043b\u044c \t\tpg-&gt;nW = pl-&gt;nW;\t\t\t\t\/\/ \u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c nW \t\tpg-&gt;pR = pl-&gt;pR;\t\t\t\t\/\/ \u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c *pR \t\tpg-&gt;nR = pl-&gt;nR;\t\t\t\t\/\/ \u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c nR \t\thead = (head+1)&(size-1);\t\t\t\/\/ \u0415\u0441\u043b\u0438 \u043d\u043e\u043c\u0435\u0440 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c - \u043e\u0431\u043d\u0443\u043b\u044f\u0435\u043c \t\tif (!flag.twi_run)\t\t\t\t\/\/ \u0415\u0441\u043b\u0438 \u043c\u043e\u0434\u0443\u043b\u044c TWI \u0435\u0449\u0435 \u043d\u0435 \u0437\u0430\u043f\u0443\u0449\u0435\u043d (\u0444\u043b\u0430\u0433 \u0440\u0430\u0432\u0435\u043d 0) \t\t{ \t\t\tflag.twi_run = 1;\t\t\t\t\/\/ \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0444\u043b\u0430\u0433 \u0432 1 \t\t\tTWCR =  (1&lt;&lt;TWEN)|\t\t\t\t\/\/ \u0417\u0430\u0443\u043f\u0441\u043a\u0430\u0435\u043c TWI \u043c\u043e\u0434\u0443\u043b\u044c \t\t\t\t\t(1&lt;&lt;TWIE)|(1&lt;&lt;TWINT)| \t\t\t\t\t(0&lt;&lt;TWEA)|(1&lt;&lt;TWSTA)|(0&lt;&lt;TWSTO)| \t\t\t\t\t(0&lt;&lt;TWWC); \t\t} \t} } \/\/ ============================================ unsigned char *pushToBuf(unsigned char *buf, unsigned char n) { \tunsigned char *p = &bufTx[pos];\t\t\t\/\/ \u0423\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043e\u0442\u043a\u0443\u0434\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443 \u0431\u0440\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \tdo { \t\tbufTx[pos++] = *buf++;\t\t\t\t\/\/ \u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0438\u0437 buf \u0432 bufTx \t\tpos &= size-1;\t\t\t\t\t\/\/ \u0415\u0441\u043b\u0438 \u0447\u0435 - \u043e\u0431\u043d\u0443\u043b\u044f\u0435\u043c\u0441\u044f \t} while (--n);\t\t\t\t\t\/\/ \u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c n \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \treturn p;\t\t\t\t\t\t\/\/ \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c p  } <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\"  src=\"http:\/\/habrastorage.org\/storage3\/d5e\/a56\/b7d\/d5ea56b7d7b2dcbbf9b916a28dbca876.png\"\/><\/div>\n<p>  \u041f\u043e-\u0434\u043e\u0431\u0440\u043e\u043c\u0443, \u043f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u0442\u0430\u043a\u0443\u044e \u0436\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438 \u0434\u043b\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0449\u0435\u0433\u043e \u0431\u0443\u0444\u0435\u0440\u0430. \u0422\u044b \u0433\u043e\u0432\u043e\u0440\u0438\u0448\u044c \u0435\u0439 \u0441\u043a\u043e\u043b\u044c\u043a\u043e, \u0430 \u043e\u043d\u0430 \u0442\u0435\u0431\u0435 \u043f\u0440\u0438\u0441\u044b\u043b\u0430\u0435\u0442 \u043a\u0443\u0434\u0430. \u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 TWI, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438, \u0430 \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0434\u043b\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0430\u043c\u044f\u0442\u0438.<br \/>  \u0415\u0441\u043b\u0438 \u0443 \u043a\u043e\u0433\u043e \u0432\u043e\u0437\u043d\u0438\u043a \u0432\u043e\u043f\u0440\u043e\u0441 \u043e \u0442\u043e\u043c \u043f\u043e\u0447\u0435\u043c\u0443 \u0434\u043b\u044f \u043e\u0431\u043d\u0443\u043b\u0435\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u043e\u0434:  <\/p>\n<pre><code class=\"cpp\">head = (head+1)&(size-1); tail = (tail+1)&(size-1); pos &= size-1; <\/code><\/pre>\n<p>  \u044f \u0441\u043a\u0430\u0436\u0443 \u0442\u0430\u043a \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0438 \u043c\u0435\u043d\u044c\u0448\u0435 \u043a\u043e\u0434\u0430. \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435, \u0447\u0442\u043e\u0431\u044b \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0431\u044b\u043b\u043e \u0440\u0430\u0432\u043d\u043e 2<sup>n<\/sup>.<br \/>  \u0418\u0437 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u0441\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c \u0442\u0430\u043a\u0436\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 <b>size<\/b> \u0434\u043b\u044f TWI. \u0415\u0441\u043b\u0438 \u043e\u043d \u043c\u0435\u043d\u044c\u0448\u0435 \u0447\u0435\u043c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0434\u0440\u044f\u0434 \u0438\u0434\u0443\u0449\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u043c\u044b \u043d\u0435\u043f\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u0442\u0435\u0440\u044f\u0435\u043c \u0447\u0430\u0441\u0442\u044c \u0438\u0445. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0430\u0436\u043d\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0430 \u044d\u0442\u043e\u043c \u0430\u043a\u0446\u0435\u043d\u0442. <b>\u0412\u0441\u0435\u0433\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 size \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u043d\u0430 1 \u0431\u043e\u043b\u044c\u0448\u0435 \u0447\u0435\u043c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432<\/b>.<br \/>  \u041c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0435\u0449\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u043f\u043e\u0441\u043b\u0435 \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u0414\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u044d\u0442\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 AC1 \u0438 AC2, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432 Big-endianne \u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0432 Little-endiann, \u0430 \u043f\u043e\u0442\u043e\u043c \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c \u043c\u0435\u0441\u0442\u0435. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 TWI \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0435\u0449\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0438 \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c \u043a\u0430\u043a \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0435\u0435 \u043f\u043e\u0441\u043b\u0435 \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u043a\u0438.<br \/>  \u041f\u0430\u0440\u0443 \u0441\u043b\u043e\u0432 \u0441\u0442\u043e\u0438\u0442 \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u0445. \u041f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043a \u043c\u043e\u0435\u0439 \u0441\u0445\u0435\u043c\u0435, \u0435\u0441\u0442\u044c 2 \u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u0441\u043e\u0432\u0435\u0449\u0435\u043d\u043d\u043e\u0441\u0442\u0438, \u0434\u0430\u0432\u043b\u0435\u043d\u0438\u044f, 1 \u043c\u0438\u043a\u0440\u043e\u0441\u0445\u0435\u043c\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0438 1 \u043c\u0438\u043a\u0440\u043e\u0441\u0445\u0435\u043c\u0430 \u043f\u0430\u043c\u044f\u0442\u0438 \u043d\u0430 \u0448\u0438\u043d\u0435 TWI. \u0418 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043d\u0438\u043c \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0446\u0435\u043d\u0438\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u044b\u0439, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443 \u0434\u043b\u044f \u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u0434\u0430\u0432\u043b\u0435\u043d\u0438\u044f:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\"  src=\"http:\/\/habrastorage.org\/storage3\/197\/eea\/83f\/197eea83fdb7a1f3d6364475dd033e1e.png\"\/><\/div>\n<p>  \u0435\u0441\u043b\u0438 \u043c\u044b \u043f\u043e\u0442\u0435\u0440\u044f\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u0434\u043b\u044f uncompressed pressure, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 uncompressed temperature \u043d\u0430\u043c \u043d\u0438 \u043a \u0447\u0435\u043c\u0443 \u0438 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u0441\u0435 \u043d\u0430\u0447\u0430\u0442\u044c \u0441\u043d\u0430\u0447\u0430\u043b\u0430, \u0438\u0431\u043e \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0435 \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435.<br \/>  \u0422\u0430\u043a\u0436\u0435 \u043d\u0435 \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d \u0441\u043b\u0443\u0447\u0430\u0439 \u0441\u0431\u043e\u044f \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u043f\u043e TWI. \u0422\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b TWI[i] \u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0435 \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u0447\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u0437\u0430\u043d\u043e\u0432\u043e. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0442\u0438\u043f\u0430 twi, \u0438 \u043f\u0435\u0440\u0435\u0434 \u043a\u0430\u0436\u0434\u044b\u043c \u0441\u0442\u0430\u0440\u0442\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 TWI[tail] \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u043d\u0435\u0435, \u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043f\u0443\u0441\u0442\u044c \u043f\u043e\u0440\u0442\u0438\u0442 \u043a\u043e\u043f\u0438\u044e. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0436\u0435 \u0441\u0431\u043e\u044f \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u0430.<\/p>\n<h4>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u041c\u043d\u043e\u0433\u0438\u0435 \u0441\u043f\u0440\u043e\u0441\u044f\u0442: \u00ab\u0417\u0430\u0447\u0435\u043c? \u0412\u0435\u0434\u044c \u0434\u043b\u044f \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f 16 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f 16*(1+2+1+2+1) = 112 \u0431\u0430\u0439\u0442 SRAM! \u041f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c RTOS? \u041f\u0443\u0441\u043a\u0430\u0439 \u043c\u043e\u043b \u0431\u0443\u0434\u0435\u0442 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0441 1 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c \u0438 \u0435\u0441\u043b\u0438 \u0432 \u043d\u0435\u0435 \u043d\u0435 \u0432\u043b\u0430\u0437\u0438\u0442, \u0441\u0442\u0430\u0432\u0438\u043c \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043d\u0430 n \u043c\u0441.\u00bb \u042f \u0441\u0447\u0438\u0442\u0430\u044e \u0447\u0442\u043e \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445. \u041f\u043e\u0434\u0443\u043c\u0430\u0439\u0442\u0435 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u0443\u0434\u0435\u0442 \u0434\u043b\u0438\u0442\u0441\u044f \u0442\u0430\u043a\u0430\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430? \u0415\u0441\u043b\u0438 \u043c\u044b \u0431\u0443\u0434\u0435\u0442 \u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u0442\u043e \u043a\u0430\u0436\u0434\u0430\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0431\u0443\u0434\u0435\u0442 \u0447\u0435\u0440\u0435\u0437 n \u043c\u0441, \u0430 \u0432\u0441\u044f \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 n*m \u043c\u0441. \u0414\u0430 \u0438 \u0437\u0430\u0447\u0435\u043c \u0437\u0430\u0431\u0438\u0432\u0430\u0442\u044c \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043d\u0435 \u043d\u0443\u0436\u043d\u044b\u043c\u0438 m \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c\u0438, \u0432\u0435\u0434\u044c \u0435\u0441\u0442\u044c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0443\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u0430\u0436\u043d\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443. \u0414\u0430 \u0438 \u044f\u0434\u0440\u043e \u041e\u0421 \u0440\u0430\u0437\u0433\u0440\u0443\u0436\u0430\u0435\u0442\u0441\u044f, \u043d\u0435 \u0441\u0442\u0430\u0432\u044f m*(m+1)\/2 \u0437\u0430\u0434\u0430\u0447 \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c. \t\t\t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/193456\/\"> http:\/\/habrahabr.ru\/post\/193456\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\"> \t\t\t\u0420\u0435\u0448\u0438\u043b \u043e\u0434\u043d\u0430\u0436\u0434\u044b \u0434\u043b\u044f \u0441\u0435\u0431\u044f \u044f \u0441\u043e\u043e\u0440\u0443\u0434\u0438\u0442\u044c \u043f\u043e\u0433\u043e\u0434\u043d\u0443\u044e \u0441\u0442\u0430\u043d\u0446\u0438\u044e. \u0414\u0430\u0442\u0447\u0438\u043a\u0438 \u0442\u0430\u043c \u0440\u0430\u0437\u043d\u044b\u0435, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u043d\u0430 \u0448\u0438\u043d\u0435 I2C. \u0418 \u043a\u0430\u043a \u0433\u043e\u0434\u0438\u0442\u0441\u044f, \u043e\u0431\u044b\u0447\u043d\u043e \u0432\u043d\u0430\u0447\u0430\u043b\u0435, \u0441\u0434\u0435\u043b\u0430\u043b \u0432\u0441\u0435 \u043d\u0430 \u0444\u043b\u0430\u0433\u0430\u0445 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f. \u041d\u043e \u043f\u0443\u0442\u044c \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0433\u043e \u0434\u0436\u0435\u0434\u0430\u044f \u0438\u043d\u043e\u0439, \u0438 \u0431\u044b\u043b\u043e \u0440\u0435\u0448\u0435\u043d\u043e \u0432\u0441\u0435 \u043f\u043e\u0432\u0435\u0441\u0438\u0442\u044c \u043d\u0430 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f. \u0412\u043e\u0442 \u0442\u0443\u0442 \u0438 \u043d\u0430\u0447\u0430\u043b\u0441\u044f \u0433\u0435\u043c\u043e\u0440\u0440\u043e\u0439. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u044f \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u044d\u0442\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u043e\u0434\u0440\u044f\u0434 \u0438\u0434\u0443\u0449\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u0430\u0442\u0447\u0438\u043a \u0434\u0430\u0432\u043b\u0435\u043d\u0438\u044f <a href=\"https:\/\/www.sparkfun.com\/datasheets\/Components\/General\/BST-BMP085-DS000-05.pdf\">BMP085<\/a> \u0434\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043d\u0438\u043c, \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0432\u044b\u0442\u044f\u043d\u0443\u0442\u044c \u0438\u0437 \u0435\u0433\u043e EEPROM 11 \u043a\u0430\u043b\u0438\u0431\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u0445 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\"  src=\"http:\/\/habrastorage.org\/storage3\/33b\/6f6\/b6f\/33b6f6b6f9354b2e85738a72aa27044d.png\"\/><\/div>\n<p>  \u041e \u0442\u043e\u043c \u043a\u0430\u043a \u044f \u043f\u0440\u0438\u0448\u0435\u043b \u043a \u0440\u0435\u0448\u0435\u043d\u0438\u044e \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0445\u043e\u0434\u0430 \u043c\u044b\u0441\u043b\u0435\u0439 \u0438\u0437\u043b\u043e\u0436\u0435\u043d\u044b \u043d\u0438\u0436\u0435.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-193456","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/193456","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=193456"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/193456\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=193456"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=193456"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=193456"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}