<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to "Function block call requires an instance" calling an action</title><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/e0a5490012/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/e0a5490012/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/CODESYS-V2/thread/e0a5490012/</id><updated>2020-02-27T21:56:41.886000Z</updated><subtitle>Recent posts to "Function block call requires an instance" calling an action</subtitle><entry><title>"Function block call requires an instance" calling an action</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/e0a5490012/?limit=25#3df1" rel="alternate"/><published>2020-02-27T21:56:41.886000Z</published><updated>2020-02-27T21:56:41.886000Z</updated><author><name>shooter</name><uri>https://forge.codesys.com/u/shooter/</uri></author><id>https://forge.codesys.com3a3759ba91ba02a7bfe1706f555ff106782e394a</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;and you are also calling this function block twice (that is no good practice, however i do know why as you want the same blockresults.&lt;br/&gt;
You may give the values in front of the call.&lt;/p&gt;
&lt;p&gt;Especcially when using timers this often is a problem, the compiler does not see these problems.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>"Function block call requires an instance" calling an action</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/e0a5490012/?limit=25#933b" rel="alternate"/><published>2020-02-27T21:56:37.714000Z</published><updated>2020-02-27T21:56:37.714000Z</updated><author><name>standeven</name><uri>https://forge.codesys.com/u/standeven/</uri></author><id>https://forge.codesys.comb9f915cbf4a47105cc9d43e09b102889c2f6106f</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I solved the problem. &lt;/p&gt;
&lt;p&gt;The problem was that I had a variable in the function block with the same name as the action (variable name was zeroCount, action name was ZeroCount). This confused the compiler, so I renamed my action and now it works.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>"Function block call requires an instance" calling an action</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/e0a5490012/?limit=25#fc46" rel="alternate"/><published>2020-02-27T21:56:36.186000Z</published><updated>2020-02-27T21:56:36.186000Z</updated><author><name>standeven</name><uri>https://forge.codesys.com/u/standeven/</uri></author><id>https://forge.codesys.comcb9e04e4e9b4e4b6db99e6efa91b7b76894cf643</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Using Codesys 2.3, I'm getting the following error:&lt;/p&gt;
&lt;p&gt;"A function block call requires a function block instance."&lt;/p&gt;
&lt;p&gt;My call to the function is in a PRG as follows:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nv"&gt;PROGRAM&lt;/span&gt; &lt;span class="nv"&gt;TestProgram&lt;/span&gt;
&lt;span class="nv"&gt;VAR&lt;/span&gt;
    &lt;span class="nv"&gt;testFunctionBlock&lt;/span&gt;:&lt;span class="nv"&gt;MyFunctionBlock&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
    &lt;span class="nv"&gt;callAction&lt;/span&gt;:&lt;span class="nv"&gt;BOOL&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;END_VAR&lt;/span&gt;
&lt;span class="nv"&gt;testFunctionBlock&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;inputVar&lt;/span&gt;:&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;IF&lt;/span&gt; &lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;callAction&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt; &lt;span class="k"&gt;THEN&lt;/span&gt;
    &lt;span class="nv"&gt;testFunctionBlock&lt;/span&gt;.&lt;span class="nv"&gt;testAction&lt;/span&gt;&lt;span class="ss"&gt;()&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;END_IF&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Any idea why this won't build? The function block is instantiated, so I'm not sure what's going on. I suspect I might be calling the action wrong.&lt;/p&gt;
&lt;p&gt;Thanks for any help!&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>