<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Problem with COM_MOD_MAST in AC500!</title><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/08b10a587b/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/08b10a587b/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/CODESYS-V2/thread/08b10a587b/</id><updated>2020-02-27T21:33:32.339000Z</updated><subtitle>Recent posts to Problem with COM_MOD_MAST in AC500!</subtitle><entry><title>Problem with COM_MOD_MAST in AC500!</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/08b10a587b/?limit=25#7411" rel="alternate"/><published>2020-02-27T21:33:32.339000Z</published><updated>2020-02-27T21:33:32.339000Z</updated><author><name>flaendsdal</name><uri>https://forge.codesys.com/u/flaendsdal/</uri></author><id>https://forge.codesys.comb079b3a66108b21675b267cc276748ca7a02cb55</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;occam hat geschrieben:&lt;/strong&gt;&lt;br/&gt;
The manual says: "After completing or aborting the processing (due to an error), DONE is set to TRUE for one cycle." - no idea what does cycle mean in this case?!?!&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;You have to do then check for DONE and ERR in program B.&lt;br/&gt;
a Cycle in this case is at then from fiste time it hit COM_MOD_MASTER to then then next time..&lt;/p&gt;
&lt;p&gt;Flændsdal&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Problem with COM_MOD_MAST in AC500!</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/08b10a587b/?limit=25#87f4" rel="alternate"/><published>2020-02-27T21:33:28.229000Z</published><updated>2020-02-27T21:33:28.229000Z</updated><author><name>occam</name><uri>https://forge.codesys.com/u/occam/</uri></author><id>https://forge.codesys.comf413a89f3bf6c46cb7a54fc9fbcd59c9d14279f5</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi all!&lt;br/&gt;
I'm having a hard time using the MODBUS RTU interface on the AC 500 and would appreciate any hint:&lt;br/&gt;
The application is running several programs (POUs) written in ST.&lt;br/&gt;
&lt;strong&gt;Program A&lt;/strong&gt; (cyclic, priority 20, @ 500 ms) implements a set of synchronization flags and CASE statement used to select different Modbus requests and feed them to the COM_MOD_MAST block in program B and set the event triggering program B. &lt;br/&gt;
&lt;strong&gt;Program B&lt;/strong&gt; (event triggered, priority 10) basically consists of a COM_MOD_MAST block and some synchronization logic to notify program A that the request is processed.&lt;br/&gt;
So far everything runs fine, but when I cut the RS485 connection to any/all of the MODBUS slaves DONE and ERR in the COM_MOD_MAST are not affected, and regardless of the TIMEOUT parameter the COM_MOD_MAST gets executed immediately (I measured the time before and after the COM_MOD_MAST it's &amp;lt; 1 ms). When I set a breakpoint at the statement containing the COM_MOD_MAST the DONE and ERR parameters are set correctly, but at the next statement they are gone. I tried assigning DONE and ERR to global variables:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;MBTxRq&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;EN&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;TRUE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt;  &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="n"&gt;COM&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&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="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;MBSlaveDvADR&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt;  &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="n"&gt;FCT&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;FunctCode&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt;  &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="n"&gt;TIMEOUT&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;MB_COMM_TOUT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt;  &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="n"&gt;ADDR&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;MBSlaveRqAddr&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt;  &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="n"&gt;NB&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;MBRxLngth&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt;  &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="k"&gt;DATA&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;MBRxDataAdr&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt;  &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="n"&gt;DONE&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;Mod_Done&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt;  &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="n"&gt;ERR&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;Mod_Error&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt;  &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="n"&gt;ERNO&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;Mod_ErrNum&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;without success.  Waiting for MBTxRq.ERNO to get nonzero was no help either.&lt;br/&gt;
Even using F_TRIG/R_TRIG available in the library in order to capture ERR and DONE was no cure.&lt;br/&gt;
The manual says: "After completing or aborting the processing (due to an error), DONE is set to TRUE for one cycle." - no idea what does cycle mean in this case?!?!&lt;br/&gt;
Thnx in advance!&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>