<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Strange value assigment</title><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/afd1a49da8/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/afd1a49da8/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/CODESYS-V2/thread/afd1a49da8/</id><updated>2020-02-27T22:42:20.037000Z</updated><subtitle>Recent posts to Strange value assigment</subtitle><entry><title>Strange value assigment</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/afd1a49da8/?limit=25#9911" rel="alternate"/><published>2020-02-27T22:42:20.037000Z</published><updated>2020-02-27T22:42:20.037000Z</updated><author><name>rlecallo</name><uri>https://forge.codesys.com/u/rlecallo/</uri></author><id>https://forge.codesys.com992c7a3e9e21d04b969af620883d2fd0c9c631b6</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I have fund something very strange. The value in a variable follow the value in an other variable without assigment bettween there.&lt;/p&gt;
&lt;p&gt;&lt;span style="color: underline;"&gt;Focus on code:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;VAR_GLOBAL&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;StateLanguage&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;INT&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;END_VAR&lt;/p&gt;
&lt;p&gt;VAR&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;LastLanguageTime&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;INT&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;change_Language&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;BOOL&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;END_VAR&lt;/p&gt;
&lt;p&gt;IF StateLanguage&amp;lt;&amp;gt;LastLanguageTime THEN&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nt"&gt;LastLanguageTime&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="nt"&gt;StateLanguage&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="nt"&gt;change_Language&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="nt"&gt;TRUE&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;END_IF&lt;/p&gt;
&lt;p&gt;IF change_Language=TRUE THEN&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c"&gt;(*lot of things*)&lt;/span&gt;

&lt;span class="n"&gt;change_Language&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="n"&gt;FALSE&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;END_IF&lt;/p&gt;
&lt;p&gt;&lt;span style="color: underline;"&gt;Describe of the problem:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;The 2 local variable are not used in other part of the project (not 2 times the same name).&lt;/p&gt;
&lt;p&gt;I download the program in the board and go in debug mode.&lt;/p&gt;
&lt;p&gt;When StateLanguage is 1, LastLanguageTime become 1 and change_Language is lock at TRUE.&lt;/p&gt;
&lt;p&gt;When StateLanguage is 2, LastLanguageTime become 2 and change_Language become "&lt;strong&gt;&lt;em&gt; INVALID: 16#02 &lt;/em&gt;&lt;/strong&gt;".&lt;/p&gt;
&lt;p&gt;If I forced change_Language to FALSE, LastLanguageTime was locked to 0 and StateLanguage continu to evoluate in function of other part of the program.&lt;/p&gt;
&lt;p&gt;&lt;span style="color: underline;"&gt;Tried things:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Change names of variables.&lt;/p&gt;
&lt;p&gt;Change position of declaration of these variables.&lt;/p&gt;
&lt;p&gt;&lt;span style="color: underline;"&gt;Precision:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;My code use almost all the memory. What append with CoDeSys if we need more variables than possible in memory?&lt;/p&gt;
&lt;p&gt;CoDeSys 2.3.4.1 and Target Controler Inside&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>