<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to CoDeSys bug? Error Compilation?</title><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/f2bec8441d/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/f2bec8441d/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/CODESYS-V2/thread/f2bec8441d/</id><updated>2020-02-27T19:31:49.755000Z</updated><subtitle>Recent posts to CoDeSys bug? Error Compilation?</subtitle><entry><title>CoDeSys bug? Error Compilation?</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/f2bec8441d/?limit=25#b65d" rel="alternate"/><published>2020-02-27T19:31:49.755000Z</published><updated>2020-02-27T19:31:49.755000Z</updated><author><name>maauto</name><uri>https://forge.codesys.com/u/maauto/</uri></author><id>https://forge.codesys.com96e8a67255ca6dd959d2adebf0f684960957f5d2</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I wouldn't be so sure...have you actually tried this ?&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Zitat:&lt;/strong&gt;&lt;br/&gt;
VAR&lt;br/&gt;
    TestDWord1:DWORD;&lt;br/&gt;
END_VAR&lt;br/&gt;
TestDword1:=WORD_TO_DWORD(ROR(WORD#16#4433,8 ));&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;AND&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Zitat:&lt;/strong&gt;&lt;br/&gt;
VAR CONSTANT&lt;br/&gt;
    abc:WORD:=16#4433;&lt;br/&gt;
END_VAR&lt;br/&gt;
VAR&lt;br/&gt;
        TestDWord2:DWORD;&lt;br/&gt;
END_VAR&lt;br/&gt;
TestDWord2:=WORD_TO_DWORD(ROR(abc,8 ));&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Both produce 16#00443344. Which is wrong. And in both cases the length of the constant IS defined. In the second case it is also an explicitly declared constant with a name and I type. So how is this anyone's fault but a bug ?!?&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>CoDeSys bug? Error Compilation?</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/f2bec8441d/?limit=25#d5d6" rel="alternate"/><published>2020-02-27T19:31:48.502000Z</published><updated>2020-02-27T19:31:48.502000Z</updated><author><name>shooter</name><uri>https://forge.codesys.com/u/shooter/</uri></author><id>https://forge.codesys.comeba8cc9c55ec374ace6822fc4b2845eb7d62fa50</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;yes it is wrong, however as you do not define the length it is your fault.&lt;/p&gt;
&lt;p&gt;i repeat always give constants a name and a type&lt;/p&gt;
&lt;p&gt;if you are rolling over a byte same happens because of the use of memory.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>CoDeSys bug? Error Compilation?</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/f2bec8441d/?limit=25#e261" rel="alternate"/><published>2020-02-27T19:31:45.020000Z</published><updated>2020-02-27T19:31:45.020000Z</updated><author><name>maauto</name><uri>https://forge.codesys.com/u/maauto/</uri></author><id>https://forge.codesys.come72facd04195e6e8f32e7041373c49c764dd226b</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;That might be the case what happens, but if you consider the description in the help file (for ROR), it doesn't seem correct:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Zitat:&lt;/strong&gt;&lt;br/&gt;
Please note, that the amount of bits, which is regarded for the arithmetic operation, is pretended by the data type of the input variable !. If the input variable is a constant the smallest possible data type is regarded. The data type of the output variable has no effect at all on the arithmetic operation.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;In other words the result of ROR(16#4433,8 ) is / or should always be a WORD because 'The data type of the output variable has no effect at all on the arithmetic operation.' and the smallest possible data type for 16#4433 is WORD.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>CoDeSys bug? Error Compilation?</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/f2bec8441d/?limit=25#3e1b" rel="alternate"/><published>2020-02-27T19:31:43.627000Z</published><updated>2020-02-27T19:31:43.627000Z</updated><author><name>shooter</name><uri>https://forge.codesys.com/u/shooter/</uri></author><id>https://forge.codesys.come5b89f8f1de1b9f2e2141bde462eb31430b8e9b6</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;that is because the result of the ROR is a word in the first line and in the other line unknown (not really but it is rolled over in a dword&lt;/p&gt;
&lt;p&gt;you are doing wrong as you should always use a variable even when used only once, now the system does not know if it is a word or a byte or whatever.&lt;/p&gt;
&lt;p&gt;it has another advantage too, you can not change constants while running but variables you can.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>CoDeSys bug? Error Compilation?</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/f2bec8441d/?limit=25#d05f" rel="alternate"/><published>2020-02-27T19:31:40.107000Z</published><updated>2020-02-27T19:31:40.107000Z</updated><author><name>chenamob</name><uri>https://forge.codesys.com/u/chenamob/</uri></author><id>https://forge.codesys.com3237a8378fae6e0724af9e32638b796973f58192</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;xx:=16#11220000 OR  (WORD_TO_DWORD (ROR(16#4433,8)) AND 16#0000FFFF);&lt;/p&gt;
&lt;p&gt;xx2:=16#11220000 OR  (WORD_TO_DWORD (ROR(16#4433,8)) );&lt;/p&gt;
&lt;hr/&gt;
&lt;p&gt;xx=16#11223344&lt;/p&gt;
&lt;p&gt;xx2=16#11&lt;strong&gt;66&lt;/strong&gt;3344  ---- Why?&lt;/p&gt;
&lt;p&gt;CoDeSys 2.3.9.16&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>