<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Modbus TCP manually with Codesys 3.5.16SP2</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/2d12942f29/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/2d12942f29/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/2d12942f29/</id><updated>2023-04-28T11:35:07.743000Z</updated><subtitle>Recent posts to Modbus TCP manually with Codesys 3.5.16SP2</subtitle><entry><title>Modbus TCP manually with Codesys 3.5.16SP2</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/2d12942f29/?limit=25#dda3" rel="alternate"/><published>2023-04-28T11:35:07.743000Z</published><updated>2023-04-28T11:35:07.743000Z</updated><author><name>jari-koivuluoma</name><uri>https://forge.codesys.com/u/jari-koivuluoma/</uri></author><id>https://forge.codesys.comcff61cbdda9e97e07e6f52b58ad4eef9dc6cea49</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;The problem was that I had an instance of the ModbusRequest for each query and they were operating on parallel. Apparently you must use only 1 instance or at least not run them on parallel.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Modbus TCP manually with Codesys 3.5.16SP2</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/2d12942f29/?limit=25#1197" rel="alternate"/><published>2023-04-24T12:09:29.777000Z</published><updated>2023-04-24T12:09:29.777000Z</updated><author><name>jari-koivuluoma</name><uri>https://forge.codesys.com/u/jari-koivuluoma/</uri></author><id>https://forge.codesys.com71b318ba808d5358c712c25242376e7437fb59c1</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Yes, that did it and quite straight forwardly after all. Basically I just used a TON and ModbudRequest FB to refresh the data from and to the process image of the couplers. The FB required the a pointer to the slave instance in the device tree nyt nothing fancier than that.&lt;/p&gt;
&lt;p&gt;However I have another problem. I wrote a seperate project to demonstrate the idea and it worked nicely. However after I integrated it to my actual project I started to get exeptions.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Pic1" rel="nofollow" src="https://www.dropbox.com/s/vhm8fazj3k93bil/Capture1.PNG?dl=0"/&gt;&lt;/p&gt;
&lt;p&gt;What I get from this screenshot is that the error happens in the Modbus library function PutNWords.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Pic2" rel="nofollow" src="https://www.dropbox.com/s/vhm8fazj3k93bil/Capture2.PNG?dl=0"/&gt;&lt;/p&gt;
&lt;p&gt;But also this screenshot seem to show that it has something to do with the other task (BackupTask) I have running every 1 ms. While the main task is running every 20 ms.&lt;/p&gt;
&lt;p&gt;The BackupTask runs a program that writes all of my parameter structures to files and there is about 4000 of them so it takes so long that I put the writing to its own task.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Modbus TCP manually with Codesys 3.5.16SP2</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/2d12942f29/?limit=25#dfb7" rel="alternate"/><published>2023-03-31T15:37:08.002000Z</published><updated>2023-03-31T15:37:08.002000Z</updated><author><name>snhatton</name><uri>https://forge.codesys.com/u/snhatton/</uri></author><id>https://forge.codesys.comb57884d6f4c0f46131d12debc9cdbdbf0e9c2a9b</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I think the IoDrvModbusTCP library would work for you. From here you can write IEC code to connect to and configure your modbus devices without having to manage the device tree. Hope this helps! &lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Modbus TCP manually with Codesys 3.5.16SP2</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/2d12942f29/?limit=25#f20b" rel="alternate"/><published>2023-03-17T12:48:06.316000Z</published><updated>2023-03-17T12:48:06.316000Z</updated><author><name>jari-koivuluoma</name><uri>https://forge.codesys.com/u/jari-koivuluoma/</uri></author><id>https://forge.codesys.com9b4d436faf726e406b29d24ddd99e51418cd4c8b</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello&lt;/p&gt;
&lt;p&gt;Im planning to use varying amount of Beckhoff EK9000 ModbusTCP coupler with varying amounts of basic input and output terminals attached to them.&lt;/p&gt;
&lt;p&gt;I want to be able to change the amount of couplers and terminals without altering the source project.&lt;/p&gt;
&lt;p&gt;So I need to be able to communicate with Modbus TCP slave couplers with their IP addresses (and all other possible settings) coming from variables rather than being static.&lt;/p&gt;
&lt;p&gt;Also the mapping of the data on the devices will not be static either and I need to calculate the right spot of the data based on the amounts, types and positions on the terminals of the couplers also stored in variables.&lt;/p&gt;
&lt;p&gt;I have never even used Modbus in the standard way so I might need some help.&lt;/p&gt;
&lt;p&gt;I would imagine that I would have to add Ethernet and Modbus TCP master to the device tree and from there use some library function blocks but this is just me guessing.&lt;/p&gt;
&lt;p&gt;The most unclear part is that how do I read and write to the slaves purely by code?&lt;/p&gt;
&lt;p&gt;Could someone please provide me a some kind of rough outlines of how it goes? And/or some example code?&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>