<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Variables initialization in the declarations</title><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/7ec922c18c/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/7ec922c18c/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/CODESYS-V2/thread/7ec922c18c/</id><updated>2020-02-27T22:06:10.682000Z</updated><subtitle>Recent posts to Variables initialization in the declarations</subtitle><entry><title>Variables initialization in the declarations</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/7ec922c18c/?limit=25#da4e" rel="alternate"/><published>2020-02-27T22:06:10.682000Z</published><updated>2020-02-27T22:06:10.682000Z</updated><author><name>Anonymous</name><uri>https://forge.codesys.com/u/*anonymous/</uri></author><id>https://forge.codesys.com1310263411ab26a6b645abb7a77a47cfd4c02efa</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;&lt;em&gt;Originally created by:&lt;/em&gt; AndreQ77&lt;/p&gt;
&lt;p&gt;Hello everybody.&lt;br/&gt;
I'm converting a Codesys V3 project in structured text to another project in V2.3 (due hardware old not compatible with V3).&lt;/p&gt;
&lt;p&gt;Usually, in the declaration of the variables, I initialize the desidered value:&lt;/p&gt;
&lt;p&gt;VAR_GLOBAL CONSTANT&lt;br/&gt;
  baseTick : BYTE := 20;&lt;/p&gt;
&lt;p&gt;cmdDelay      : UINT := 700 / baseTick;&lt;br/&gt;
  shortCmdDelay : UINT := 100 / baseTick;&lt;br/&gt;
  alrOnDelay    : UINT := 2 * (1000 / basetick);&lt;br/&gt;
  alrOffDelay   : UINT := 500 / baseTick;&lt;br/&gt;
END_VAR&lt;/p&gt;
&lt;p&gt;In Codesys V3... no problem, it works!&lt;br/&gt;
In Codesys V2.3 I can't use a mathematical operation!&lt;/p&gt;
&lt;p&gt;Works only:&lt;br/&gt;
  cmdDelay : UINT := 35;&lt;br/&gt;
or&lt;br/&gt;
  cmdDelay : UINT := baseTick;&lt;/p&gt;
&lt;p&gt;I tryed :&lt;br/&gt;
  cmdDelay : UINT :=  700 / baseTick;&lt;br/&gt;
  cmdDelay : UINT := (700 / baseTick);&lt;br/&gt;
but always with build errors.&lt;/p&gt;
&lt;p&gt;Have you some ideas?&lt;/p&gt;
&lt;p&gt;Thank you!&lt;br/&gt;
Andrea&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>