<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to DEFINE in CoDeSys V3.5</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/3fd4ef6a0b/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/3fd4ef6a0b/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/3fd4ef6a0b/</id><updated>2020-02-27T14:11:29.967000Z</updated><subtitle>Recent posts to DEFINE in CoDeSys V3.5</subtitle><entry><title>DEFINE in CoDeSys V3.5</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/3fd4ef6a0b/?limit=25#50b9" rel="alternate"/><published>2020-02-27T14:11:29.967000Z</published><updated>2020-02-27T14:11:29.967000Z</updated><author><name>Julian Henkel</name><uri>https://forge.codesys.com/u/julian-henkel/</uri></author><id>https://forge.codesys.comb12ea883bf76ae08a8f5c3468a3d274aae2450b6</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Ahh, found the option and it was already active. Now this makes all sense! ^^&lt;/p&gt;
&lt;p&gt;You two really helped me out, thank you very much!&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>DEFINE in CoDeSys V3.5</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/3fd4ef6a0b/?limit=25#f0cf" rel="alternate"/><published>2020-02-27T14:11:29.609000Z</published><updated>2020-02-27T14:11:29.609000Z</updated><author><name>Anonymous</name><uri>https://forge.codesys.com/u/*anonymous/</uri></author><id>https://forge.codesys.com108ecf1c3cc3043bf371fae1933b88b55c26f97d</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;&lt;em&gt;Originally created by:&lt;/em&gt; scott_cunningham&lt;/p&gt;
&lt;p&gt;&lt;a class="" href="http://forum.codesys.com/viewtopic.php?f=11&amp;amp;t=6759&amp;amp;p=14316&amp;amp;lan=en" rel="nofollow"&gt;TimvH's post&lt;/a&gt; is correct.  You can tell the compiler if you want to keep the variable existing, or if you want to replace with constants.  See the Project options area - you will find it there.  Sometimes it is nice to keep the variable for online debugging (you can't change it, but it "speaks" to you like "MAX_ARRAY_SIZE") and most hardware platforms running CoDeSys do not really run out of memory space (like often found in embedded systems running C code).&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>DEFINE in CoDeSys V3.5</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/3fd4ef6a0b/?limit=25#f4c5" rel="alternate"/><published>2020-02-27T14:11:28.497000Z</published><updated>2020-02-27T14:11:28.497000Z</updated><author><name>Julian Henkel</name><uri>https://forge.codesys.com/u/julian-henkel/</uri></author><id>https://forge.codesys.coma8720e819516fcf1242f8e5447b08cbb9fa3d2be</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hmm, that might be. I thought defines in CoDeSys are just the same as they are in C.&lt;br/&gt;
When I declare a constant variable in C, this variable really exists, meaning memory gets allocated for it, but a define just gets replaced with its value before compiling.&lt;/p&gt;
&lt;p&gt;Thought this should be possible in every language.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>DEFINE in CoDeSys V3.5</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/3fd4ef6a0b/?limit=25#5962" rel="alternate"/><published>2020-02-27T14:11:28.061000Z</published><updated>2020-02-27T14:11:28.061000Z</updated><author><name>timvh</name><uri>https://forge.codesys.com/u/timvh/</uri></author><id>https://forge.codesys.com2d675c646fdb5376f83fe056133e0ab7bf604562</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I think you misunderstood the meaning of defines in CODESYS.&lt;br/&gt;
I think you want to create a constant for this:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;VAR&lt;/span&gt; &lt;span class="n"&gt;CONSTANT&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="n"&gt;HELLO&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;INT&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;123&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;END_VAR&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;/div&gt;</summary></entry><entry><title>DEFINE in CoDeSys V3.5</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/3fd4ef6a0b/?limit=25#9de6" rel="alternate"/><published>2020-02-27T14:11:27.724000Z</published><updated>2020-02-27T14:11:27.724000Z</updated><author><name>Julian Henkel</name><uri>https://forge.codesys.com/u/julian-henkel/</uri></author><id>https://forge.codesys.com3e56639c9d8f681db9685d1d4fcaaa905236f6d1</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I have a small problem, whose solution most likely will seem ridiculously easy to me once it is solved.&lt;br/&gt;
I'm trying to use the pre-compiler command "define" to define some Numbers as Text for frequent use in CoDeSys V3.5.&lt;br/&gt;
The CoDeSys help tells me, that it should look like this:&lt;/p&gt;
&lt;p&gt;{define &amp;lt;identifier&amp;gt; &amp;lt;string&amp;gt;}&amp;lt;/string&amp;gt;&amp;lt;/identifier&amp;gt;&lt;/p&gt;
&lt;p&gt;I tried to write the following lines in the define window right below the END_VAR command:&lt;/p&gt;
&lt;p&gt;{define HELLO 123}&lt;br/&gt;
{define &amp;lt;hello&amp;gt; &amp;lt;123&amp;gt;}&lt;br/&gt;&amp;lt;/hello&amp;gt;&lt;/p&gt;
&lt;p&gt;But nothing works. Does anybody know how it's done or what I am missing?&lt;/p&gt;
&lt;p&gt;Thank you very much!&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>