{"id":144,"date":"2020-10-07T16:43:30","date_gmt":"2020-10-07T14:43:30","guid":{"rendered":"http:\/\/disorder.dk\/wonderware\/?p=144"},"modified":"2020-10-07T16:43:30","modified_gmt":"2020-10-07T14:43:30","slug":"modbus-tcp-between-codesys-controllers","status":"publish","type":"post","link":"https:\/\/disorder.dk\/wonderware\/2020\/10\/07\/modbus-tcp-between-codesys-controllers\/","title":{"rendered":"MODBUS TCP between Codesys controllers"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">This is a example code of how to set up Master &lt;&#8211; Slave communication between two Codesys Runtime controllers. This example was made in Codesys version 3.5.16.20 . This example is intentionally set up as one-way communication, so you have to repeat the Master\/Slave setup in both controllers or change the configuration to use R\/W registers, but that is out of the scope for this example.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It is assumed that the reader of this article has a basic understanding of the MODBUS protocol. At least to understand the reasons for swapping around WORD data types and know about Big Ending, Little Endian, Most Significant Byte (MSB) and Least Significant Byte (LSB).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Naming convention in this example should be tailored to your project, to make it more easily disgustingly as to which controllers you have data from and to.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Network interface<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Right-click on the Codesys controller and select &#8220;Add Device&#8230;&#8221; and add a Ethernet interface for the MODBUS protocol to work on.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"613\" height=\"895\" src=\"http:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_network1.jpg\" alt=\"\" class=\"wp-image-145\" srcset=\"https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_network1.jpg 613w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_network1-205x300.jpg 205w\" sizes=\"auto, (max-width: 613px) 100vw, 613px\" \/><figcaption>Codesys Ethernet interface<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Right-click the Ethernet interface and select &#8220;Add Device&#8230;&#8221; and add a MODBUS TCP Master if you are on the Master PLC or jump a few steps down and add a MODBUS TCP Slave Device to the Slave PLC.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"613\" height=\"895\" src=\"http:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_master1.jpg\" alt=\"\" class=\"wp-image-146\" srcset=\"https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_master1.jpg 613w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_master1-205x300.jpg 205w\" sizes=\"auto, (max-width: 613px) 100vw, 613px\" \/><figcaption>Codesys MODBUS TCP Master interface<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Right-click the MODBUS TCP Master interface and select &#8220;Add Device&#8230;&#8221; and add a MODBUS TCP Slave.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"613\" height=\"895\" src=\"http:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_master2.jpg\" alt=\"\" class=\"wp-image-147\" srcset=\"https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_master2.jpg 613w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_master2-205x300.jpg 205w\" sizes=\"auto, (max-width: 613px) 100vw, 613px\" \/><figcaption>Codesys MODBUS TCP Slave interface<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Right-click the Ethernet interface and select &#8220;Add Device&#8230;&#8221; and add a MODBUS TCP Slave Device if you are on the Slave PLC.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"613\" height=\"895\" src=\"http:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_slave1.jpg\" alt=\"\" class=\"wp-image-148\" srcset=\"https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_slave1.jpg 613w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_slave1-205x300.jpg 205w\" sizes=\"auto, (max-width: 613px) 100vw, 613px\" \/><figcaption>Codesys MODBUS TCP Slave Device interface<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The Ethernet interface on both Codesys controllers is to be configured. In this example I am going to use the same network interface as the controllers connect to the SCADA platform on. I have selected the first Ethernet port of the controllers, X000, br0, Eth0 it can have many different names.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"968\" height=\"614\" src=\"http:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_network2.jpg\" alt=\"\" class=\"wp-image-152\" srcset=\"https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_network2.jpg 968w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_network2-300x190.jpg 300w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_network2-768x487.jpg 768w\" sizes=\"auto, (max-width: 968px) 100vw, 968px\" \/><figcaption>Selecting the network interface to use for the MODBUS TCP communication.<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">On the Master PLC there is also a few settings for the MODBUS TCP Master and Slave interfaces. In this example I use a high timeout limit, adjust it to your application and most importantly, remember to tick on Auto-reconnect, you do not want to go online on each controller after a power-cut to re-enable MODBUS communication.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"763\" height=\"336\" src=\"http:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_master2.5.jpg\" alt=\"\" class=\"wp-image-150\" srcset=\"https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_master2.5.jpg 763w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_master2.5-300x132.jpg 300w\" sizes=\"auto, (max-width: 763px) 100vw, 763px\" \/><figcaption>Codesys MODBUS TCP Master interface settings<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">On the MODBUS TCP Slave interface we have to set up the IP-address of the Slave PLC, timeout and port. Port 502 is default.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"910\" height=\"362\" src=\"http:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_master3.jpg\" alt=\"\" class=\"wp-image-151\" srcset=\"https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_master3.jpg 910w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_master3-300x119.jpg 300w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_master3-768x306.jpg 768w\" sizes=\"auto, (max-width: 910px) 100vw, 910px\" \/><figcaption>Codesys MODBUS TCP Slave interface settings<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Programming<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A new type is made. It is a Union type called &#8220;Modbus2WordReal&#8221; and it will be used for data type conversion between WORD and REAL, with the freedom to switch around on WORD[0] and WORD[1] to account for MSB\/LSB when communicating with various MODBUS devices. This new type is used in both Master and Slave PLC.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"916\" height=\"404\" src=\"http:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_slave3.jpg\" alt=\"\" class=\"wp-image-153\" srcset=\"https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_slave3.jpg 916w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_slave3-300x132.jpg 300w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_slave3-768x339.jpg 768w\" sizes=\"auto, (max-width: 916px) 100vw, 916px\" \/><figcaption>Codesys Union data type for WORD to REAL conversion and vice versa<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Some global variables are also needed in the GVL to make them accessible throughout the controllers programs. Only the From\/Receive variables are used in this example.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"667\" height=\"315\" src=\"http:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_master4.jpg\" alt=\"\" class=\"wp-image-154\" srcset=\"https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_master4.jpg 667w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_master4-300x142.jpg 300w\" sizes=\"auto, (max-width: 667px) 100vw, 667px\" \/><figcaption>Master PLC GVL<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">I was a little more structured in the Slave PLC and added some comment structure to make it easier to read the code.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"796\" height=\"378\" src=\"http:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_slave4.jpg\" alt=\"\" class=\"wp-image-155\" srcset=\"https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_slave4.jpg 796w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_slave4-300x142.jpg 300w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_slave4-768x365.jpg 768w\" sizes=\"auto, (max-width: 796px) 100vw, 796px\" \/><figcaption>Slave PLC GVL<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">On the Master PLC the MODBUS TCP Slave has to be configured with the new variables in its Modbus Slave channel tab. Notice that the Channel names I gave them corresponds to the READ Offset, that is written out in hex, 16#0200 = 512 written in decimal in the editor when adding new channels. Read Input Registers \/Function Code 04) is used.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"333\" src=\"http:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_master5-1024x333.jpg\" alt=\"\" class=\"wp-image-156\" srcset=\"https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_master5-1024x333.jpg 1024w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_master5-300x97.jpg 300w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_master5-768x250.jpg 768w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_master5.jpg 1148w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>Codesys MODBUS TCP Slave configuration of the channels<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">On the Slave PLC we have to set up the corresponding registers for them to match between Master and Slave. The MODBUS TCP Slave Device has settings for defining number of registers and offset on start addresses.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1001\" height=\"567\" src=\"http:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_slave2.jpg\" alt=\"\" class=\"wp-image-157\" srcset=\"https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_slave2.jpg 1001w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_slave2-300x170.jpg 300w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_slave2-768x435.jpg 768w\" sizes=\"auto, (max-width: 1001px) 100vw, 1001px\" \/><figcaption>Codesys MODBUS TCP Slave Device interface configuration<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">MODBUS TCP Slave Device I\/O Mapping shows why I named the variables as I did, to match the registers used.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"303\" src=\"http:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_slave6-1024x303.jpg\" alt=\"\" class=\"wp-image-159\" srcset=\"https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_slave6-1024x303.jpg 1024w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_slave6-300x89.jpg 300w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_slave6-768x227.jpg 768w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_slave6.jpg 1242w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>Codesys MODBUS TCP Slave Device I\/O Mapping<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The program of the Master PLC is a simple WORD_AS_BIT conversion from the received register 512 and it is converted into 16 single bits that can be used in your other programs in the controller. For register 513+514, notice how the WORD conversion to REAL and possibility of swapping the two WORD around is done with the Union data type. Here it is just a local instance of the PRG_MODBUS_TCP program as I would add the REAL variable on the output of the MOVE block.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"425\" src=\"http:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_master6-1024x425.jpg\" alt=\"\" class=\"wp-image-160\" srcset=\"https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_master6-1024x425.jpg 1024w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_master6-300x125.jpg 300w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_master6-768x319.jpg 768w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_master6.jpg 1324w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>Master PLC MODBUS receiving program and Union data type conversion<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The program of the Slave PLC is a simple BIT_AS_WORD conversion from the 16 single bits that can be used in your other programs in the controller to be transmitted to register 512. For register 513+514, notice how the possibility of swapping the two WORD around is done with the Union data type. Here it is just a local instance of the PRG_MODBUS_TCP program.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"494\" src=\"http:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_slave5-1024x494.jpg\" alt=\"\" class=\"wp-image-161\" srcset=\"https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_slave5-1024x494.jpg 1024w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_slave5-300x145.jpg 300w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_slave5-768x371.jpg 768w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_slave5.jpg 1347w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>Slave PLC MODBUS transmitting program and Union data type conversion<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Test of MODBUS TCP communication<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A small test program was written in the Slave PLC PRG_MODBUS_TCP program to generate a alternating switching bit and a analog value that kept changing, here with a triangle waveform 0 to 1000 over 60 seconds. Notice how the REAL value is written into the Union using the .AsReal attribute to write into the correct part of it.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"286\" src=\"http:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_test1-1024x286.jpg\" alt=\"\" class=\"wp-image-162\" srcset=\"https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_test1-1024x286.jpg 1024w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_test1-300x84.jpg 300w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_test1-768x215.jpg 768w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_test1.jpg 1503w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>Codesys test program generating values to be transmitter from the slave<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Looking at the transmitting program, it can be seen that the REAL value is now represented as two WORD that is transmitted in each their register.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"351\" src=\"http:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_test2-1024x351.jpg\" alt=\"\" class=\"wp-image-163\" srcset=\"https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_test2-1024x351.jpg 1024w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_test2-300x103.jpg 300w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_test2-768x263.jpg 768w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_test2.jpg 1425w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>Codesys MODBUS TCP Slave PLC program<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The result of our hard work is now seen in the Master PLC that receives the data perfectly fine and the transmitted WORD registers is translated into BIT and REAL values to be used.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"398\" src=\"http:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_test3-1024x398.jpg\" alt=\"\" class=\"wp-image-164\" srcset=\"https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_test3-1024x398.jpg 1024w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_test3-300x116.jpg 300w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_test3-768x298.jpg 768w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/modbus_tcp_codesys_test3.jpg 1440w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>Codesys MODBUS TCP Master PLC program<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">MODBUS TCP communication is simple and easy to configure in Codesys Development System V3.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is a example code of how to set up Master &lt;&#8211; Slave communication between two Codesys Runtime controllers. This example was made in Codesys version 3.5.16.20 . This example is intentionally set up as one-way communication, so you have to repeat the Master\/Slave setup in both controllers or change the configuration to use R\/W<\/p>\n<p class=\"excert-link-wrapper\"><a href=\"https:\/\/disorder.dk\/wonderware\/2020\/10\/07\/modbus-tcp-between-codesys-controllers\/\" class=\"excerpt-more-link\" >Continue Reading<span class=\"screen-reader-text\"> &#8220;MODBUS TCP between Codesys controllers&#8221;<\/span><span class=\"meta-nav\"> &rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":165,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[37],"tags":[34,45,46,44,40,42,43,41],"class_list":["post-144","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-codesys","tag-codesys","tag-communication","tag-ethernet","tag-ip","tag-modbus","tag-modbus-tcp","tag-network","tag-tcp"],"jetpack_featured_media_url":"https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2020\/10\/codesys_modbus.jpg","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/disorder.dk\/wonderware\/wp-json\/wp\/v2\/posts\/144","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/disorder.dk\/wonderware\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/disorder.dk\/wonderware\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/disorder.dk\/wonderware\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/disorder.dk\/wonderware\/wp-json\/wp\/v2\/comments?post=144"}],"version-history":[{"count":3,"href":"https:\/\/disorder.dk\/wonderware\/wp-json\/wp\/v2\/posts\/144\/revisions"}],"predecessor-version":[{"id":166,"href":"https:\/\/disorder.dk\/wonderware\/wp-json\/wp\/v2\/posts\/144\/revisions\/166"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/disorder.dk\/wonderware\/wp-json\/wp\/v2\/media\/165"}],"wp:attachment":[{"href":"https:\/\/disorder.dk\/wonderware\/wp-json\/wp\/v2\/media?parent=144"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/disorder.dk\/wonderware\/wp-json\/wp\/v2\/categories?post=144"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/disorder.dk\/wonderware\/wp-json\/wp\/v2\/tags?post=144"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}