<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Error handling while reading Modbus TCP</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/96751944ca/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/96751944ca/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/96751944ca/</id><updated>2020-02-27T13:56:49.205000Z</updated><subtitle>Recent posts to Error handling while reading Modbus TCP</subtitle><entry><title>Error handling while reading Modbus TCP</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/96751944ca/?limit=25#6b12" rel="alternate"/><published>2020-02-27T13:56:49.205000Z</published><updated>2020-02-27T13:56:49.205000Z</updated><author><name>timvh</name><uri>https://forge.codesys.com/u/timvh/</uri></author><id>https://forge.codesys.com1290c33efd984803578c06eaa27e26751d8bf7e7</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Each modbus slave device has a property "byModbusError".&lt;br/&gt;
In your case you can use e.g. the following code:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;Mb1State&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Modbus_TCP_Slave&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;byModbusError&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Mb1State is then of the following type:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nt"&gt;VAR&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="nt"&gt;Mb1State&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;IoDrvModbusTCP&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;MB_ErrorCodes&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nt"&gt;END_VAR&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;In the library "IoDrvModbusTCP" you can find this ENUM (in the Structs folder) to see the details.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Error handling while reading Modbus TCP</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/96751944ca/?limit=25#bca8" rel="alternate"/><published>2020-02-27T13:56:48.463000Z</published><updated>2020-02-27T13:56:48.463000Z</updated><author><name>teichhei</name><uri>https://forge.codesys.com/u/teichhei/</uri></author><id>https://forge.codesys.com649f5ddb13d01c02ec7343393d24331d66f02088</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;If you have control over the slaves you could toggle a bit and increase a counter on the slave side and read that back, make sure it increases. But if there is a way to access the on board diagnostics from Codesys that would be nice.&lt;/p&gt;
&lt;p&gt;Sent from my SM-G935F using Tapatalk&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Error handling while reading Modbus TCP</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/96751944ca/?limit=25#d851" rel="alternate"/><published>2020-02-27T13:56:48.235000Z</published><updated>2020-02-27T13:56:48.235000Z</updated><author><name>meuzumcu</name><uri>https://forge.codesys.com/u/meuzumcu/</uri></author><id>https://forge.codesys.comac4826191b7f6e86fd793590e36fa0e7a5369f51</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi..&lt;/p&gt;
&lt;p&gt;In my project I want to read registers from a modbus tcp slave device. In normal conditions everything is ok but I must handle an error bit while an reading or socket error at communication.&lt;br/&gt;
For example when turn off the power of slave device, a communication error occurs. So how can understand the error of modbus tcp.&lt;/p&gt;
&lt;p&gt;Thanks already..&lt;/p&gt;
&lt;p&gt;&lt;a class="" href="https://hizliresim.com/6XlO83" rel="nofollow"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: Bild" rel="nofollow" src="https://i.hizliresim.com/6XlO83.png"/&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>