{"id":392,"date":"2017-04-29T20:26:49","date_gmt":"2017-04-29T18:26:49","guid":{"rendered":"http:\/\/www.maxx.net.ua\/?p=392"},"modified":"2017-04-29T20:26:49","modified_gmt":"2017-04-29T18:26:49","slug":"%d1%80%d0%be%d0%b7%d1%83%d0%bc%d0%bd%d0%b0-%d1%85%d0%b0%d1%82%d0%b8%d0%bd%d0%ba%d0%b0-openhab","status":"publish","type":"post","link":"https:\/\/www.maxx.net.ua\/?p=392","title":{"rendered":"\u0420\u043e\u0437\u0443\u043c\u043d\u0430 \u0445\u0430\u0442\u0438\u043d\u043a\u0430 &#8211; OpenHAB"},"content":{"rendered":"<p>\u0412\u0438\u043d\u0438\u043a\u043b\u0430 \u0432 \u043c\u0435\u043d\u0435 \u0456\u0434\u0435\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0443\u0432\u0430\u0442\u0438 \u043a\u0432\u0430\u0440\u0442\u0438\u0440\u0443. \u0412 \u0456\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0456 \u0454 \u0431\u0435\u0437\u043b\u0456\u0447 \u0433\u043e\u0442\u043e\u0432\u0438\u0445 \u0432\u0430\u0440\u0456\u0430\u043d\u0442\u0456\u0432\u044e \u0414\u0443\u0436\u0435 \u0433\u0430\u0440\u043d\u0438\u0439 \u043f\u0435\u0440\u0435\u043b\u0456\u043a \u0432\u0438 \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u043d\u0430\u0439\u0442\u0438 \u0437\u0430 <a href=\"https:\/\/www.mysensors.org\/controller\">\u0446\u0438\u043c<\/a> \u043f\u043e\u0441\u0438\u043b\u0430\u043d\u043d\u044f\u043c.<\/p>\n<p>\u0423 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c\u0443 \u0432\u0430\u0440\u0456\u0430\u043d\u0442\u0456 \u043c\u0438 \u0437\u0440\u043e\u0431\u0438\u043c\u043e \u0432\u043c\u0438\u043a\u0430\u043d\u043d\u044f \u0432\u0438\u043c\u0438\u043a\u0430\u043d\u043d\u044f \u0441\u0432\u0456\u0442\u043b\u043e\u0434\u0456\u043e\u0434\u0430, \u0442\u0430 \u043e\u0442\u0440\u0438\u043c\u0430\u043d\u043d\u044f \u0440\u0456\u0432\u043d\u044f \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0438 \u0442\u0430 \u0432\u043e\u043b\u043e\u0433\u043e\u0441\u0442\u0456. \u0423 \u044f\u043a\u043e\u0441\u0442\u0456 \u044f\u0434\u0440\u0430 \u0440\u043e\u0437\u0443\u043c\u043d\u043e\u0457 \u0445\u0430\u0442\u0438\u043d\u043a\u0438 \u0431\u0443\u0434\u0435\u043c\u043e \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u0432\u0430\u0442\u0438 OpenHAB, \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u043e\u0431\u043c\u0456\u043d\u0443 &#8211; ModBus. \u041f\u043e\u0432\u043d\u0430 \u0441\u0445\u0435\u043c\u0430 \u0431\u0443\u0434\u0435 \u0432\u0438\u0433\u043b\u044f\u0434\u0430\u0442\u0438 \u0442\u0430\u043a:<\/p>\n<p><a href=\"http:\/\/www.maxx.net.ua\/wp-content\/uploads\/2017\/04\/18118905_1325028200915986_3029432273984370340_n.jpg\"><img loading=\"lazy\" class=\"aligncenter wp-image-396 size-full\" src=\"http:\/\/www.maxx.net.ua\/wp-content\/uploads\/2017\/04\/18118905_1325028200915986_3029432273984370340_n.jpg\" alt=\"\" width=\"751\" height=\"272\" srcset=\"https:\/\/www.maxx.net.ua\/wp-content\/uploads\/2017\/04\/18118905_1325028200915986_3029432273984370340_n.jpg 751w, https:\/\/www.maxx.net.ua\/wp-content\/uploads\/2017\/04\/18118905_1325028200915986_3029432273984370340_n-300x109.jpg 300w\" sizes=\"(max-width: 751px) 100vw, 751px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>\u0414\u043b\u044f \u043f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u043d\u044f \u0432\u0441\u044c\u043e\u0433\u043e, \u043f\u0440\u043e \u0449\u043e \u043f\u0456\u0434\u0435 \u043c\u043e\u0432\u0430 \u0434\u0430\u043b\u0456 \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u0456\u0434\u043d\u043e \u043c\u0430\u0442\u0438:<\/p>\n<p>\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043d\u0435 \u0437\u0430\u0431\u0435\u0437\u043f\u0435\u0447\u0435\u043d\u043d\u044f<\/p>\n<ul>\n<li><a href=\"http:\/\/www.atmel.com\/tools\/atmelstudio.aspx\">AtmelStudio<\/a>, WinAVR \u0447\u0438 \u0449\u043e\u0441\u044c \u0456\u043d\u0448\u0435, \u0449\u043e \u043d\u0430\u0434\u0430\u0454 \u043c\u043e\u0436\u043b\u0438\u0432\u0456\u0441\u0442\u044c \u043a\u043e\u043c\u043f\u0456\u043b\u044e\u0432\u0430\u0442\u0438 \u0441 \u043a\u043e\u0434 \u0434\u043b\u044f \u043c\u0456\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0435\u0440\u0456\u0432 Atmel (\u044f \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u0432\u0430\u0432 WinAVR-20100110)<\/li>\n<li><a href=\"http:\/\/www.openhab.org\/downloads.html\">OpenHAB<\/a><\/li>\n<\/ul>\n<p>\u0410\u043f\u0430\u0440\u0430\u0442\u043d\u0435 \u0437\u0430\u0431\u0435\u0437\u043f\u0435\u0447\u0435\u043d\u043d\u044f<\/p>\n<ul>\n<li>\u0411\u0443\u0434\u044c-\u0449\u043e \u0437 \u043f\u0456\u0434\u0442\u0440\u0438\u043c\u043a\u043e\u044e java<\/li>\n<li><a href=\"https:\/\/www.aliexpress.com\/item\/USBasp-USB-ISP-3-3V-5V-AVR-Programmer-USB-ATMEGA8-ATMEGA128-New-10PIN-Wire-Support-Win7\/32578298532.html https:\/\/www.aliexpress.com\/item\/USB-to-Serial-RS232-UART-TTL-RS485-DB9-Adapter-Converter-Module-FTDI-FT232BM-BL\/32638082686.html\">USB to RS2485 converter <\/a><\/li>\n<li><a href=\"https:\/\/www.aliexpress.com\/item\/USBasp-USB-ISP-3-3V-5V-AVR-Programmer-USB-ATMEGA8-ATMEGA128-New-10PIN-Wire-Support-Win7\/32578298532.html https:\/\/www.aliexpress.com\/item\/USB-to-Serial-RS232-UART-TTL-RS485-DB9-Adapter-Converter-Module-FTDI-FT232BM-BL\/32638082686.html\">AVR \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u0430\u0442\u043e\u0440 <\/a><\/li>\n<li>AT90S8515 (\u0432\u0438 \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u0432\u0430\u0442\u0438 \u0431\u0443\u0434\u044c \u044f\u043a\u0438\u0439 \u0456\u043d\u0448\u0438\u0439, \u0432 \u043c\u0435\u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0454 \u043a\u0443\u043f\u0430 \u0442\u0430\u043a\u0438\u0445)<\/li>\n<li>\u043a\u0456\u043b\u044c\u043a\u0430 \u0440\u0435\u0437\u0438\u0441\u0442\u043e\u0440\u0456\u0432 4\u041a7<\/li>\n<li>\u043a\u043d\u043e\u043f\u043a\u0430<\/li>\n<li>\u0441\u0432\u0456\u0442\u043b\u043e\u0434\u0456\u043e\u0434<\/li>\n<li>\u043c\u043e\u043d\u0442\u0430\u0436\u043d\u0430 \u043f\u043b\u0430\u0442\u0430<\/li>\n<\/ul>\n<ol>\n<li>\n<h1>\u0412\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044f \u0442\u0430 \u043a\u043e\u043d\u0444\u0456\u0433\u0443\u0440\u0430\u0446\u0456\u044f OpenHAB<\/h1>\n<\/li>\n<\/ol>\n<p>\u0414\u043b\u044f \u0432\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044f OpenHAB \u0439\u043e\u0433\u043e \u0442\u0440\u0435\u0431\u0430 \u0441\u043a\u0430\u0447\u0430\u0442\u0438 \u0442\u0430 \u0440\u043e\u0437\u043f\u0430\u043a\u0443\u0432\u0430\u0442\u0438. \u041d\u0430 \u0446\u044c\u043e\u043c\u0443 \u0456\u043d\u0441\u0442\u0430\u043b\u044f\u0446\u0456\u044f \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0430 \u0442\u0430 \u043c\u043e\u0436\u043d\u0430 \u043f\u043e\u0447\u0438\u043d\u0430\u0442\u0438 \u0439\u043e\u0433\u043e \u043a\u043e\u043d\u0444\u0456\u0433\u0443\u0440\u0443\u0432\u0430\u0442\u0438.<\/p>\n<p>\u041a\u043e\u043d\u0444\u0456\u0433\u0443\u0440\u0443\u0432\u0430\u043d\u043d\u044f\u00a0\u0440\u043e\u0437\u0448\u0438\u0440\u0435\u043d\u043d\u044f Modbus<\/p>\n<p>\u0414\u043b\u044f \u0446\u044c\u043e\u0433\u043e \u0442\u0440\u0435\u0431\u0430 \u0441\u0442\u0432\u043e\u0440\u0438\u0442\u0438 \u0444\u0430\u0439\u043b conf\/services\/<span class=\"file-name\">modbus.cfg<\/span><\/p>\n<pre title=\"conf\/services\/modbus.cfg \" class=\"lang:default decode:true\">#LEDS on Device 2\nmodbus:serial.slave5.connection=COM3:115200:8:none:1:rtu:35:2000:none:none\nmodbus:serial.slave5.id=2\nmodbus:serial.slave5.start=0\nmodbus:serial.slave5.length=8\nmodbus:serial.slave5.type=coil\n\n#BUTTONS on Device 2\nmodbus:serial.slave6.connection=COM3:115200:8:none:1:rtu:35:2000:none:none\nmodbus:serial.slave6.id=2\nmodbus:serial.slave6.start=0\nmodbus:serial.slave6.length=8\nmodbus:serial.slave6.type=discrete<\/pre>\n<p>\u0423 \u043c\u043e\u0454\u043c\u0443 \u0432\u0438\u043f\u0430\u0434\u043a\u0443 AVR\u00a0\u0431\u0443\u043b\u043e \u043f\u0456\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043e \u0434\u043e \u043f\u043e\u0440\u0442\u0430\u00a0COM3<\/p>\n<p>\u0421\u0442\u0432\u043e\u0440\u044e\u0454\u043c\u043e items.<\/p>\n<p>\u0414\u043b\u044f \u0446\u044c\u043e\u0433\u043e \u0442\u0440\u0435\u0431\u0430 \u0441\u0442\u0432\u043e\u0440\u0438\u0442\u0438 \u0444\u0430\u0439\u043b \u00a0conf\/items\/<span class=\"file-name\">modbus.items<\/span><\/p>\n<pre class=\"lang:default decode:true\">Group  ROOM1\n\nContact ROOM1_SW_LIGHT_BTN_2 \"Light Button 2\" (ROOM1) {modbus=\"slave6:1\"}\n\nSwitch ROOM1_SW_LIGHT_LAMP_2 \"\u0421\u0432\u0456\u0442\u043b\u043e 2\" &lt;light&gt; (ROOM1) {modbus=\"slave5:2\"}\n<\/pre>\n<p>\u0421\u0442\u0432\u043e\u0440\u044e\u0454\u043c\u043e sitemap<\/p>\n<pre title=\"conf\/sitemaps\/test.sitemap \" class=\"lang:default decode:true\">sitemap test label=\"\u041c\u0456\u0439 \u0434\u0456\u043c\" {\n\tFrame label=\"\u041a\u043e\u043c\u043d\u0430\u0442\u0430 1\" {\n\t\tSwitch item=ROOM1_SW_LIGHT_LAMP_2\n\n\t}\n\n}<\/pre>\n<p>\u041f\u0456\u0441\u043b\u044f \u0446\u044c\u043e\u0433\u043e \u0442\u0440\u0435\u0431\u0430 \u0441\u043a\u043e\u043d\u0444\u0456\u0433\u043e\u0440\u0443\u0432\u0430\u0442\u0438 Classic-UI<\/p>\n<p><a href=\"http:\/\/www.maxx.net.ua\/wp-content\/uploads\/2017\/04\/openhab-classic-ui.png\"><img loading=\"lazy\" class=\"aligncenter wp-image-401 size-medium\" src=\"http:\/\/www.maxx.net.ua\/wp-content\/uploads\/2017\/04\/openhab-classic-ui-300x180.png\" alt=\"\" width=\"300\" height=\"180\" srcset=\"https:\/\/www.maxx.net.ua\/wp-content\/uploads\/2017\/04\/openhab-classic-ui-300x180.png 300w, https:\/\/www.maxx.net.ua\/wp-content\/uploads\/2017\/04\/openhab-classic-ui-768x462.png 768w, https:\/\/www.maxx.net.ua\/wp-content\/uploads\/2017\/04\/openhab-classic-ui-1024x616.png 1024w, https:\/\/www.maxx.net.ua\/wp-content\/uploads\/2017\/04\/openhab-classic-ui.png 1199w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>\u0421\u0442\u0432\u043e\u0440\u044e\u0454\u043c\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0449\u043e\u0431 \u043e\u0431\u0440\u043e\u0431\u043b\u044f\u0442\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0438 \u0432\u0456\u0434 \u043a\u043d\u043e\u043f\u043a\u0438<\/p>\n<pre class=\"lang:default decode:true\">rule \"Light room 2 ON\"\nwhen\n  Item ROOM1_SW_LIGHT_BTN_2 changed from OPEN to CLOSED\nthen\n    if (ROOM2_SW_LIGHT_LAMP_2.state!=ON)      \n        ROOM1_SW_LIGHT_LAMP_2.sendCommand(ON)\n    else\n        ROOM2_SW_LIGHT_LAMP_2.sendCommand(OFF)\nend\n<\/pre>\n<p>&nbsp;<\/p>\n<h1>2. \u0421\u0442\u0432\u043e\u0440\u044e\u0454\u043c\u043e \u0430\u043f\u0430\u0440\u0430\u0442\u043d\u0443 \u0447\u0430\u0441\u0442\u0438\u043d\u0443.<\/h1>\n<p>\u041f\u0440\u0438\u043d\u0446\u0438\u043f\u043e\u0432\u0430 \u0441\u0445\u0435\u043c\u0430<\/p>\n<p><a href=\"http:\/\/www.maxx.net.ua\/wp-content\/uploads\/2017\/04\/slave-8515.png\"><img loading=\"lazy\" class=\"aligncenter wp-image-394 size-full\" src=\"http:\/\/www.maxx.net.ua\/wp-content\/uploads\/2017\/04\/slave-8515.png\" alt=\"\" width=\"778\" height=\"424\" srcset=\"https:\/\/www.maxx.net.ua\/wp-content\/uploads\/2017\/04\/slave-8515.png 778w, https:\/\/www.maxx.net.ua\/wp-content\/uploads\/2017\/04\/slave-8515-300x163.png 300w, https:\/\/www.maxx.net.ua\/wp-content\/uploads\/2017\/04\/slave-8515-768x419.png 768w\" sizes=\"(max-width: 778px) 100vw, 778px\" \/><\/a><\/p>\n<p>\u041f\u043e\u0432\u0438\u043d\u043d\u043e \u0432\u0438\u0439\u0442\u0438 \u0449\u043e\u0441\u044c \u0442\u0430\u043a\u0435:<\/p>\n<p><a href=\"http:\/\/www.maxx.net.ua\/wp-content\/uploads\/2017\/04\/WP_20170429_18_54_06_Pro.jpg\"><img loading=\"lazy\" class=\"aligncenter wp-image-395 size-medium\" src=\"http:\/\/www.maxx.net.ua\/wp-content\/uploads\/2017\/04\/WP_20170429_18_54_06_Pro-300x169.jpg\" alt=\"\" width=\"300\" height=\"169\" srcset=\"https:\/\/www.maxx.net.ua\/wp-content\/uploads\/2017\/04\/WP_20170429_18_54_06_Pro-300x169.jpg 300w, https:\/\/www.maxx.net.ua\/wp-content\/uploads\/2017\/04\/WP_20170429_18_54_06_Pro-768x432.jpg 768w, https:\/\/www.maxx.net.ua\/wp-content\/uploads\/2017\/04\/WP_20170429_18_54_06_Pro.jpg 800w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<h2>3. \u041a\u043e\u043c\u043f\u0456\u043b\u044e\u0454\u043c\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u0443<\/h2>\n<pre class=\"toolbar:1 toolbar-overlay:true minimize:true lang:c++ decode:true\"> \n#define clientAddress 0x02\n\n#include &lt;avr\/io.h&gt;\n#include &lt;avr\/interrupt.h&gt;\n#include &lt;avr\/wdt.h&gt;\n#include \"yaMBSiavr.h\"\n\n#define LIGHLCD PC7\n#define LIGHLCDDDR DDRC\n#define LIGHLCDPORT PORTC\n\n\nvolatile uint8_t instate = 0;\nvolatile uint8_t outstate = 0;\nvolatile uint16_t inputRegisters[4];\nvolatile uint16_t holdingRegisters[4];\n\nvoid timer0100us_start(void) {\n\tTCCR0|=(1&lt;&lt;CS01); \/\/prescaler 8\n\tTIMSK|=(1&lt;&lt;TOIE0);\n}\n\n\/*\n*   Modify the following 3 functions to implement your own pin configurations...\n*\/\nvoid SetOuts(volatile uint8_t in) {\n\tPORTD|= (((in &amp; (1&lt;&lt;3))&lt;&lt;4) | ((in &amp; (1&lt;&lt;4))&lt;&lt;1) | ((in &amp; (1&lt;&lt;5))&lt;&lt;1));\n\tPORTB|= (((in &amp; (1&lt;&lt;0))&lt;&lt;2) | ((in &amp; (1&lt;&lt;1))) | ((in &amp; (1&lt;&lt;2))&gt;&gt;2));\n\tin=~in;\n\tPORTB&amp;= ~(((in &amp; (1&lt;&lt;0))&lt;&lt;2) | ((in &amp; (1&lt;&lt;1))) | ((in &amp; (1&lt;&lt;2))&gt;&gt;2));\n\tPORTD&amp;= ~(((in &amp; (1&lt;&lt;3))&lt;&lt;4) | ((in &amp; (1&lt;&lt;4))&lt;&lt;1) | ((in &amp; (1&lt;&lt;5))&lt;&lt;1));\n}\n\nuint8_t ReadIns(void) {\n\tuint8_t ins=0x00;\n\tins|=(PINC&amp;((1&lt;&lt;0)|(1&lt;&lt;1)|(1&lt;&lt;2)|(1&lt;&lt;3)|(1&lt;&lt;4)|(1&lt;&lt;5)));\n\tins|=(((PIND&amp;(1&lt;&lt;4))&lt;&lt;2)|((PIND&amp;(1&lt;&lt;3))&lt;&lt;4));\n\treturn ins;\n}\n\nvoid io_conf(void) { \n\t\/*\n\t Outputs: PB2,PB1,PB0,PD7,PD5,PD6\n\t Inputs: PC0, PC1, PC2, PC3, PC4, PC6, PD4, PD3\n\t*\/\n\tDDRD=0x00;\n\tDDRB=0x00;\n\tDDRC=0x00;\n\tPORTD=0x00;\n\tPORTB=0x00;\n\tPORTC=0x00;\n\tPORTD|=(1&lt;&lt;0);\n\tDDRD |= (1&lt;&lt;2)|(1&lt;&lt;5)|(1&lt;&lt;6)|(1&lt;&lt;7);\n\tDDRB |= (1&lt;&lt;0)|(1&lt;&lt;1)|(1&lt;&lt;2)|(1&lt;&lt;3);\n\n\t\/\/ set ports as output\n\tLIGHLCDDDR |= (1&lt;&lt;LIGHLCD);\n\n}\n\nISR(SIG_OVERFLOW0) { \/\/this ISR is called 9765.625 times per second\n\tmodbusTickTimer();\n}\n\nvoid modbusGet(void) {\n\tif (modbusGetBusState() &amp; (1&lt;&lt;ReceiveCompleted))\n\t{\n\t\tLIGHLCDPORT |= _BV(LIGHLCD);\n\t\t\/\/PUMPPORT &amp;= ~_BV(PUMP);\n\t\tswitch(rxbuffer[1]) {\n\t\t\tcase fcReadCoilStatus: {\n\t\t\t\tmodbusExchangeBits(&amp;outstate,0,8);\n\t\t\t}\n\t\t\tbreak;\n\t\t\t\n\t\t\tcase fcReadInputStatus: {\n\t\t\t\tvolatile uint8_t inps = ReadIns();\n\t\t\t\tmodbusExchangeBits(&amp;inps,0,8);\n\t\t\t}\n\t\t\tbreak;\n\t\t\t\n\t\t\tcase fcReadHoldingRegisters: {\n\t\t\t\tmodbusExchangeRegisters(holdingRegisters,0,4);\n\t\t\t}\n\t\t\tbreak;\n\t\t\t\n\t\t\tcase fcReadInputRegisters: {\n\t\t\t\tmodbusExchangeRegisters(inputRegisters,0,4);\n\t\t\t}\n\t\t\tbreak;\n\t\t\t\n\t\t\tcase fcForceSingleCoil: {\n\t\t\t\tmodbusExchangeBits(&amp;outstate,0,8);\n\t\t\t\tSetOuts(outstate);\n\t\t\t}\n\t\t\tbreak;\n\t\t\t\n\t\t\tcase fcPresetSingleRegister: {\n\t\t\t\tmodbusExchangeRegisters(holdingRegisters,0,4);\n\t\t\t}\n\t\t\tbreak;\n\t\t\t\n\t\t\tcase fcForceMultipleCoils: {\n\t\t\t\tmodbusExchangeBits(&amp;outstate,0,8);\n\t\t\t\tSetOuts(outstate);\n\t\t\t}\n\t\t\tbreak;\n\t\t\t\n\t\t\tcase fcPresetMultipleRegisters: {\n\t\t\t\tmodbusExchangeRegisters(holdingRegisters,0,4);\n\t\t\t}\n\t\t\tbreak;\n\t\t\t\n\t\t\tdefault: {\n\t\t\t\tmodbusSendException(ecIllegalFunction);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t}\n}\n\nint main(void)\n{\n\tio_conf();\n\tsei();\n\tmodbusSetAddress(clientAddress);\n\tmodbusInit();\n    wdt_enable(7);\n\ttimer0100us_start();\n\n\tholdingRegisters[0] = 0x0A;\n\tholdingRegisters[1] = 0x0B;\n\tholdingRegisters[2] = 0x0C;\n\tholdingRegisters[3] = 0x0D;\n    while(1)\n    {\n\t\twdt_reset();\n\t    modbusGet();\n    }\n}\n<\/pre>\n<p>\u0414\u043b\u044f \u043a\u043e\u043c\u043f\u0456\u043b\u044e\u0432\u0430\u043d\u043d\u044f \u0432\u0430\u043c \u0431\u0443\u0434\u0435 \u043f\u043e\u0442\u0440\u0456\u0431\u043d\u0430 <a href=\"https:\/\/github.com\/mbs38\/yaMBSiavr\">\u0431\u0456\u0431\u043b\u0456\u043e\u0442\u0435\u043a\u0430 ModBus<\/a>.<\/p>\n<p>\u041f\u0456\u0441\u043b\u044f \u043a\u043e\u043c\u043f\u0456\u043b\u044f\u0446\u0456\u0457 \u043f\u0440\u043e\u0448\u0438\u0432\u0430\u0454\u043c\u043e \u043c\u0456\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0435\u0440, \u0442\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0454\u043c\u043e \u0443\u0441\u0435. \u041f\u043e\u0432\u0438\u043d\u043d\u043e \u0432\u0438\u0439\u0442\u0438 \u0449\u043e\u0441\u044c \u0442\u0430\u043a\u0435:<\/p>\n<p><iframe loading=\"lazy\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/4Z8XbOWlvRI?feature=oembed\" frameborder=\"0\" allowfullscreen><\/iframe><\/p>\n<p>\u042f\u043a\u0449\u043e \u0449\u043e\u0441\u044c \u043d\u0435 \u043f\u0440\u0430\u0446\u044e\u0454 \u0432\u0430\u043c \u043c\u043e\u0436\u0435 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u0442\u0438<\/p>\n<p><a href=\"http:\/\/qmodbus.sourceforge.net\/\">QModBus<\/a> &#8211; \u0434\u043e\u0434\u0430\u0442\u043e\u043a \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0443\u0432\u0430\u043d\u043d\u044f \u0440\u043e\u0431\u043e\u0442\u0438 \u0448\u0438\u043d\u0438. \u0414\u043e\u0437\u0432\u043e\u043b\u044f\u0454 \u043d\u0430\u0434\u0441\u0438\u043b\u0430\u0442\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0438 \u043f\u0440\u0438\u0441\u0442\u0440\u043e\u044f\u043c \u0442\u0430 \u0434\u0438\u0432\u0438\u0442\u0438\u0441\u044c \u0432\u0456\u0434\u043f\u043e\u0432\u0456\u0434\u0456.<\/p>\n<p>\u041f\u0456\u0441\u043b\u044f \u043c\u0456\u0433\u0440\u0430\u0446\u0456\u0457 \u0432\u0441\u044c\u043e\u0433\u043e \u043d\u0430 Raspberry Pi \u043c\u043e\u0436\u043d\u0430 \u043e\u0442\u0440\u0438\u043c\u0430\u0442\u0438 \u0442\u0430\u043a\u0443 \u043a\u043e\u043d\u0444\u0456\u0433\u0443\u0440\u0430\u0446\u0456\u044e:<\/p>\n<p><a href=\"http:\/\/www.maxx.net.ua\/wp-content\/uploads\/2017\/04\/WP_20170429_23_31_07_Pro.jpg\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" class=\"alignnone wp-image-403 size-medium\" src=\"http:\/\/www.maxx.net.ua\/wp-content\/uploads\/2017\/04\/WP_20170429_23_31_07_Pro-300x169.jpg\" alt=\"\" width=\"300\" height=\"169\" srcset=\"https:\/\/www.maxx.net.ua\/wp-content\/uploads\/2017\/04\/WP_20170429_23_31_07_Pro-300x169.jpg 300w, https:\/\/www.maxx.net.ua\/wp-content\/uploads\/2017\/04\/WP_20170429_23_31_07_Pro-768x432.jpg 768w, https:\/\/www.maxx.net.ua\/wp-content\/uploads\/2017\/04\/WP_20170429_23_31_07_Pro-1024x576.jpg 1024w, https:\/\/www.maxx.net.ua\/wp-content\/uploads\/2017\/04\/WP_20170429_23_31_07_Pro-1568x882.jpg 1568w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><img loading=\"lazy\" class=\"alignleft size-medium wp-image-404\" src=\"http:\/\/www.maxx.net.ua\/wp-content\/uploads\/2017\/04\/screen-300x194.png\" alt=\"\" width=\"300\" height=\"194\" srcset=\"https:\/\/www.maxx.net.ua\/wp-content\/uploads\/2017\/04\/screen-300x194.png 300w, https:\/\/www.maxx.net.ua\/wp-content\/uploads\/2017\/04\/screen-768x497.png 768w, https:\/\/www.maxx.net.ua\/wp-content\/uploads\/2017\/04\/screen.png 801w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/>2 \u043f\u0440\u0438\u0441\u0442\u0440\u043e\u044f \u043d\u0430 \u0448\u0438\u043d\u0456 ModBus, OpenHAB \u043d\u0430 Rasbrerry Pi.<\/p>\n<p>\u041e\u0434\u0438\u043d \u043c\u0430\u0454 \u0434\u0430\u0442\u0447\u0438\u043a \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0438 \u0442\u0430 \u0432\u043e\u043b\u043e\u0433\u043e\u0441\u0442\u0456, \u043b\u0430\u043c\u043f\u0443 \u0442\u0430\u00a0\u043a\u043d\u043e\u043f\u043a\u0443. \u0406\u043d\u0448\u0438\u0439 \u043c\u0430\u0454 \u0442\u0456\u043b\u044c\u043a\u0438 \u043a\u043d\u043e\u043f\u043a\u0443 \u0442\u0430 \u043b\u0430\u043c\u043f\u0443.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0412\u0438\u043d\u0438\u043a\u043b\u0430 \u0432 \u043c\u0435\u043d\u0435 \u0456\u0434\u0435\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0443\u0432\u0430\u0442\u0438 \u043a\u0432\u0430\u0440\u0442\u0438\u0440\u0443. \u0412 \u0456\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0456 \u0454 \u0431\u0435\u0437\u043b\u0456\u0447 \u0433\u043e\u0442\u043e\u0432\u0438\u0445 \u0432\u0430\u0440\u0456\u0430\u043d\u0442\u0456\u0432\u044e \u0414\u0443\u0436\u0435 \u0433\u0430\u0440\u043d\u0438\u0439 \u043f\u0435\u0440\u0435\u043b\u0456\u043a \u0432\u0438 \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u043d\u0430\u0439\u0442\u0438 \u0437\u0430 \u0446\u0438\u043c \u043f\u043e\u0441\u0438\u043b\u0430\u043d\u043d\u044f\u043c. \u0423 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c\u0443 \u0432\u0430\u0440\u0456\u0430\u043d\u0442\u0456 \u043c\u0438 \u0437\u0440\u043e\u0431\u0438\u043c\u043e \u0432\u043c\u0438\u043a\u0430\u043d\u043d\u044f \u0432\u0438\u043c\u0438\u043a\u0430\u043d\u043d\u044f \u0441\u0432\u0456\u0442\u043b\u043e\u0434\u0456\u043e\u0434\u0430, \u0442\u0430 \u043e\u0442\u0440\u0438\u043c\u0430\u043d\u043d\u044f \u0440\u0456\u0432\u043d\u044f \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0438 \u0442\u0430 \u0432\u043e\u043b\u043e\u0433\u043e\u0441\u0442\u0456. \u0423 \u044f\u043a\u043e\u0441\u0442\u0456 \u044f\u0434\u0440\u0430 \u0440\u043e\u0437\u0443\u043c\u043d\u043e\u0457 \u0445\u0430\u0442\u0438\u043d\u043a\u0438 \u0431\u0443\u0434\u0435\u043c\u043e \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u0432\u0430\u0442\u0438 OpenHAB, \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u043e\u0431\u043c\u0456\u043d\u0443 &#8211; ModBus. \u041f\u043e\u0432\u043d\u0430 \u0441\u0445\u0435\u043c\u0430 \u0431\u0443\u0434\u0435 \u0432\u0438\u0433\u043b\u044f\u0434\u0430\u0442\u0438 \u0442\u0430\u043a: &nbsp; \u0414\u043b\u044f \u043f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u043d\u044f [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[6],"tags":[],"_links":{"self":[{"href":"https:\/\/www.maxx.net.ua\/index.php?rest_route=\/wp\/v2\/posts\/392"}],"collection":[{"href":"https:\/\/www.maxx.net.ua\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.maxx.net.ua\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.maxx.net.ua\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.maxx.net.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=392"}],"version-history":[{"count":0,"href":"https:\/\/www.maxx.net.ua\/index.php?rest_route=\/wp\/v2\/posts\/392\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.maxx.net.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=392"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.maxx.net.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=392"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.maxx.net.ua\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=392"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}