{"id":277582,"date":"2016-04-04T11:49:01","date_gmt":"2016-04-04T07:49:01","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=277582"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=277582","title":{"rendered":"\u041a\u0430\u043a \u044f \u043f\u0438\u0441\u0430\u043b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u043f\u043e\u0434 \u041c\u042d\u041a 870-5-104 \u043d\u0430 Arduino \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 Wireshark"},"content":{"rendered":"<p>       \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e \u0441\u0432\u043e\u0435\u043c \u0437\u043d\u0430\u043a\u043e\u043c\u0441\u0442\u0432\u0435 \u0441 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u041c\u042d\u041a 870-5-104 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u0435\u043c\u043e\u0433\u043e (slave) \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u043f\u0443\u0442\u0435\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043d\u0430 Arduino.<\/p>\n<h2>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u041c\u042d\u041a 870-5-104 \u044d\u0442\u043e \u0438 \u0433\u0434\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f?<\/h2>\n<p>  \u041c\u042d\u041a 60870-5-104 \u2013 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u0442\u0435\u043b\u0435\u043c\u0435\u0445\u0430\u043d\u0438\u043a\u0438, \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0439 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432 \u0422\u041c \u0432 \u0410\u0421\u0422\u0423, \u0440\u0435\u0433\u043b\u0430\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0435\u0442\u0435\u0432\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043f\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0443 TCP\/IP. \u0427\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u044d\u043d\u0435\u0440\u0433\u0435\u0442\u0438\u043a\u0435 \u0434\u043b\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u043c\u0435\u043d\u0430 \u043c\u0435\u0436\u0434\u0443 \u044d\u043d\u0435\u0440\u0433\u043e\u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0442 \u0438\u0437\u043c\u0435\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 (\u0432\u043e\u043b\u044c\u0442\u043c\u0435\u0442\u0440\u044b, \u0441\u0447\u0435\u0442\u0447\u0438\u043a\u0438 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u044d\u043d\u0435\u0440\u0433\u0438\u0438 \u0438 \u043f\u0440\u043e\u0447\u0435\u0435).<\/p>\n<p>  \u0421\u0442\u044d\u043a \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 \u041c\u042d\u041a 670-5-104:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/55d\/e9f\/d32\/55de9fd3250e425eb990bd24f0a95c61.jpg\"\/><br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h2>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b<\/h2>\n<p>  <\/p>\n<ul>\n<li>\u043f\u043b\u0430\u0442\u0430 Arduino UNO;<\/li>\n<li>Ethernet shield (HR911105a);<\/li>\n<li>\u0432 \u0440\u043e\u043b\u0438 \u043c\u0430\u0441\u0442\u0435\u0440\u0430 \u041c\u042d\u041a 60870-5-104 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u0442\u044c MicroScada \u043e\u0442 ABB;<\/li>\n<li>Wireshark \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0442\u0440\u0430\u0444\u0438\u043a\u0430.<\/li>\n<\/ul>\n<h2>\u041a\u0440\u0430\u0442\u043a\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u044d\u0442\u0430\u043f\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u044b<\/h2>\n<p>  <\/p>\n<ol>\n<li>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 TCP\/IP \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043f\u043e 2404 \u043f\u043e\u0440\u0442\u0443; <\/li>\n<li>\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043d\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 (STARTDT act\/con);<\/li>\n<li>\u0417\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u043e\u0431\u0449\u0438\u0439 \u043e\u043f\u0440\u043e\u0441 \u0441\u0442\u0430\u043d\u0446\u0438\u0438;<\/li>\n<li>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u044e\u0449\u0435\u0439 (master) \u0441\u0442\u0430\u043d\u0446\u0438\u0438;<\/li>\n<li>\u041f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/li>\n<\/ol>\n<p>  <\/p>\n<h2>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430<\/h2>\n<p>  <\/p>\n<ul>\n<li>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0430 \u043f\u043b\u0430\u0442\u0430 Arduino \u043a \u041f\u041a;<\/li>\n<li>\u041d\u0430\u0441\u0442\u0440\u043e\u0435\u043d \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441;<\/li>\n<li>\u041d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u044e\u0449\u0430\u044f (master) \u0441\u0442\u0430\u043d\u0446\u0438\u044f (\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 104 \u043b\u0438\u043d\u0438\u044f \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u0435\u043c\u043e\u0435 (slave) \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e).<\/li>\n<\/ul>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/7c7\/57a\/7e9\/7c757a7e90224906861affb7729a845b.jpg\"\/><\/p>\n<h2>\u0422\u0435\u0440\u043c\u0438\u043d\u044b \u0438 \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u0438\u044f<\/h2>\n<p>  <b>APCI<\/b> \u2014 \u0423\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0430\u044f \u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u041f\u0440\u0438\u043a\u043b\u0430\u0434\u043d\u043e\u0433\u043e \u0423\u0440\u043e\u0432\u043d\u044f \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u043a\u0430\u043a \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u043a\u0430\u0434\u0440 (\u043a\u0430\u0434\u0440 U \u0438\u043b\u0438 \u043a\u0430\u0434\u0440 S).<br \/>  <b>ASDU<\/b> \u2014 \u0411\u043b\u043e\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043a\u043b\u0430\u0434\u043d\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f, \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u0431\u043b\u043e\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u043b\u0438 \u0431\u043e\u043b\u0435\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f \u043e\u0434\u0438\u043d \u0438\u043b\u0438 \u0431\u043e\u043b\u0435\u0435 \u043e\u0434\u043d\u043e\u0440\u043e\u0434\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 (\u043b\u0438\u0431\u043e \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438).<br \/>  <b>APDU<\/b> \u2014 \u041f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044c\u043d\u044b\u0439 \u0431\u043b\u043e\u043a \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043a\u043b\u0430\u0434\u043d\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f.<br \/>  <b>\u0422\u0421<\/b> \u2014 \u0442\u0435\u043b\u0435\u0441\u0438\u0433\u043d\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f.<br \/>  <b>\u0422\u0418<\/b> \u2014 \u0442\u0435\u043b\u0435\u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f.<br \/>  <b>\u0422\u0423<\/b> \u2014 \u0442\u0435\u043b\u0435\u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435.<\/p>\n<h2>1. \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 TCP\/IP \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u0440\u0442 2404<\/h2>\n<p>  \u041a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u044e\u0449\u0430\u044f (master) \u0441\u0442\u0430\u043d\u0446\u0438\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 TCP \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043f\u0443\u0442\u0435\u043c \u043f\u043e\u0441\u044b\u043b\u043a\u0438 TCP \u043f\u0430\u043a\u0435\u0442\u0430 \u0441 \u0444\u043b\u0430\u0433\u043e\u043c (SYS). \u0421\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u043c, \u0435\u0441\u043b\u0438 \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 (t0) \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u0435\u043c\u0430\u044f \u0441\u0442\u0430\u043d\u0446\u0438\u044f (slave) \u0432\u044b\u0434\u0430\u043b\u0430 \u043d\u0430 \u0441\u0432\u043e\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c TCP\/IP \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u00ab\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f\u00bb (SYS ACK). \u041a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f t0 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u00ab\u0422\u0430\u0439\u043c-\u0430\u0443\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f\u00bb. \u0422\u0430\u0439\u043c\u0435\u0440 t0 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u043a\u043e\u0433\u0434\u0430 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0435 \u043e\u0442\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0438 \u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043d\u0430\u0447\u0430\u043b\u043e \u043d\u043e\u0432\u043e\u0439 \u043f\u043e\u043f\u044b\u0442\u043a\u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/eb2\/65a\/2e6\/eb265a2e6766475083cce7e729f8b2e9.jpg\"\/><\/p>\n<p>  \u0412\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u043d\u044b\u043c \u0443\u0440\u043e\u0432\u043d\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u043f\u043b\u0430\u0442 Arduino \u00abEthernet.h\u00bb. \u0422\u043e \u0435\u0441\u0442\u044c \u043f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c TCP\/IP \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u0435\u043c\u043e\u0439 \u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0430\u043d\u0446\u0438\u044f\u043c\u0438. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432 \u0441\u043a\u0435\u0442\u0447\u0435 Arduino \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0438 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043e\u0436\u0438\u0434\u0430\u0442\u044c \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0447\u0435\u0440\u0435\u0437 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0440\u0442.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043a\u0435\u0442\u0447<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">#include &lt;Ethernet.h&gt; byte mac[] = {0x90, 0xA2, 0xDA, 0x0E, 0x94, 0xB7 };\/\/\u043c\u0430\u043a \u0430\u0434\u0440\u0435\u0441  IPAddress ip(172, 16, 7, 1);\/\/ ip \u0430\u0434\u0440\u0435\u0441 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u0435\u043c\u043e\u0433\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 IPAddress gateway(172, 16,7, 0);\/\/\u0448\u043b\u044e\u0437 IPAddress subnet(255, 255, 0, 0);\/\/\u043c\u0430\u0441\u043a\u0430 EthernetClient client; EthernetServer iec104Server(2404);\/\/ \u0434\u043b\u044f \u041c\u042d\u041a 670-5-104- \u043f\u043e\u0440\u0442- 2404 void setup() {   Ethernet.begin(mac, ip, gateway, subnet); \/\/ \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f Ethernet-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 } void loop() {   client = iec104Server.available();\/\/\u043f\u043e\u0434\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432  }  <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0415\u0441\u043b\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0441\u043a\u0435\u0442\u0447 \u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/af2\/2bb\/562\/af22bb562a044e40953690fa05ff1e6c.jpg\"\/><\/p>\n<p>  \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u0434\u0430\u043b\u0435\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u043a\u0430 \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u0434\u043b\u044f Arduino \u043f\u0430\u043a\u0435\u0442 STARTDT act \u0438 \u043f\u043e \u0438\u0441\u0442\u0435\u0447\u0435\u043d\u0438\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0440\u0432\u0435\u0442\u0441\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435. \u0414\u0430\u043b\u0435\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 STARTDT act.  <\/p>\n<h2>2. \u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043d\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 (STARTDT act\/con)<\/h2>\n<p>  \u0412 \u041c\u042d\u041a 670-5-104 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 3 \u0442\u0438\u043f\u0430 \u0444\u043e\u0440\u043c\u0430\u0442\u0430 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438:<\/p>\n<ul>\n<li>I-\u0444\u043e\u0440\u043c\u0430\u0442 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0442\u0435\u043b\u0435\u043c\u0435\u0442\u0440\u0438\u0438;<\/li>\n<li>S-\u0444\u043e\u0440\u043c\u0430\u0442 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u043a\u0432\u0438\u0442\u0430\u043d\u0446\u0438\u0439;<\/li>\n<li>U-\u0444\u043e\u0440\u043c\u0430\u0442 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u043f\u043e\u0441\u044b\u043b\u043e\u043a \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0432\u044f\u0437\u0438 \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u0430\u043d\u0430\u043b\u0430 \u0441\u0432\u044f\u0437\u0438.<\/li>\n<\/ul>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u00ab\u0442\u0440\u043e\u0439\u043d\u043e\u0433\u043e \u0440\u0443\u043a\u043e\u043f\u043e\u0436\u0430\u0442\u0438\u044f\u00bb \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u044e\u0449\u0430\u044f (master) \u0441\u0442\u0430\u043d\u0446\u0438\u044f \u043f\u043e\u0441\u044b\u043b\u0430\u0435\u0442 APDU STARTDT (\u0441\u0442\u0430\u0440\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445). STARTDT \u0438\u043d\u0438\u0446\u0438\u0438\u0440\u0443\u0435\u0442 \u0434\u043b\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u0435\u043c\u043e\u0439 (Slav\u0435) \u0441\u0442\u0430\u043d\u0446\u0438\u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0431\u043b\u043e\u043a\u043e\u0432 ASDU (\u043a\u0430\u0434\u0440\u043e\u0432 I) \u0432 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u044e\u0449\u0435\u0439 (master), \u0434\u043b\u044f \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044c STARTDT, \u0435\u0441\u043b\u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u0435\u043c\u0430\u044f (Slav\u0435) \u0441\u0442\u0430\u043d\u0446\u0438\u044f \u0433\u043e\u0442\u043e\u0432\u0430 \u043a \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u0431\u043b\u043e\u043a\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445. \u0415\u0441\u043b\u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u0435\u043c\u0430\u044f (slave) \u0441\u0442\u0430\u043d\u0446\u0438\u044f \u043d\u0435 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 STARTDT \u0442\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u044e\u0449\u0430\u044f (master) \u0441\u0442\u0430\u043d\u0446\u0438\u044f \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0435 IP- \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u0430\u0440\u0442\u0438\u043d\u043a\u0430<\/b><\/p>\n<div class=\"spoiler_text\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/bdd\/ce9\/156\/bddce915668f4fa4bc23bfa2ac96da1d.jpg\"\/>  <\/div>\n<\/div>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0434\u0430\u043b\u0435\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0431\u0430\u0439\u0442\u044b \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u043e\u0442 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u044e\u0449\u0435\u0439 (master) \u0441\u0442\u0430\u043d\u0446\u0438\u0438 \u0438 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c \u0438\u0445.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043a\u0435\u0442\u0447<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">uint8_t iec104ReciveArray[128];\/\/\u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u043b\u044f \u043f\u0440\u0438\u0435\u043c\u0430  EthernetClient client = iec104Server.available();  if(client.available())   {     delay(100);     int i = 0; while(client.available())  {     iec104ReciveArray[i] = client.read();\/\/\u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432 \u0431\u0443\u0444\u0435\u0440 \u043f\u0440\u0438\u0435\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0435     i++;  } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041f\u0440\u043e\u0447\u0438\u0442\u0430\u0432 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c \u0438\u0445 \u0438 \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0442\u0432\u0435\u0442.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Wireshark<\/b><\/p>\n<div class=\"spoiler_text\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/d20\/e60\/ed1\/d20e60ed10884926b65d367d685beab7.jpg\"\/>  <\/div>\n<\/div>\n<p>  \u0412\u043e\u0442 \u043a\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u043e\u0441\u044b\u043b\u043a\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0430\u044f \u0431\u043b\u043e\u043a STARTDT \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 Wireshark, APDU \u0431\u043b\u043e\u043a U-\u0444\u043e\u0440\u043c\u0430\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437 APCI. <br \/>  <b>APCI<\/b>&#8212;<i>\u0423\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0430\u044f \u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u041f\u0440\u0438\u043a\u043b\u0430\u0434\u043d\u043e\u0433\u043e \u0423\u0440\u043e\u0432\u043d\u044f \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u043a\u0430\u043a \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u043a\u0430\u0434\u0440 (\u043a\u0430\u0434\u0440 U \u0438\u043b\u0438 \u043a\u0430\u0434\u0440 S).<\/i><\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/fcd\/112\/eb4\/fcd112eb423040808580405d389c50e8.jpg\"\/><\/p>\n<p>  \u0412\u043a\u0440\u0430\u0442\u0446\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0431\u043b\u043e\u043a APCI \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0442\u0438\u043f \u0431\u043b\u043e\u043a\u0430 APDU \u0438 \u0435\u0433\u043e \u0434\u043b\u0438\u043d\u0443. <b>APCI<\/b> \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0448\u0435\u0441\u0442\u0438 \u0431\u0430\u0439\u0442\u043e\u0432:<\/p>\n<p>  <b>1.<\/b> \u041f\u0440\u0438\u0437\u043d\u0430\u043a \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0431\u043b\u043e\u043a\u0430 APDU \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u044b, \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0439\u0441\u044f \u0431\u0430\u0439\u0442\u043e\u043c START2 68h;<br \/>  <b>2.<\/b> \u0414\u043b\u0438\u043d APDU, \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0440\u0430\u0432\u043d\u0430 \u0447\u0435\u0442\u044b\u0440\u0435\u043c \u0431\u0430\u0439\u0442\u0430\u043c;<br \/>  <b>3.<\/b> \u0411\u0430\u0439\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0438\u043f APDU, \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0440\u0430\u0432\u043d\u043e\u0435 \u0441\u0435\u043c\u0438, \u0447\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u0434\u0430\u043d\u043d\u044b\u0445;<br \/>  <b>4,5,6<\/b> \u041d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/e12\/122\/9e6\/e121229e6ab34b06ab52daa36bc64eec.jpg\"\/><\/p>\n<p>  \u0418\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u0432\u044b\u0448\u0435\u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e, \u043f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c \u043a\u0430\u043a \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c, \u043d\u0435 \u043c\u0435\u0448\u0430\u043b\u043e \u0431\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043a\u0430\u043a\u043e\u0439 \u0442\u0438\u043f APDU \u043d\u0430\u043c \u043f\u043e\u0441\u043b\u0430\u043b\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u044e\u0449\u0430\u044f \u0441\u0442\u0430\u043d\u0446\u0438\u044f. \u0417\u043d\u0430\u044f, \u0447\u0442\u043e \u0442\u0438\u043f APDU \u0437\u0430\u043f\u0438\u0441\u0430\u043d \u0442\u0440\u0435\u0442\u044c\u0438\u043c \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443 \u0447\u0442\u0435\u043d\u0438\u044f \u0431\u043b\u043e\u043a\u0430 APCI \u0431\u0430\u0439\u0442\u043e\u043c, \u0441\u043e\u0445\u0440\u0430\u043d\u044e \u0435\u0433\u043e \u0432 \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u0443\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e. \u0418\u0437 \u0440\u0438\u0441\u0443\u043d\u043a\u0430 \u0432\u044b\u0448\u0435 \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0442\u0438\u043f APDU \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e 7 \u044d\u0442\u043e STARTDT act \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0442\u0430\u043a\u0438\u043c \u0436\u0435 \u043f\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u043f\u0430\u043a\u0435\u0442\u043e\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 \u0434\u043e\u043b\u0436\u043d\u043e \u0438\u043c\u0435\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 11 (0b), \u0447\u0442\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 STARTDT con.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043a\u0435\u0442\u0447<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">#include &lt;Ethernet.h&gt; byte mac[] = {0x90, 0xA2, 0xDA, 0x0E, 0x94, 0xB7 }; IPAddress ip(172, 16, 7, 1); IPAddress gateway(172, 16,7, 0); IPAddress subnet(255, 255, 0, 0); EthernetClient client; EthernetServer iec104Server(2404); int TypeQuerry, MessageLength;\/\/ \u0442\u0438\u043f APDU \u0438 \u0434\u043b\u0438\u043d\u0430 \u043f\u043e\u0441\u044b\u043b\u043a\u0438 uint8_t iec104ReciveArray[128];\/\/\u0431\u0443\u0444\u0435\u0440 \u043f\u0440\u0438\u0435\u043c\u0430 APDU void setup() {   Ethernet.begin(mac, ip, gateway, subnet); } void loop() {   client = iec104Server.available();   if(client.available())\/\/\u043a\u043b\u0438\u0435\u043d\u0442 \u043f\u043e\u0434\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d    {      delay(100);      int i = 0;      while(client.available())\/\/\u0447\u0442\u0435\u043d\u0438\u0435 \u0431\u0430\u0439\u0442\u043e\u0432      {        iec104ReciveArray[i] = client.read();\/\/\u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432 \u0431\u0443\u0444\u0435\u0440 \u043f\u0440\u0438\u0435\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0435        i++;      }     TypeQuerry= iec104ReciveArray[2];\/\/\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0442\u0438\u043f APDU     switch(TypeQuerry)   {        case 07:\/\/ \u0435\u0441\u043b\u0438 \u043f\u0440\u0438\u0448\u0435\u043b \u0442\u0438\u043f STARTDT        iec104ReciveArray[0]=iec104ReciveArray[0];\/\/ START2 = 68h;        iec104ReciveArray[1]=iec104ReciveArray[1];\/\/\u0434\u043b\u0438\u043d\u0430 APDU         iec104ReciveArray[2] = iec104ReciveArray[2]+4; \/\/\u0442\u0438\u043f APDU        iec104ReciveArray[3]=0;        iec104ReciveArray[4]=0;        iec104ReciveArray[5]=0;        MessageLength = iec104ReciveArray[1]+2;\/\/\u0434\u043b\u0438\u043d\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f + 2 \u0431\u0430\u0439\u0442\u0430 Start and Lenght APCI        delay(100);        client.write(iec104ReciveArray, MessageLength);\/\/\u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u043e\u0431\u0440\u0430\u0442\u043d\u043e     break;   }  } } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043a\u0435\u0442\u0447\u0430 \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043e\u0431\u043c\u0435\u043d\u0430:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/66c\/6c7\/50a\/66c6c750ad3e4054a379b78aba695470.jpg\"\/><\/p>\n<p>  \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u0434\u0430\u043d\u043d\u044b\u0445, \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438 \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u043d\u043e\u0432\u044b\u0439 \u043f\u043e\u043a\u0430 \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 APDU \u0444\u043e\u0440\u043c\u0430\u0442\u0430 I \u0442\u0438\u043f\u0430 1 C_IC_NA Act.<\/p>\n<h2>3. \u0417\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u043e\u0431\u0449\u0438\u0439 \u043e\u043f\u0440\u043e\u0441 \u0441\u0442\u0430\u043d\u0446\u0438\u0438<\/h2>\n<p>  \u041f\u0440\u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0431\u043e\u0440\u0443\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043e\u0431\u0449\u0438\u0439 \u043e\u043f\u0440\u043e\u0441 \u0441\u0442\u0430\u043d\u0446\u0438\u0438 \u043a\u0430\u0434\u0440 c \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u043c &lt;100&gt; C_IC_NA_1.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Wireshark<\/b><\/p>\n<div class=\"spoiler_text\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/f30\/889\/598\/f30889598f5f4787a3862d33a8947a3d.jpg\"\/>  <\/div>\n<\/div>\n<p>  APDU &lt;100&gt; C_IC_NA_1 \u043a\u0440\u043e\u043c\u0435 \u0431\u043b\u043e\u043a\u0430 APCI \u0442\u0430\u043a \u0436\u0435 \u0438\u043c\u0435\u0435\u0442 \u0431\u043b\u043e\u043a ASDU (\u0431\u043b\u043e\u043a \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043a\u043b\u0430\u0434\u043d\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043c\u0435\u0441\u0442\u0435 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u044e\u0442 \u041f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044c\u043d\u044b\u0439 \u0411\u043b\u043e\u043a \u0414\u0430\u043d\u043d\u044b\u0445 \u041f\u0440\u0438\u043a\u043b\u0430\u0434\u043d\u043e\u0433\u043e \u0423\u0440\u043e\u0432\u043d\u044f APDU.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/13e\/bb4\/32d\/13ebb432d1cc44cc9bdd5eb4b30677c6.jpg\"\/><\/p>\n<p>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 APDU.<\/p>\n<p>  <b>APCI:<\/b><\/p>\n<ul>\n<li>\u0412 \u043f\u0435\u0440\u0432\u043e\u043c \u0431\u0430\u0439\u0442\u0435 \u0443\u043a\u0430\u0437\u0430\u043d \u0442\u0438\u043f 0 \u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0449\u0438\u0439, \u0447\u0442\u043e \u044d\u0442\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043e\u043f\u0440\u043e\u0441\u0430; <\/li>\n<li>\u0412\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u0434\u043b\u0438\u043d\u0430 APDU 14 \u0431\u0430\u0439\u0442;<\/li>\n<\/ul>\n<p>  <b>ASDU:<\/b><\/p>\n<ul>\n<li>\u041f\u0435\u0440\u0432\u044b\u0439 \u0431\u0430\u0439\u0442 \u0432 \u0431\u043b\u043e\u043a\u0435 ASDU \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0442\u0438\u043f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 &lt;100&gt; C_IC_NA_1 (\u043e\u0431\u0449\u0438\u0439 \u043e\u043f\u0440\u043e\u0441 \u0441\u0442\u0430\u043d\u0446\u0438\u0438);<\/li>\n<li>\u0412\u0442\u043e\u0440\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0431\u043b\u043e\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445;<\/li>\n<li>\u0422\u0440\u0435\u0442\u0438\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u0443 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 (CauseTx), \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0448\u0435\u0441\u0442\u044c \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u044e;<\/li>\n<li>\u0427\u0435\u0442\u0432\u0435\u0440\u0442\u044b\u0439 \u043e\u0431\u0449\u0438\u0439 \u0430\u0434\u0440\u0435\u0441 \u0441\u0442\u0430\u043d\u0443\u0438\u0438;<\/li>\n<li>\u041f\u044f\u0442\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u0435\u043c\u043e\u0439 (slave) \u0441\u0442\u0430\u043d\u0446\u0438\u0438;<\/li>\n<li>\u0421 \u0448\u0435\u0441\u0442\u043e\u0433\u043e \u043f\u043e \u0432\u043e\u0441\u044c\u043c\u043e\u0439 \u0430\u0434\u0440\u0435\u0441 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0440\u0430\u0432\u0435\u043d \u043d\u0443\u043b\u044e;<\/li>\n<li>\u0414\u0435\u0432\u044f\u0442\u044b\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0431\u0430\u0439\u0442 \u2014 QOI \u2014 \u043e\u043f\u0438\u0441\u0430\u0442\u0435\u043b\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u0438\u043c\u0435\u044e\u0449\u0438\u0439 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f:<\/li>\n<\/ul>\n<p>  \u0412 \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 &lt;100&gt; C_IC_NA_1 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435\u043c \u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435\u043c \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u0440\u0438\u043d\u044f\u0442\u044b\u0439 \u0431\u043b\u043e\u043a ASDU. \u0414\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u0431\u0430\u0439\u0442 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u043d\u0430 \u043f\u0440\u0438\u0447\u0438\u043d\u0443 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 (CauseTX) \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0440\u0430\u0432\u043d\u043e\u0435 7. \u0414\u043b\u044f \u043e\u043f\u0440\u0430\u0432\u043a\u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u0431\u0430\u0439\u0442 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u043d\u0430 \u043f\u0440\u0438\u0447\u0438\u043d\u0443 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 (CauseTX) \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0440\u0430\u0432\u043d\u043e\u0435 10.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043a\u0435\u0442\u0447<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">#include &lt;Ethernet.h&gt; byte mac[] = {0x90, 0xA2, 0xDA, 0x0E, 0x94, 0xB7 }; IPAddress ip(172, 16, 7, 1); IPAddress gateway(172, 16,7, 0); IPAddress subnet(255, 255, 0, 0); EthernetClient client; EthernetServer iec104Server(2404); int TypeQuerry, MessageLength;\/\/ \u0442\u0438\u043f APDU \u0438 \u0434\u043b\u0438\u043d\u0430 \u043f\u043e\u0441\u044b\u043b\u043a\u0438 uint8_t iec104ReciveArray[128];\/\/\u0431\u0443\u0444\u0435\u0440 \u043f\u0440\u0438\u0435\u043c\u0430 APDU void setup() {   Ethernet.begin(mac, ip, gateway, subnet); } void loop() {   client = iec104Server.available();   if(client.available())\/\/\u043a\u043b\u0438\u0435\u043d\u0442 \u043f\u043e\u0434\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d    {      delay(100);      int i = 0;      while(client.available())\/\/\u0447\u0442\u0435\u043d\u0438\u0435 \u0431\u0430\u0439\u0442\u043e\u0432      {        iec104ReciveArray[i] = client.read();\/\/\u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432 \u0431\u0443\u0444\u0435\u0440 \u043f\u0440\u0438\u0435\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0435        i++;      }     TypeQuerry= iec104ReciveArray[2];\/\/\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0442\u0438\u043f APDU     switch(TypeQuerry)   {        case 07:\/\/ \u0435\u0441\u043b\u0438 \u043f\u0440\u0438\u0448\u0435\u043b \u0442\u0438\u043f STARTDT        iec104ReciveArray[0]=iec104ReciveArray[0];\/\/ START2 = 68h;        iec104ReciveArray[1]=iec104ReciveArray[1];\/\/\u0434\u043b\u0438\u043d\u0430 APDU         iec104ReciveArray[2] = iec104ReciveArray[2]+4; \/\/\u0442\u0438\u043f APDU        iec104ReciveArray[3]=0;        iec104ReciveArray[4]=0;        iec104ReciveArray[5]=0;        MessageLength = iec104ReciveArray[1]+2;\/\/\u0434\u043b\u0438\u043d\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f + 2 \u0431\u0430\u0439\u0442\u0430 Start and Lenght APCI        delay(100);        client.write(iec104ReciveArray, MessageLength);\/\/\u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u043e\u0431\u0440\u0430\u0442\u043d\u043e     break; case 00:\/\/\u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043e\u043f\u0440\u043e\u0441\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u043e\u043f\u0440\u043e\u0441\u0430 QOI &lt;20&gt; - \u043e\u043f\u0440\u043e\u0441 \u0441\u0442\u0430\u043d\u0446\u0438\u0438 (\u043e\u0431\u0449\u0438\u0439) \tdelay(100); \/\/\u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \tiec104ReciveArray[0]=iec104ReciveArray[0];\/\/ START2 = 68h; \tiec104ReciveArray[1]=iec104ReciveArray[1];\/\/\u0434\u043b\u0438\u043d\u0430 APDU \tiec104ReciveArray[2]=iec104ReciveArray[4];\/\/TX  \tiec104ReciveArray[3]=iec104ReciveArray[5];\/\/TX  \tiec104ReciveArray[4]=iec104ReciveArray[2];\/\/RX  \tiec104ReciveArray[5]=iec104ReciveArray[3];\/\/RX  \tiec104ReciveArray[6]=100;\/\/\u0442\u0438\u043f ASDU \tiec104ReciveArray[7]=01;\/\/SQ \tiec104ReciveArray[8]=07;\/\/\u043f\u0440\u0438\u0447\u0438\u043d\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \tiec104ReciveArray[9]=00;\/\/AO \tiec104ReciveArray[10]=01;\/\/Adress \tiec104ReciveArray[11]=00;\/\/Adress \tiec104ReciveArray[12]=00;\/\/IOA \tiec104ReciveArray[13]=00;\/\/IOA \tiec104ReciveArray[14]=00;\/\/IOA \tiec104ReciveArray[15]=00;\/\/ QOI \tMessageLength = iec104ReciveArray[1]+2;\/\/16 bytes  =APDU LENGHT+2 \tclient.write(iec104ReciveArray, MessageLength); \tdelay(100); \/\/\u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \tiec104ReciveArray[0]=iec104ReciveArray[0];\/\/ START2 = 68h; \tiec104ReciveArray[1]=iec104ReciveArray[1];\/\/\u0434\u043b\u0438\u043d\u0430 APDU \tiec104ReciveArray[2]=iec104ReciveArray[4];\/\/TX  \tiec104ReciveArray[3]=iec104ReciveArray[5];\/\/TX  \tiec104ReciveArray[4]=iec104ReciveArray[2];\/\/RX  \tiec104ReciveArray[5]=iec104ReciveArray[3];\/\/RX  \tiec104ReciveArray[6]=100;\/\/\u0442\u0438\u043f ASDU \tiec104ReciveArray[7]=01;\/\/SQ \tiec104ReciveArray[8]=10;\/\/\u043f\u0440\u0438\u0447\u0438\u043d\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \tiec104ReciveArray[9]=00;\/\/AO \tiec104ReciveArray[10]=01;\/\/Adress \tiec104ReciveArray[11]=00;\/\/Adress \tiec104ReciveArray[12]=00;\/\/IOA \tiec104ReciveArray[13]=00;\/\/IOA \tiec104ReciveArray[14]=00;\/\/IOA \tiec104ReciveArray[15]=00;\/\/ QOI \tMessageLength = iec104ReciveArray[1]+2;\/\/16 bytes \tclient.write(iec104ReciveArray, MessageLength);  \tbreak; }}} <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043a\u0435\u0442\u0447\u0430 \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043e\u0431\u043c\u0435\u043d\u0430:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/43c\/151\/b19\/43c151b191f74f8c81f4ab476a1b8948.jpg\"\/><\/p>\n<p>  \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u0434\u0430\u043d\u043d\u044b\u0445, \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435, \u043e\u0431\u0449\u0438\u0439 \u043e\u043f\u0440\u043e\u0441 \u0441\u0442\u0430\u043d\u0446\u0438\u0438, \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438 \u043f\u043e\u043a\u0430 \u0447\u0442\u043e \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0435 APDU \u0444\u043e\u0440\u043c\u0430\u0442\u0430 S \u0438 \u0441\u043f\u0443\u0441\u0442\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f U TESTFR. <\/p>\n<h2>4. \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0434\u0430\u043d\u043d\u044b\u0445<\/h2>\n<p>  APDU \u0431\u043b\u043e\u043a \u0444\u043e\u0440\u043c\u0430\u0442\u0430 S, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437 APCI \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u043d\u044f\u0442\u043e\u0433\u043e APDU I \u0444\u043e\u0440\u043c\u0430\u0442\u0430. \u0414\u043b\u044f S-\u0444\u043e\u0440\u043c\u0430\u0442\u0430 7 \u0441\u0442\u0430\u0440\u0448\u0438\u0445 \u0431\u0438\u0442 \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044f \u0431\u0430\u0439\u0442\u0430 1 \u0438 \u0431\u0430\u0439\u0442 2 \u043d\u0435 \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u044b, \u0430 \u0431\u0430\u0439\u0442 3 (7 \u0441\u0442\u0430\u0440\u0448\u0438\u0445 \u0431\u0438\u0442) \u0438 \u0431\u0430\u0439\u0442 4 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043d\u043e\u043c\u0435\u0440 \u043f\u0440\u0438\u043d\u044f\u0442\u043e\u0439 \u043f\u043e\u0441\u044b\u043b\u043a\u0438.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/1df\/c5e\/662\/1dfc5e66294742cbbaa8017bb456c3d5.jpg\"\/><\/p>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u043b\u043e\u043a S \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u044e\u0449\u0430\u044f (master) \u0441\u0442\u0430\u043d\u0446\u0438\u044f \u0433\u043e\u0442\u043e\u0432\u0430 \u043a \u043f\u0440\u0438\u0435\u043c\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u043d\u0435 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u044e\u0449\u0435\u0433\u043e, \u0442\u0430\u0439\u043c-\u0430\u0443\u0442 t3 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u044e\u0449\u0435\u0439 (master) \u0441\u0442\u0430\u043d\u0446\u0438\u0438. \u0422\u043e \u0435\u0441\u0442\u044c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u044e\u0449\u0430\u044f (master) \u0441\u0442\u0430\u043d\u0446\u0438\u044f \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043d\u0430\u043c \u00ab\u044f \u0433\u043e\u0442\u043e\u0432\u0430 \u043a \u043f\u0440\u0438\u0435\u043c\u0443 \u0434\u0430\u043d\u043d\u044b\u0445!\u00bb. \u0414\u0430\u043b\u0435\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0437\u0430\u0431\u043e\u0442\u0438\u0442\u044c\u0441\u044f \u043e \u0442\u043e\u043c \u043a\u0430\u043a\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0438 \u043e\u0442\u043a\u0443\u0434\u0430 \u0438\u0445 \u0431\u0440\u0430\u0442\u044c.<\/p>\n<p>  \u0427\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c? \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0438\u0434\u043e\u0432 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u0432 \u041c\u042d\u041a 870-5- 104:<\/p>\n<ul>\n<li>\u041a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u0430\u044f;<\/li>\n<li>\u0423\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0430\u044f;<\/li>\n<li>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b;<\/li>\n<li>\u041f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0444\u0430\u0439\u043b\u043e\u0432.<\/li>\n<\/ul>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u0430\u0440\u0442\u0438\u043d\u043a\u0430<\/b><\/p>\n<div class=\"spoiler_text\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/f1b\/afa\/aae\/f1bafaaaee9946c2b65bad349c1e02b5.jpg\"\/>  <\/div>\n<\/div>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 1, 11 \u0438 13 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 (\u043e\u0434\u043d\u043e\u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043d\u0430\u044f, \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0435 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u043c\u043e\u0435, \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0435 \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u0441 \u043f\u043b\u0430\u0432\u0430\u044e\u0449\u0435\u0439 \u0437\u0430\u043f\u044f\u0442\u043e\u0439). \u0414\u0430\u043d\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0440\u0430\u043d\u0434\u043e\u043c\u043d\u043e. \u0422\u0430\u043a\u0436\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0431\u0430\u0439\u0442 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/283\/22d\/bcb\/28322dbcbf5e4355a963284e40132559.jpg\"\/><\/p>\n<p>  \u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430 \u0441\u0438\u0433\u043d\u0430\u043b\u0430:<\/p>\n<ul>\n<li>\u0415\u0441\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0437\u0430\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u0442\u043e \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0444\u043b\u0430\u0433\u0438 BL(\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430) \u0438 SB(\u0437\u0430\u043c\u0435\u0449\u0435\u043d\u0438\u0435);<\/li>\n<li>\u0415\u0441\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u043b\u043e\u0441\u044c \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043a\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0442\u043e \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0444\u043b\u0430\u0433 NT(\u043d\u0435 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0435);<\/li>\n<li>\u0415\u0441\u043b\u0438 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u0437\u043d\u0430\u043a \u043d\u0435\u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u0443\u0437\u043b\u0430 \u0438\u043b\u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0431\u043e\u043b\u0435\u0435 \u043d\u0438\u0436\u043d\u0435\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f (\u0434\u0430\u0442\u0447\u0438\u043a \u0438\u043b\u0438 \u043f\u0440\u043e\u0447\u0435\u0435) \u0442\u043e \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0444\u043b\u0430\u0433 IV(\u043d\u0435 \u0434\u043e\u0441\u0442\u043e\u0432\u0435\u0440\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435).<\/li>\n<\/ul>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043a\u0435\u0442\u0447<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">void SetQDS(int currvalue, int i,bool zam)\/\/\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430 \u0441\u0438\u0433\u043d\u0430\u043b\u0430 { if (zam==0)\/\/\u0437\u0430\u043c\u0435\u0449\u0435\u043d\u0438\u0435? {   if (currvalue==previusValue[i])\/\/\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u043b\u043e\u0441\u044c?     {       previusValue[i]=currvalue;       counter[i]+=1;       if (counter[i]&gt;=1000)         {           qds[i]=64;\/\/ NT            counter[i]=0;         }     }     else     {         qds[i]=0;         counter[i]=0;         previusValue[i]=currvalue;     } } else    {     qds[i]=48;\/\/ SB, BL      } } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0422\u0430\u043a \u0436\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0447\u0435\u0441\u0442\u044c, \u0447\u0442\u043e \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 IOA, \u0432 \u044d\u043d\u0435\u0440\u0433\u0435\u0442\u0438\u043a\u0435 \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u044d\u0442\u0438 \u0430\u0434\u0440\u0435\u0441\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<ul>\n<li>\u0422\u0421-\u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 4096;<\/li>\n<li>\u0422\u0418-\u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 8192;<\/li>\n<li>\u0422\u0423-\u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 20480.<\/li>\n<\/ul>\n<p>  \u0414\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 EEPROM:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043a\u0435\u0442\u0447<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">void EEPROM_float_write(int addr, float val,int IOA,int number,bool subs) \/\/ \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 \u0432 EEPROM, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u0430, \u0430\u0434\u0440\u0435\u0441 \u0441\u0438\u0433\u043d\u0430\u043b\u0430, \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0438\u0437\u043c\u0435\u0440\u044f\u0435\u043c\u043e\u0433\u043e \u0441\u0438\u0433\u043d\u0430\u043b\u0430, \u0437\u0430\u043c\u0435\u0449\u0435\u043d\u0438\u0435 {     SetQDS(val,number, subs);\/\/\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430 \u0441\u0438\u0433\u043d\u0430\u043b\u0430   byte *x = (byte *)&val;\/\/float --&gt;byte   byte *xxx = (byte *)&IOA;\/\/\u0437\u0430\u043f\u0438\u0441\u044c \u0430\u0434\u0440\u0435\u0441\u0430 IOA   for(int jj = 0; jj &lt;2; jj++)     {       EEPROM.write(addr,xxx[jj]);\/\/\u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0432 EEPROM \u0430\u0434\u0440\u0435\u0441\u0430 \u0431\u043b\u043e\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 2 \u0431\u0430\u0439\u0442\u0430\u0445       addr+=1;     }   for(byte i = 0; i &lt; 4; i++) \/\/\u0437\u0430\u043f\u0438\u0441\u044c \u0444\u043e\u0440\u043c\u0430\u0442\u0430 float \u0432 4 \u0431\u0430\u0439\u0442\u0430\u0445     {       EEPROM.write(addr, x[i]); \/\/\u0437\u0430\u043f\u0438\u0441\u044c \u0444\u043e\u0440\u043c\u0430\u0442\u0430 float \u0432 4 \u0431\u0430\u0439\u0442\u0430\u0445       addr+=1;     }   EEPROM.write(addr, qds[number]);\/\/\u0437\u0430\u043f\u0438\u0441\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u0430   if (addr == EEPROM.length())     {       addr = 0;     } } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0418 \u0442\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0432 APDU \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 S \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0447\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0438\u043c\u0435\u044e\u0449\u0438\u0435\u0441\u044f \u0443 \u043d\u0430\u0441 \u0432 \u0440\u0430\u0441\u043f\u043e\u0440\u044f\u0436\u0435\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0435, \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u044f \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0442\u044c \u043d\u043e\u043c\u0435\u0440 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u043a\u0430\u0434\u0440\u0430.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/245\/ac2\/26a\/245ac226a2be4241a6ebe70aed7645ae.jpg\"\/><\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043a\u0435\u0442\u0447<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">#include &lt;Ethernet.h&gt; #include &lt;eeprom.h&gt; byte mac[] = {0x90, 0xA2, 0xDA, 0x0E, 0x94, 0xB7 }; IPAddress ip(172, 16, 7, 1); IPAddress gateway(172, 16,7, 0); IPAddress subnet(255, 255, 0, 0); EthernetClient client; EthernetServer iec104Server(2404); int TypeQuerry, MessageLength; uint8_t iec104ReciveArray[128]; int counter[6]; int qds[6]; int previusValue[6]; word iecData[256]; int txcnt; void setup() {   Ethernet.begin(mac, ip, gateway, subnet); }  void EEPROM_float_write(int addr, float val,int IOA,int number,bool zam)  {     SetQDS(val,number,zam);     byte *x = (byte *)&val;   byte *xxx = (byte *)&IOA;   for(int jj = 0; jj &lt;2; jj++)     {       EEPROM.write(addr,xxx[jj]);       addr+=1;       }   for(byte i = 0; i &lt; 4; i++)   {       EEPROM.write(addr, x[i]);       addr+=1;   }   EEPROM.write(addr, qds[number]);  if (addr == EEPROM.length())    { \t  addr = 0;    } } void EEPROM_byte_write(int addr, bool val,int IOA,int number,bool zam)  {     SetQDS(val,number,zam);     byte c=val+qds[number];   byte *x = (byte *)&c;   byte *xxxx = (byte *)&IOA;   for(int jj = 0; jj &lt;2; jj++) \/\/IOA     {        EEPROM.write(addr,xxxx[jj]);       addr+=1;       }   for(byte i = 0; i &lt; 1; i++) \/\/Data   {   EEPROM.write(addr, x[i]);   }   if (addr == EEPROM.length()) {     addr = 0;   } } void EEPROM_int_write(int addr, int val, int IOA,int number,bool zam)  {       SetQDS(val,number,zam);    byte *x = (byte *)&val;   byte *xx = (byte *)&IOA;   for(int jj = 0; jj &lt;2; jj++)     {       EEPROM.write(addr,xx[jj]);       addr+=1;       }     for(byte i = 0; i &lt; 2; i++) \t  { \t   EEPROM.write(addr, x[i]); \t   addr+=1;  \t  }    EEPROM.write(addr, qds[number]);      if (addr == EEPROM.length()) {     addr = 0;   } } void SetQDS(int currvalue, int i,bool zam)\/\/ \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0438\u0433\u043d\u0430\u043b\u0430 { if (zam==0)\/\/\u0437\u0430\u043c\u0435\u0449\u0435\u043d\u0438\u0435? {   if (currvalue==previusValue[i])\/\/\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u043b\u043e\u0441\u044c?     {       previusValue[i]=currvalue;       counter[i]+=1;       if (counter[i]&gt;=1000)         {           qds[i]=64;           counter[i]=0;         }       }     else       {         qds[i]=0;         counter[i]=0;         previusValue[i]=currvalue;       } } else    {           qds[i]=48;       }  } void loop() {    EEPROM_byte_write(0,0,4096,0,0);    EEPROM_byte_write(3,random(0, 2),4097,1,1);\/\/bl    EEPROM_int_write(6,  67,8192,2,1);\/\/float data     EEPROM_int_write(11, random(10, 20),8193,3,0);\/\/ int data +5    EEPROM_float_write(16, random(-1000, 2000),8194,4,1);\/\/float data+7    EEPROM_float_write(23, 78.66f,8195,5,1);\/\/float data+7   client = iec104Server.available(); if(client.available())   {     delay(100);     int i = 0;     while(client.available())     {       iec104ReciveArray[i] = client.read(); \t  i++;     }     TypeQuerry= iec104ReciveArray[2];\/\/\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0442\u0438\u043f \u043f\u043e\u0441\u044b\u043b\u043a\u0438   switch(TypeQuerry)   {     case 07:        iec104ReciveArray[0]=iec104ReciveArray[0];\/\/\u043a\u0430\u0434\u0440 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u044b, \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0439\u0441\u044f \u0431\u0430\u0439\u0442\u043e\u043c START2 = 68h;        iec104ReciveArray[1]=iec104ReciveArray[1];\/\/\u0434\u043b\u0438\u043d\u0430 APDU LENGHT        iec104ReciveArray[2] = iec104ReciveArray[2]+4; \/\/TYPE        iec104ReciveArray[3]=0;        iec104ReciveArray[4]=0;        iec104ReciveArray[5]=0;        MessageLength = iec104ReciveArray[1]+2;\/\/\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0434\u043b\u0438\u043d\u044b \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f + 2 \u0431\u0430\u0439\u0442\u0430 Start and Lenght        delay(100);        client.write(iec104ReciveArray, MessageLength);     break;     case 00:       delay(100);       iec104ReciveArray[0]=iec104ReciveArray[0];\/\/\u043a\u0430\u0434\u0440 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u044b, \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0439\u0441\u044f \u0431\u0430\u0439\u0442\u043e\u043c START2 = 68h;       iec104ReciveArray[1]=iec104ReciveArray[1];\/\/\u0434\u043b\u0438\u043d\u0430       iec104ReciveArray[2]=iec104ReciveArray[4];\/\/\u0442\u0438\u043f, TX H       iec104ReciveArray[3]=iec104ReciveArray[5];\/\/TX L       iec104ReciveArray[4]=iec104ReciveArray[2];\/\/RX H       iec104ReciveArray[5]=iec104ReciveArray[3];\/\/RX L       iec104ReciveArray[6]=100;\/\/type       iec104ReciveArray[7]=01;\/\/sq       iec104ReciveArray[8]=07;\/\/cause con       iec104ReciveArray[9]=00;\/\/AO       iec104ReciveArray[10]=01;\/\/Adress       iec104ReciveArray[11]=00;\/\/Adress       iec104ReciveArray[12]=00;\/\/IOA       iec104ReciveArray[13]=00;\/\/IOA       iec104ReciveArray[14]=00;\/\/IOA       iec104ReciveArray[15]=00;\/\/IOA, QOI       MessageLength = iec104ReciveArray[1]+2;\/\/16 bytes  =APDU LENGHT+2 BAIT       client.write(iec104ReciveArray, MessageLength);       delay(100);       iec104ReciveArray[0]=iec104ReciveArray[0];\/\/\u043a\u0430\u0434\u0440 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u044b, \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0439\u0441\u044f \u0431\u0430\u0439\u0442\u043e\u043c START2 = 68h;       iec104ReciveArray[1]=iec104ReciveArray[1];\/\/\u0434\u043b\u0438\u043d\u0430       iec104ReciveArray[2]=02;\/\/\u0442\u0438\u043f, TX H       iec104ReciveArray[3]=iec104ReciveArray[5];\/\/TX L       iec104ReciveArray[4]=iec104ReciveArray[2];\/\/RX H       iec104ReciveArray[5]=iec104ReciveArray[3];\/\/RX L       iec104ReciveArray[6]=100;\/\/type       iec104ReciveArray[7]=01;\/\/sq       iec104ReciveArray[8]=10;\/\/cause con       iec104ReciveArray[9]=00;\/\/AO       iec104ReciveArray[10]=01;\/\/Adress       iec104ReciveArray[11]=00;\/\/Adress       iec104ReciveArray[12]=00;\/\/IOA       iec104ReciveArray[13]=00;\/\/IOA       iec104ReciveArray[14]=00;\/\/IOA       iec104ReciveArray[15]=20;\/\/IOA, QOI       MessageLength = iec104ReciveArray[1]+2;\/\/16 bytes       client.write(iec104ReciveArray, MessageLength);      break;     case 01:       txcnt=word(iec104ReciveArray[5],iec104ReciveArray[4]);       iec104ReciveArray[0]=iec104ReciveArray[0];\/\/\u043a\u0430\u0434\u0440 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u044b, \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0439\u0441\u044f \u0431\u0430\u0439\u0442\u043e\u043c START2 = 68h;       iec104ReciveArray[1]=14;\/\/\u0434\u043b\u0438\u043d\u0430  APDU=4 APCI+ (6 ASDU + 8 DATA*2)        iec104ReciveArray[2]=lowByte(txcnt);\/\/TX       iec104ReciveArray[3]=highByte(txcnt);\/\/ iec104ReciveArray[3];\/\/TX       iec104ReciveArray[4]=0;\/\/RX       iec104ReciveArray[5]=0;\/\/RX       iec104ReciveArray[6]=1;\/\/type 1       iec104ReciveArray[7]=01;\/\/sq       iec104ReciveArray[8]=01;\/\/cause       iec104ReciveArray[9]=00;\/\/AO       iec104ReciveArray[10]=01;\/\/Adress       iec104ReciveArray[11]=00;\/\/Adress       iec104ReciveArray[12]=iecData[0];\/\/IOA       iec104ReciveArray[13]=iecData[1];\/\/IOA       iec104ReciveArray[14]=0;\/\/IOA       iec104ReciveArray[15]=iecData[2];\/\/lowByte(iecData);\/\/value [DATA 1]       MessageLength = iec104ReciveArray[1]+2;       client.write(iec104ReciveArray, MessageLength);        delay(5);       txcnt=txcnt+2;       iec104ReciveArray[0]=iec104ReciveArray[0];\/\/\u043a\u0430\u0434\u0440 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u044b, \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0439\u0441\u044f \u0431\u0430\u0439\u0442\u043e\u043c START2 = 68h;       iec104ReciveArray[1]=14;\/\/\u0434\u043b\u0438\u043d\u0430  APDU=4 APCI+ (6 ASDU + 8 DATA*2)        iec104ReciveArray[2]=lowByte(txcnt);\/\/TX       iec104ReciveArray[3]=highByte(txcnt);\/\/ iec104ReciveArray[3];\/\/TX       iec104ReciveArray[4]=0;\/\/RX       iec104ReciveArray[5]=0;\/\/RX       iec104ReciveArray[6]=1;\/\/type 13       iec104ReciveArray[7]=01;\/\/sq       iec104ReciveArray[8]=01;\/\/cause       iec104ReciveArray[9]=00;\/\/AO       iec104ReciveArray[10]=01;\/\/Adress       iec104ReciveArray[11]=00;\/\/Adress       iec104ReciveArray[12]=iecData[3];\/\/IOA       iec104ReciveArray[13]=iecData[4];\/\/IOA       iec104ReciveArray[14]=0;\/\/IOA       iec104ReciveArray[15]=iecData[5];\/\/iecData[11];       MessageLength = iec104ReciveArray[1]+2;       client.write(iec104ReciveArray, MessageLength);        delay(5);       txcnt=txcnt+2;       iec104ReciveArray[0]=iec104ReciveArray[0];\/\/ START2 = 68h;       iec104ReciveArray[1]=22;\/\/\u0434\u043b\u0438\u043d\u0430  APDU=4 APCI+ (6 ASDU + 8 DATA*2)        iec104ReciveArray[2]=lowByte(txcnt);       iec104ReciveArray[3]=highByte(txcnt);       iec104ReciveArray[4]=0;\/\/RX       iec104ReciveArray[5]=0;\/\/RX       iec104ReciveArray[6]=11;\/\/type 11       iec104ReciveArray[7]=02;\/\/sq       iec104ReciveArray[8]=01;\/\/cause       iec104ReciveArray[9]=00;\/\/AO       iec104ReciveArray[10]=01;\/\/Adress       iec104ReciveArray[11]=00;\/\/Adress       iec104ReciveArray[12]=iecData[6];\/\/IOA       iec104ReciveArray[13]=iecData[7];\/\/IOA       iec104ReciveArray[14]=0;\/\/IOA       iec104ReciveArray[15]=iecData[8];\/\/value  [DATA 2]       iec104ReciveArray[16]=iecData[9];\/\/value  [DATA 2]       iec104ReciveArray[17]=iecData[10];\/\/QDS        iec104ReciveArray[18]=iecData[11];\/\/IOA       iec104ReciveArray[19]=iecData[12];\/\/OA       iec104ReciveArray[20]=0;\/\/IOA       iec104ReciveArray[21]=iecData[13];\/\/value  [DATA 2]       iec104ReciveArray[22]=iecData[14];\/\/value  [DATA 2]       iec104ReciveArray[23]=iecData[15];\/\/IOA QDS        MessageLength = iec104ReciveArray[1]+2;       client.write(iec104ReciveArray, MessageLength);       delay(5);       txcnt=txcnt+2;       iec104ReciveArray[0]=iec104ReciveArray[0];       iec104ReciveArray[1]=26;       iec104ReciveArray[2]=lowByte(txcnt);       iec104ReciveArray[3]=highByte(txcnt);       iec104ReciveArray[4]=0;       iec104ReciveArray[5]=0;       iec104ReciveArray[6]=13;       iec104ReciveArray[7]=02;       iec104ReciveArray[8]=01;       iec104ReciveArray[9]=00;       iec104ReciveArray[10]=01;       iec104ReciveArray[11]=00;       iec104ReciveArray[12]=iecData[16];       iec104ReciveArray[13]=iecData[17];       iec104ReciveArray[14]=0;       iec104ReciveArray[15]=iecData[18];       iec104ReciveArray[16]=iecData[19];       iec104ReciveArray[17]=iecData[20];       iec104ReciveArray[18]=iecData[21];       iec104ReciveArray[19]=iecData[22];       iec104ReciveArray[20]=iecData[23];       iec104ReciveArray[21]=iecData[24];       iec104ReciveArray[22]=0;       iec104ReciveArray[23]=iecData[25];       iec104ReciveArray[24]=iecData[26];       iec104ReciveArray[25]=iecData[27];       iec104ReciveArray[26]=iecData[28];       iec104ReciveArray[27]=iecData[29];       MessageLength = iec104ReciveArray[1]+2;       client.write(iec104ReciveArray, MessageLength);     break;   }  } } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0432 \u0441\u043a\u0435\u0442\u0447 \u0432 Wireshark \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c, \u0447\u0442\u043e \u043d\u0430\u043a\u043e\u043d\u0435\u0446-\u0442\u043e \u043d\u0430\u0447\u0430\u043b\u0430\u0441\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/519\/257\/c17\/519257c174434165ae49c21495dcabc4.jpg\"\/><\/p>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u043f\u0440\u0438\u0432\u043e\u0436\u0443 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b ASDU &lt;100&gt;M_SP_NA_1 \u043e\u0434\u043d\u043e\u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043d\u0430\u044f \u0438\u043d\u0434\u0438\u043a\u0430\u0446\u0438\u044f.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/8ac\/a08\/fc1\/8aca08fc17484208ad5f9d2929c5f692.jpg\"\/><\/p>\n<p>  <b>TypeId<\/b> \u2014 \u0432\u0438\u0434 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438.<br \/>  <b>SQ<\/b> \u2014 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b.<\/p>\n<p>  \u041f\u0440\u0435\u0434\u0443\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0434\u0432\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0431\u043b\u043e\u043a\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<p>  1. \u0411\u043b\u043e\u043a, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 i \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 (\u0438\u043b\u0438 \u043f\u043e \u043e\u0434\u043d\u043e\u0439 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432); \u0441\u0442\u0430\u0440\u0448\u0438\u0439 \u0431\u0438\u0442 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b SQ (single\/sequence) \u0440\u0430\u0432\u0435\u043d 0, \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 7 \u0431\u0438\u0442\u043e\u0432 \u0437\u0430\u0434\u0430\u044e\u0442 \u0447\u0438\u0441\u043b\u043e i.<\/p>\n<p>  2. \u0411\u043b\u043e\u043a, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u043e\u0434\u0438\u043d \u043e\u0431\u044a\u0435\u043a\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 j \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043b\u0438\u0431\u043e \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438; \u0441\u0442\u0430\u0440\u0448\u0438\u0439 \u0431\u0438\u0442 (27 = 80h) \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 SQ \u0440\u0430\u0432\u0435\u043d 1, \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 7 \u0431\u0438\u0442\u043e\u0432 \u0437\u0430\u0434\u0430\u044e\u0442 \u0447\u0438\u0441\u043b\u043e j.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u0430\u0440\u0442\u0438\u043d\u043a\u0430<\/b><\/p>\n<div class=\"spoiler_text\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/b07\/7b0\/fe0\/b077b0fe004548d09207436d5288b2a8.jpg\"\/>  <\/div>\n<\/div>\n<p>  <b>CauseTx<\/b> \u2014 \u043f\u0440\u0438\u0447\u0438\u043d\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u0430\u0440\u0442\u0438\u043d\u043a\u0430<\/b><\/p>\n<div class=\"spoiler_text\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/a05\/d3f\/7ad\/a05d3f7ad3854e69b093e53629fb7efb.jpg\"\/>  <\/div>\n<\/div>\n<p>  <b>Addr<\/b> \u2014 \u0430\u0434\u0440\u0435\u0441 \u0441\u043b\u044d\u0439\u0432\u0430 (\u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043c\u0430\u0441\u0442\u0435\u0440\u0430).<br \/>  <b>IOA<\/b> \u2014 \u0430\u0434\u0440\u0435\u0441 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u0430\u0434\u0440\u0435\u0441\u0443 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u044e\u0449\u0430\u044f \u0441\u0442\u0430\u043d\u0446\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0432\u044f\u0437\u044b\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0442\u044d\u0433 <br \/>  <b>SIQ<\/b> \u2014 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u0441\u0438\u0433\u043d\u0430\u043b\u0430.<\/p>\n<p>  <b>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 ASDU \u0431\u043b\u043e\u043a\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 &lt;11&gt;M_ME_NB_1<\/b>:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Wireshark<\/b><\/p>\n<div class=\"spoiler_text\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/614\/0af\/f41\/6140aff415ee45d0a3536f78168f9ee5.jpg\"\/>  <\/div>\n<\/div>\n<p>  \u0412 \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 master \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0431\u043b\u043e\u043a\u0438 \u0444\u043e\u0440\u043c\u0430\u0442\u0430 S \u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0437\u0430\u0446\u0438\u043a\u043b\u0438\u0442\u0441\u044f \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440 \u043f\u043e\u043a\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u0435\u043c\u043e\u0435(slave) \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u043d\u0435 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u043a\u0430\u0434\u0440\u044b.<\/p>\n<h2>5. \u041f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/h2>\n<p>  \u041f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u0441 \u0446\u0435\u043b\u044c\u044e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u0437\u0430 \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c\u044e \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u043d\u044b\u0445 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439. \u041f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u043e\u0442 \u00ab\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438\u00bb IP-\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u0435\u0441\u043b\u0438 \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 t3 \u043d\u0435 \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u043d\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u043a\u0430\u0434\u0440\u0430 (I, U, S). \u0412\u0440\u0435\u043c\u044f t3 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043e\u043c \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u00ab\u0422\u0430\u0439\u043c-\u0430\u0443\u0442 \u0434\u043b\u044f \u043f\u043e\u0441\u044b\u043b\u043a\u0438 \u0431\u043b\u043e\u043a\u043e\u0432 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0434\u043e\u043b\u0433\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u044f\u00bb. \u041f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u043f\u0443\u0442\u0435\u043c \u043f\u043e\u0441\u044b\u043b\u043a\u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e APDU (TESTFR =act), \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u043c\u043e\u0439 \u0441\u0442\u0430\u043d\u0446\u0438\u0435\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e APDU (TESTFR =con). <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u0430\u0440\u0442\u0438\u043d\u043a\u0430<\/b><\/p>\n<div class=\"spoiler_text\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/bfb\/e47\/0ef\/bfbe470ef86348da84fc482a7addd379.jpg\"\/>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Wireshark<\/b><\/p>\n<div class=\"spoiler_text\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/b3e\/c68\/d9e\/b3ec68d9e96f41ae9967bf244318b290.jpg\"\/>  <\/div>\n<\/div>\n<p>  \u0415\u0441\u043b\u0438 \u043e\u0442 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u044e\u0449\u0435\u0439 (master) \u0441\u0442\u0430\u043d\u0446\u0438\u0438 \u043f\u0440\u0438\u0434\u0435\u0442 APDU \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0432 \u0431\u0430\u0439\u0442\u0435 \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0435\u0433\u043e \u0437\u0430 \u0442\u0438\u043f APDU \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0440\u0430\u0432\u043d\u043e \u0448\u0435\u0441\u0442\u0438\u0434\u0435\u0441\u044f\u0442\u0438 \u0441\u0435\u0442\u0438 (TESTFR) \u044d\u0442\u043e \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 t3 \u043e\u0442 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u0435\u043c\u043e\u0439 \u0441\u0442\u0430\u043d\u0446\u0438\u0438 \u043d\u0435 \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u043d\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u043a\u0430\u0434\u0440\u0430 (I, U, S), \u0438 \u0435\u0441\u043b\u0438 \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 t1 \u043d\u0435 \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435\u043c \u0442\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u043e\u0440\u0432\u0430\u043d\u043e.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043a\u0435\u0442\u0447<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">case 67:       iec104ReciveArray[0]=iec104ReciveArray[0];\/\/\u043a\u0430\u0434\u0440 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u044b, \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0439\u0441\u044f \u0431\u0430\u0439\u0442\u043e\u043c START2 = 68h;       iec104ReciveArray[1]=iec104ReciveArray[1];\/\/\u0434\u043b\u0438\u043d\u0430 APDU LENGHT       iec104ReciveArray[2] = 131; \/\/TESTDT con       iec104ReciveArray[3] =0;       iec104ReciveArray[4] =0;       iec104ReciveArray[5] =0;       MessageLength = iec104ReciveArray[1]+2;\/\/\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0434\u043b\u0438\u043d\u044b \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f + 2 \u0431\u0430\u0439\u0442\u0430 Start68H and Lenght       delay(10);       client.write(iec104ReciveArray, MessageLength); <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Wireshark<\/b><\/p>\n<div class=\"spoiler_text\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/a9f\/c4c\/604\/a9fc4c60423d4867945468f5636ea5ec.jpg\"\/>  <\/div>\n<\/div>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u043c \u0432\u0441\u0451, \u0435\u0441\u043b\u0438 \u043a\u043e\u043c\u0443-\u043d\u0438\u0431\u0443\u0434\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0442\u043e \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u044e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u041c\u042d\u041a 670-5-104 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u044e\u0449\u0435\u0439 (master) \u0441\u0442\u0430\u043d\u0446\u0438\u0438 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 Arduino.       <\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habrahabr.ru\/post\/280818\/\"> https:\/\/habrahabr.ru\/post\/280818\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>       \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e \u0441\u0432\u043e\u0435\u043c \u0437\u043d\u0430\u043a\u043e\u043c\u0441\u0442\u0432\u0435 \u0441 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u041c\u042d\u041a 870-5-104 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u0435\u043c\u043e\u0433\u043e (slave) \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u043f\u0443\u0442\u0435\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043d\u0430 Arduino.<\/p>\n<h2>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u041c\u042d\u041a 870-5-104 \u044d\u0442\u043e \u0438 \u0433\u0434\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f?<\/h2>\n<p>  \u041c\u042d\u041a 60870-5-104 \u2013 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u0442\u0435\u043b\u0435\u043c\u0435\u0445\u0430\u043d\u0438\u043a\u0438, \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0439 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432 \u0422\u041c \u0432 \u0410\u0421\u0422\u0423, \u0440\u0435\u0433\u043b\u0430\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0435\u0442\u0435\u0432\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043f\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0443 TCP\/IP. \u0427\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u044d\u043d\u0435\u0440\u0433\u0435\u0442\u0438\u043a\u0435 \u0434\u043b\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u043c\u0435\u043d\u0430 \u043c\u0435\u0436\u0434\u0443 \u044d\u043d\u0435\u0440\u0433\u043e\u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0442 \u0438\u0437\u043c\u0435\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 (\u0432\u043e\u043b\u044c\u0442\u043c\u0435\u0442\u0440\u044b, \u0441\u0447\u0435\u0442\u0447\u0438\u043a\u0438 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u044d\u043d\u0435\u0440\u0433\u0438\u0438 \u0438 \u043f\u0440\u043e\u0447\u0435\u0435).<\/p>\n<p>  \u0421\u0442\u044d\u043a \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 \u041c\u042d\u041a 670-5-104:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/55d\/e9f\/d32\/55de9fd3250e425eb990bd24f0a95c61.jpg\"\/>  <\/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-277582","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/277582","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=277582"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/277582\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=277582"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=277582"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=277582"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}