<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Sequential read and triggering of Modbs RTU channels in application</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/438e7c57cd/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/438e7c57cd/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/438e7c57cd/</id><updated>2025-05-16T14:31:02.493000Z</updated><subtitle>Recent posts to Sequential read and triggering of Modbs RTU channels in application</subtitle><entry><title>Sequential read and triggering of Modbs RTU channels in application</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/438e7c57cd/?limit=25#b24d" rel="alternate"/><published>2025-05-16T14:31:02.493000Z</published><updated>2025-05-16T14:31:02.493000Z</updated><author><name>elsmart</name><uri>https://forge.codesys.com/u/elsmart/</uri></author><id>https://forge.codesys.com9d0dcbce15bc30115269647d2dc8928fcceef2ba</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello&lt;/p&gt;
&lt;p&gt;I need some help understanding how to use Modbus RTU (COM port) in Codesys enviroment. I defined a Modbus Server device (slave) in device tree and added some channels to read from (function 3). Also I set trigering mode to Application. I have a POU in which I want to trigger each channel one after the other something like this (C code for better visualisation):&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;channelsCount&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;{&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;triggerChannel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;channelsArray&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;Start&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;transmission&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="k"&gt;while&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;channel&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;xBusy&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Wait&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;transmission&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;to&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;complete&lt;/span&gt;

&lt;span class="err"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;I have found ModbusChannel function block documentation but examples are scarce. I don't understand how rising edge triggering works. What would be the best solution for achieving sequntial channel triggering? What is the common way to read multiple Modbus channels once every time a specified POU is executed?&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>