<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to SFC Grafcet changes cause Modbus TCP slave driver to swap bytes in the communication</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/d7107d95cb/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/d7107d95cb/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/d7107d95cb/</id><updated>2020-11-27T09:53:12.537000Z</updated><subtitle>Recent posts to SFC Grafcet changes cause Modbus TCP slave driver to swap bytes in the communication</subtitle><entry><title>SFC Grafcet changes cause Modbus TCP slave driver to swap bytes in the communication</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/d7107d95cb/?limit=25#08cc" rel="alternate"/><published>2020-11-27T09:53:12.537000Z</published><updated>2020-11-27T09:53:12.537000Z</updated><author><name>hlandaluce</name><uri>https://forge.codesys.com/u/hlandaluce/</uri></author><id>https://forge.codesys.comf527fc1202f6b5dd1590737c77d32489267b7e4a</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Oh! Thank you dFX, I needed to update variables with the bus cycle task. Now it seems to work perfectly. &lt;/p&gt;
&lt;p&gt;Thanks! =D&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>SFC Grafcet changes cause Modbus TCP slave driver to swap bytes in the communication</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/d7107d95cb/?limit=100#5e2d" rel="alternate"/><published>2020-11-27T07:27:57.848000Z</published><updated>2020-11-27T07:27:57.848000Z</updated><author><name>dFx</name><uri>https://forge.codesys.com/u/dfx/</uri></author><id>https://forge.codesys.com85b5ea7edd19867172829a5768e01696db8cfb75</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I'm running 3.5 SP12 and I can't open your project.&lt;/p&gt;
&lt;p&gt;If you are using a slave device, then just make sure the refresh task is correctly set (bus cycle task).&lt;br/&gt;
Still, the addressing offsets may apply.&lt;br/&gt;
Maybe your troubles are related to online edits and are solved with a download ? This could be pointers related stuff.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>SFC Grafcet changes cause Modbus TCP slave driver to swap bytes in the communication</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/d7107d95cb/?limit=25#2105" rel="alternate"/><published>2020-11-26T16:12:36.324000Z</published><updated>2020-11-26T16:12:36.324000Z</updated><author><name>hlandaluce</name><uri>https://forge.codesys.com/u/hlandaluce/</uri></author><id>https://forge.codesys.com63a52ad3eb0466fed684e5804dbd5fce1945e899</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi! &lt;/p&gt;
&lt;p&gt;Thank you for the response dFx. I think i didn't explain myself very well. &lt;br/&gt;
SFC is processing a sequence of a process that is simulated by a software called VirtualmakTCP, reading the %IW0 and writing the %QW0 that the ModbusTCPslave is exchaning with the process simulator. I'm not using any modbus blocks, just using the ModbusTCP_Slave_Device added to the project.&lt;br/&gt;
The issue is that, depending on what I program on an FB written in SFC, the ModbusTCP device swaps the inputs from %IB0 to %IB1. And if I undo, for example, the branch of the SFC (that apparently has nothing to do with the modbus device), it works correctly. But I can't identify what is generating the problem. &lt;/p&gt;
&lt;p&gt;I attach my codesys project, just in case you could tell me if I'm doing something wrong with the Modbus device.&lt;br/&gt;
Thank you!&lt;/p&gt;
&lt;p&gt;Hugo&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>SFC Grafcet changes cause Modbus TCP slave driver to swap bytes in the communication</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/d7107d95cb/?limit=100#54cf" rel="alternate"/><published>2020-11-26T14:09:03.567000Z</published><updated>2020-11-26T14:09:03.567000Z</updated><author><name>dFx</name><uri>https://forge.codesys.com/u/dfx/</uri></author><id>https://forge.codesys.com696820375273f4537eabd22e3efc56b9e8885c91</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;SFC is not the language I would choose for processing any communication like modbusTCP is.&lt;/p&gt;
&lt;p&gt;Correct me if I'm wrong: the Controlwin PLC is the modbusTCP slave (so, the server awainting for client to connect and issue requests).&lt;br/&gt;
You are trying to read 2 bytes, namely %IB0 and %IB1, and to write 1 other (%QB0).&lt;/p&gt;
&lt;p&gt;First of all, be aware that modbus is a 16bit (word) oriented protocol. So, writing a byte is totally wrong. You are either writing some coils (bits), one by one, or writing a multiple of words (n times 16bits). So you first issue may come from this.&lt;/p&gt;
&lt;p&gt;Then, modbus addresses and byte endiantness my give you a headhache.&lt;br/&gt;
In modbus, addresses are starting from 0 protocol wise, but, the first available address is 1(translated as 0 in the protocol). Make sure you are writing the right address. Exemple : write 16#0110 to your address, and verify that the plc sees 16#0110.&lt;br/&gt;
If the PLC is reading 16#0001 or 16#1000, then you have a wrong addressing, offseted by 1. &lt;br/&gt;
If the PLC is reading 16#1001, then you have a byte swap between your two systems (Controlwin PLC and simulation software)&lt;/p&gt;
&lt;p&gt;About SFC, you should make sure, the modbusTCP server functionblock is correctly called every scan cycle.&lt;br/&gt;
If my previous tips didn't help, please consider sending some screenshots or sources about your SFC.&lt;br/&gt;
Also, while speaking about SFC, is your branch an OR or AND branch ?&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br/&gt;
dFx&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>SFC Grafcet changes cause Modbus TCP slave driver to swap bytes in the communication</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/d7107d95cb/?limit=25#1da0" rel="alternate"/><published>2020-11-26T10:29:41.478000Z</published><updated>2020-11-26T10:29:41.478000Z</updated><author><name>hlandaluce</name><uri>https://forge.codesys.com/u/hlandaluce/</uri></author><id>https://forge.codesys.coma612644ca3d1f434ecd936966f507faeccfe2819</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I'm using a simulation software communicated with a Control Win V3 using by ModbusTCP as a slave. I'm reading two bytes %IB0 and %IB1, and writing one byte at %QB0. All signals are read and written from a POU using SFC language. The problem comes when I create a bifurcation in the grafcet. When the simulation software modifies my %IB0 nothing happens, and if it modifies %IB1, changes are applied also to %IB0. And if I remove again the bifurcation of the SFC grafcet, it starts to work correctly again.&lt;/p&gt;
&lt;p&gt;It seems like a bug on the ModbusTCP slave driver, or am I doing something wrong?&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>