<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Difference between IEC driver implementations</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/521c28d6a7/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/521c28d6a7/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/521c28d6a7/</id><updated>2020-02-27T13:48:13.704000Z</updated><subtitle>Recent posts to Difference between IEC driver implementations</subtitle><entry><title>Difference between IEC driver implementations</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/521c28d6a7/?limit=25#939d" rel="alternate"/><published>2020-02-27T13:48:13.704000Z</published><updated>2020-02-27T13:48:13.704000Z</updated><author><name>AndreyS</name><uri>https://forge.codesys.com/u/andreys/</uri></author><id>https://forge.codesys.comdb89c71044ade65efa712057a7ec757025ff8911</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;If I look at examples of IEC IO-driver implementations, I see two different approaches for developing IEC IO-drviers. &lt;/p&gt;
&lt;p&gt;Here are two examples from devdesc.xml: &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nv"&gt;DriverInfo&lt;/span&gt; &lt;span class="nv"&gt;needsBusCycle&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;false&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nv"&gt;RequiredLib&lt;/span&gt; .... &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nv"&gt;FBInstance&lt;/span&gt; &lt;span class="k"&gt;basename&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;$(DeviceName)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; ... &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nv"&gt;Initialize&lt;/span&gt; &lt;span class="nv"&gt;methodName&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Initialize&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
            &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nv"&gt;CyclicCall&lt;/span&gt; &lt;span class="nv"&gt;methodname&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;AfterReadInputs&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nv"&gt;task&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;#buscycletask&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nv"&gt;whentocall&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;afterReadInputs&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
          &lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nv"&gt;FBInstance&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nv"&gt;RequiredLib&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nv"&gt;DriverInfo&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;and &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nv"&gt;DriverInfo&lt;/span&gt; &lt;span class="nv"&gt;needsBusCycle&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;true&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nv"&gt;RequiredLib&lt;/span&gt; &lt;span class="nv"&gt;libname&lt;/span&gt;... &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nv"&gt;FBInstance&lt;/span&gt; &lt;span class="k"&gt;basename&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;$(DeviceName)_Instance&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; ... &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nv"&gt;Initialize&lt;/span&gt; &lt;span class="nv"&gt;methodName&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Initialize&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
          &lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nv"&gt;FBInstance&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nv"&gt;RequiredLib&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nv"&gt;DriverInfo&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;As I understand, in the first case FB of any type can be used as a IEC-driver. Method AfterReadInputs is called every cycle after read inputs. &lt;br/&gt;
In the second case methods  IoDrvReadInputs, IoDrvWriteInputs (when IO are used in IEC program) and IoDrvStartBusCycle (when needBusCycle is set to true) are called every cycle as well. &lt;/p&gt;
&lt;p&gt;What is the main reason to use first or second method?&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>