<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Modbus TCP programming</title><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/ca3bf2eca7/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/ca3bf2eca7/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/CODESYS-V2/thread/ca3bf2eca7/</id><updated>2020-02-27T23:03:51.549000Z</updated><subtitle>Recent posts to Modbus TCP programming</subtitle><entry><title>Modbus TCP programming</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/ca3bf2eca7/?limit=25#f0aa" rel="alternate"/><published>2020-02-27T23:03:51.549000Z</published><updated>2020-02-27T23:03:51.549000Z</updated><author><name>cincidude</name><uri>https://forge.codesys.com/u/cincidude/</uri></author><id>https://forge.codesys.com4fd74ca38464bc2c93e7d34075f5100b4672424e</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Actually I had the inputs mapped like:&lt;/p&gt;
&lt;p&gt;PLC_PRG.awModbusData&lt;span&gt;[1]&lt;/span&gt;.0 := Input0; &lt;/p&gt;
&lt;p&gt;PLC_PRG.awModbusData&lt;span&gt;[1]&lt;/span&gt;.1 := Input1; &lt;/p&gt;
&lt;p&gt;and it still did not work. Then somebody told me that "awModbusData" should be defined as a global variable. I did that and it worked like a charm. I would have never figured it out since the outputs mapped and worked correctly without declaring "awModbusData" as a global variable. Maybe you have a better idea.&lt;/p&gt;
&lt;p&gt;Anyways, my problem is solved for now. Thanks for your effort.&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;-Dude&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Modbus TCP programming</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/ca3bf2eca7/?limit=25#a769" rel="alternate"/><published>2020-02-27T23:03:49.931000Z</published><updated>2020-02-27T23:03:49.931000Z</updated><author><name>spfeif</name><uri>https://forge.codesys.com/u/spfeif/</uri></author><id>https://forge.codesys.com1e65a6950cda44f8459c4da2bd04cf87af11f00b</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Sounds like you did the following:&lt;/p&gt;
&lt;p&gt;Input0 := PLC_PRG.awModbusData&lt;span&gt;[1]&lt;/span&gt;.0; &lt;/p&gt;
&lt;p&gt;Input1 := PLC_PRG.awModbusData&lt;span&gt;[1]&lt;/span&gt;.1;&lt;/p&gt;
&lt;p&gt;This would cause the error you described change it to :&lt;/p&gt;
&lt;p&gt;PLC_PRG.awModbusData&lt;span&gt;[1]&lt;/span&gt;.0 := Input0; &lt;/p&gt;
&lt;p&gt;PLC_PRG.awModbusData&lt;span&gt;[1]&lt;/span&gt;.1 := Input1;&lt;/p&gt;
&lt;p&gt;Or you don't have awModbusData&lt;span&gt;[1]&lt;/span&gt; configured as output instead as input this will not give it write access as well. Sounds like you might have one or both variables configured as inputs (readonly).&lt;/p&gt;
&lt;p&gt;The CoDeSys error will give you a line number in your code. Try to copy the code to make it easier to help.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Modbus TCP programming</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/ca3bf2eca7/?limit=25#e623" rel="alternate"/><published>2020-02-27T23:03:48.329000Z</published><updated>2020-02-27T23:03:48.329000Z</updated><author><name>cincidude</name><uri>https://forge.codesys.com/u/cincidude/</uri></author><id>https://forge.codesys.coma5e5dc6b5b35698dadc8af23a850769b90e7f837</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;As a follow-up to my own post, I was able to map the Outputs on my Festo PLC to the Mobbus TCP address space. This is the format I used:&lt;/p&gt;
&lt;p&gt;Output0 := PLC_PRG.awModbusData&lt;span&gt;[0]&lt;/span&gt;.0;&lt;/p&gt;
&lt;p&gt;Output1 := PLC_PRG.awModbusData&lt;span&gt;[0]&lt;/span&gt;.1;&lt;/p&gt;
&lt;p&gt;I can successfully switch on these outputs from my ModBus Client. However the same mapping does not work if I want to read in Inputs. Codesys gives the following error:&lt;/p&gt;
&lt;p&gt;Error 4020: Operands of 'ST', 'STN', 'S', 'R' must be variables with write access or direct address. &lt;/p&gt;
&lt;p&gt;I tried using direct addressing and symbolic names but does not work. Any ideas??&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;-Dude&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Modbus TCP programming</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/ca3bf2eca7/?limit=25#d44a" rel="alternate"/><published>2020-02-27T23:03:43.791000Z</published><updated>2020-02-27T23:03:43.791000Z</updated><author><name>cincidude</name><uri>https://forge.codesys.com/u/cincidude/</uri></author><id>https://forge.codesys.coma3058be6a741b97c9fa120e84b1070a9bad8d869</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I'm a newbie to modbus communication. I have a Festo PLC and have configured the Modbus TCP server and can connect to it using a freeware Modbus TCP client  &lt;/p&gt;
&lt;p&gt;Now I want to test the addressing. Apparently the addressing insde the Festo PLC is open and the user is free to choose his own addressing. I'm not sure if I have to write code in Codesys to map the IO and then address these addresses from the client? Or does Codesys provide a way to define this addressing?? Please advice or provide example if available.&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;-Dude&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>