<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Set REFERENCE to 0 (null) when no longer used</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/58660892d0/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/58660892d0/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/58660892d0/</id><updated>2024-10-07T20:20:30.899000Z</updated><subtitle>Recent posts to Set REFERENCE to 0 (null) when no longer used</subtitle><entry><title>Set REFERENCE to 0 (null) when no longer used</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/58660892d0/?limit=25#b1a7/fda1" rel="alternate"/><published>2024-10-07T20:20:30.899000Z</published><updated>2024-10-07T20:20:30.899000Z</updated><author><name>jtebokkel</name><uri>https://forge.codesys.com/u/jtebokkel/</uri></author><id>https://forge.codesys.comb5507894139eee0983e7f7efa5fc0233c74b0270</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;yes, it works&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Set REFERENCE to 0 (null) when no longer used</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/58660892d0/?limit=25#b1a7" rel="alternate"/><published>2024-10-02T11:15:56.112000Z</published><updated>2024-10-02T11:15:56.112000Z</updated><author><name>olemart</name><uri>https://forge.codesys.com/u/olemart/</uri></author><id>https://forge.codesys.com5c2052c6e9f9e527fbf7f93e55e23111ed5c53a6</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Did you find out if this work?&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Set REFERENCE to 0 (null) when no longer used</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/58660892d0/?limit=25#dde4" rel="alternate"/><published>2020-05-30T00:08:23.030000Z</published><updated>2020-05-30T00:08:23.030000Z</updated><author><name>jtebokkel</name><uri>https://forge.codesys.com/u/jtebokkel/</uri></author><id>https://forge.codesys.com681ab9891c85ce88495a97253872cdbf14d7da3c</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;ok, so I was playing around with some tests today and the code I was looking at I didn't actually try and build/run because I was missing libraries for it.&lt;/p&gt;
&lt;p&gt;Turns out you can build and run&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;THIS&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;refLamp&lt;/span&gt; &lt;span class="k"&gt;REF&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;it is just the precomplier that complains about it. Is this a bug then in the precompiler? &lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Set REFERENCE to 0 (null) when no longer used</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/58660892d0/?limit=25#7102" rel="alternate"/><published>2020-05-25T17:59:40.628000Z</published><updated>2020-05-25T17:59:40.628000Z</updated><author><name>jtebokkel</name><uri>https://forge.codesys.com/u/jtebokkel/</uri></author><id>https://forge.codesys.comffa17579d986ebc7b4853c23ed0fac1a58bc4f34</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Is there a way to work around the error that happens when trying to set a reference to 0 after it isn't needed or is invalid? Trying to do this in codesys &amp;gt;= V3.5.15 results in an error. See example below. Now I could great a GVL with a bunch of unset references, but I'd end up with a large amount of null types.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nv"&gt;METHOD&lt;/span&gt; &lt;span class="nv"&gt;FB_init&lt;/span&gt; : &lt;span class="nv"&gt;BOOL&lt;/span&gt;
&lt;span class="nv"&gt;VAR_INPUT&lt;/span&gt;
    &lt;span class="nv"&gt;bInitRetains&lt;/span&gt; : &lt;span class="nv"&gt;BOOL&lt;/span&gt;&lt;span class="c1"&gt;; // if TRUE, the retain variables are initialized (warm start / cold start)&lt;/span&gt;
    &lt;span class="nv"&gt;bInCopyCode&lt;/span&gt; : &lt;span class="nv"&gt;BOOL&lt;/span&gt;&lt;span class="c1"&gt;;  // if TRUE, the instance afterwards gets moved into the copy code (online change)&lt;/span&gt;
    &lt;span class="nv"&gt;refLamp&lt;/span&gt; : &lt;span class="nv"&gt;REFERENCE&lt;/span&gt; &lt;span class="nv"&gt;TO&lt;/span&gt; &lt;span class="nv"&gt;FB_Lamp&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
    &lt;span class="nv"&gt;byNewLevel&lt;/span&gt; : &lt;span class="nv"&gt;BYTE&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;END_VAR&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;__ISVALIDREF&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;refLamp&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;THIS&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;.&lt;span class="nv"&gt;refLamp&lt;/span&gt; &lt;span class="nv"&gt;REF&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;refLamp&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;ELSE&lt;/span&gt;
    &lt;span class="nv"&gt;THIS&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;.&lt;span class="nv"&gt;refLamp&lt;/span&gt; &lt;span class="nv"&gt;REF&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;END_IF&lt;/span&gt;
&lt;span class="nv"&gt;THIS&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;.&lt;span class="nv"&gt;byNewLevel&lt;/span&gt; :&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;byNewLevel&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;/div&gt;</summary></entry></feed>