<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Modus RTU keine Werte</title><link href="https://forge.codesys.com/forge/talk/Deutsch/thread/71802143fc/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Deutsch/thread/71802143fc/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Deutsch/thread/71802143fc/</id><updated>2020-02-28T03:50:53.974000Z</updated><subtitle>Recent posts to Modus RTU keine Werte</subtitle><entry><title>Modus RTU keine Werte</title><link href="https://forge.codesys.com/forge/talk/Deutsch/thread/71802143fc/?limit=25#98cf" rel="alternate"/><published>2020-02-28T03:50:53.974000Z</published><updated>2020-02-28T03:50:53.974000Z</updated><author><name>eschwellinger</name><uri>https://forge.codesys.com/u/eschwellinger/</uri></author><id>https://forge.codesys.comce02bf880c2c2db64b29371f5dc66ffde0740fe4</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;die Werte werden nicht aktualisiert weil du keine Variablen gemappt hast und diese nirgends in den Pou's&lt;br/&gt;
verwendest. Das ist bei allen Feldbussen so, nur die Variablen die gemappt &amp;amp; verwendet werden werden auch aktualisiert.&lt;br/&gt;
Sehen tut man das in der Spalte aktueller Wert - hellgrau - nicht gemapped und verwendet - schwarz Wert wird aktualisiert.&lt;/p&gt;
&lt;p&gt;Alternativ kannst du auf immer aktualisieren stellen, dann gehts auch ohne mapping.&lt;/p&gt;
&lt;p&gt;Grüsse Edwin&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: hellgrau.jpg" rel="nofollow" src="https://forum-de.codesys.com//download/file.php?id=1920"/&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: Enable2.jpg" rel="nofollow" src="https://forum-de.codesys.com//download/file.php?id=1919"/&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Modus RTU keine Werte</title><link href="https://forge.codesys.com/forge/talk/Deutsch/thread/71802143fc/?limit=25#1443" rel="alternate"/><published>2020-02-28T03:50:51.950000Z</published><updated>2020-02-28T03:50:51.950000Z</updated><author><name>brudal1</name><uri>https://forge.codesys.com/u/brudal1/</uri></author><id>https://forge.codesys.com874da939676c63fa801837562cd6a023885702f4</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hallo,&lt;br/&gt;
ich versuche vom einen Arduino Nano über Modbus RTU RS485 an meinen Raspberry Daten anzubinden.&lt;/p&gt;
&lt;p&gt;Auf dem Arduino ist ein Modbus Slave den ich mit einen Modbus Master Simulator auf meinen PC erfolgreichen verbinden konnte.&lt;/p&gt;
&lt;p&gt;Im Codesys läuft die Verbindung ebenfalls.&lt;br/&gt;
Es werden aber keine Werte angezeigt.&lt;/p&gt;
&lt;p&gt;Ich verwende auf dem Arduino folgende Modbus Slave library&lt;br/&gt;
&lt;a class="" href="https://github.com/smarmengol/Modbus-Master-Slave-for-Arduino" rel="nofollow"&gt;https://github.com/smarmengol/Modbus-Master-Slave-for-Arduino&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Das ist der Code auf dem Arduino&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt;\#&lt;/span&gt;&lt;span class="n"&gt;include&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;ModbusRtu&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;h&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="c1"&gt;// data array for modbus network sharing&lt;/span&gt;
&lt;span class="kt"&gt;uint16_t&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="mi"&gt;45&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;90&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;180&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;360&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;720&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1440&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2880&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5760&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;11520&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;23040&lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="cm"&gt;/**&lt;/span&gt;
&lt;span class="cm"&gt; *  Modbus object declaration&lt;/span&gt;
&lt;span class="cm"&gt; *  u8id : node id = 0 for master, = 1..247 for slave&lt;/span&gt;
&lt;span class="cm"&gt; *  u8serno : serial port (use 0 for Serial)&lt;/span&gt;
&lt;span class="cm"&gt; *  u8txenpin : 0 for RS-232 and USB-FTDI &lt;/span&gt;
&lt;span class="cm"&gt; *               or any pin number &amp;gt; 1 for RS-485&lt;/span&gt;
&lt;span class="cm"&gt; */&lt;/span&gt;
&lt;span class="n"&gt;Modbus&lt;/span&gt; &lt;span class="nf"&gt;slave&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// this is slave @1 and RS-232 or USB-FTDI&lt;/span&gt;
&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;setup&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="n"&gt;slave&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;begin&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="mi"&gt;19200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;SERIAL_8E1&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 19200 baud, 8-bits, even, 1-bit stop&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;loop&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="n"&gt;slave&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;poll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Auf dem RaspberryPi habe ich einen USB RS485 Adapter den ich in der CODESYSControl.cfg eingetragen habe.&lt;/p&gt;
&lt;p&gt;Der Master und Slave läuft (wenn ich die RS485 Leitung unterbrechen geht der Slave auch auf Störung)&lt;/p&gt;
&lt;p&gt;Warum werden die Werte nicht übertragen, was mache ich falsch?&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: ModBusMasterEinstellung.jpg" rel="nofollow" src="https://forum-de.codesys.com//download/file.php?id=1912"/&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: ModBusSlaveEinstellung.jpg" rel="nofollow" src="https://forum-de.codesys.com//download/file.php?id=1910"/&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: ModBusSlaveStatus.jpg" rel="nofollow" src="https://forum-de.codesys.com//download/file.php?id=1909"/&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: ModBusSlaveKanal.jpg" rel="nofollow" src="https://forum-de.codesys.com//download/file.php?id=1908"/&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: ModBusMasterSimulator.jpg" rel="nofollow" src="https://forum-de.codesys.com//download/file.php?id=1907"/&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: ModBusSlaveEA" rel="nofollow" src="https://forum-de.codesys.com//download/file.php?id=1906"/&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>