<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to allocation of variables for different modules</title><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/5aecd139f9/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/5aecd139f9/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/CODESYS-V2/thread/5aecd139f9/</id><updated>2020-02-27T23:07:06.368000Z</updated><subtitle>Recent posts to allocation of variables for different modules</subtitle><entry><title>allocation of variables for different modules</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/5aecd139f9/?limit=25#f669" rel="alternate"/><published>2020-02-27T23:07:06.368000Z</published><updated>2020-02-27T23:07:06.368000Z</updated><author><name>Rolf-Geisler</name><uri>https://forge.codesys.com/u/rolf-geisler/</uri></author><id>https://forge.codesys.com76e009568f0c417aa5eca7c4f2f32109a22d9896</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello Benoit,&lt;br/&gt;
sorry for the late reply. Had been off for a few days.&lt;br/&gt;
```&lt;/p&gt;
&lt;p&gt;AnUDCInstance.qxSomeOutput AT QX0.0&lt;/p&gt;
&lt;p&gt;``` probably willl not work. I can't imagine, how the compiler could assign an absolute address to just a little part of a function block.&lt;br/&gt;
The safe way is to have just variables with certain addresses, to which you assign the output var of the FB instance, as I suggested it in one of my posts.&lt;br/&gt;
Rolf&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>allocation of variables for different modules</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/5aecd139f9/?limit=25#bd91" rel="alternate"/><published>2020-02-27T23:07:01.808000Z</published><updated>2020-02-27T23:07:01.808000Z</updated><author><name>bmattlet</name><uri>https://forge.codesys.com/u/bmattlet/</uri></author><id>https://forge.codesys.com18196e186d51e444f90ab8aa957802dd517ffa0f</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;ok, nice!&lt;/p&gt;
&lt;p&gt;May I write directly :&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;AnUDCInstance&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;qxSomeOutput&lt;/span&gt; &lt;span class="k"&gt;AT&lt;/span&gt; &lt;span class="n"&gt;QX0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Or do I have to assign a physical address to a variable and then put the data of my function block in the variable like the way you did ?&lt;/p&gt;
&lt;p&gt;Thankt you!&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>allocation of variables for different modules</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/5aecd139f9/?limit=25#0f7e" rel="alternate"/><published>2020-02-27T23:07:00.169000Z</published><updated>2020-02-27T23:07:00.169000Z</updated><author><name>Rolf-Geisler</name><uri>https://forge.codesys.com/u/rolf-geisler/</uri></author><id>https://forge.codesys.com068eaec0528087721498fc1ef980f10955a84f93</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi,&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="err"&gt; &lt;/span&gt; &lt;span class="n"&gt;AnUDCInstance&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;UDC&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="n"&gt;AnUDCOutput&lt;/span&gt; &lt;span class="k"&gt;AT&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="n"&gt;QX0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;BOOL&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;This&lt;/span&gt; &lt;span class="n"&gt;assigns&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="n"&gt;physical&lt;/span&gt; &lt;span class="n"&gt;address&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;END_VAR&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="c1"&gt;--- *)&lt;/span&gt;
&lt;span class="n"&gt;AnUDCOutput&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;AnUDCInstance&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;qxSomeOutput&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;This&lt;/span&gt; &lt;span class="n"&gt;brings&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;UDC&lt;/span&gt; &lt;span class="k"&gt;output&lt;/span&gt; &lt;span class="k"&gt;to&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;absolutely&lt;/span&gt; &lt;span class="n"&gt;addressed&lt;/span&gt; &lt;span class="n"&gt;target&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Rolf&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>allocation of variables for different modules</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/5aecd139f9/?limit=25#941a" rel="alternate"/><published>2020-02-27T23:06:55.478000Z</published><updated>2020-02-27T23:06:55.478000Z</updated><author><name>bmattlet</name><uri>https://forge.codesys.com/u/bmattlet/</uri></author><id>https://forge.codesys.com39efaf55142e9a6c501d4e42e87c70e2cf8081b3</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Ok thank you but how do I link "AnUDCInstance.qxSomeOutput" to a physical address after that ? &lt;/p&gt;
&lt;p&gt;I mean I know that I could write "%QX1.0:=AnUDCInstance.qxSomeOutput" so the physical Ouput take the value of my variable but how can I do this automatically or with some kind of function ?&lt;/p&gt;
&lt;p&gt;Because to every I/O of the function block it exists the I/O of the Wago module but with a different address for every module...&lt;br/&gt;
Hope I'm clear enough...&lt;/p&gt;
&lt;p&gt;Benoit.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>allocation of variables for different modules</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/5aecd139f9/?limit=25#e542" rel="alternate"/><published>2020-02-27T23:06:53.864000Z</published><updated>2020-02-27T23:06:53.864000Z</updated><author><name>bmattlet</name><uri>https://forge.codesys.com/u/bmattlet/</uri></author><id>https://forge.codesys.com0681e7f5eccf348008fa2e5a69ceb0b99b56e3c9</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>allocation of variables for different modules</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/5aecd139f9/?limit=25#356a" rel="alternate"/><published>2020-02-27T23:06:49.127000Z</published><updated>2020-02-27T23:06:49.127000Z</updated><author><name>Rolf-Geisler</name><uri>https://forge.codesys.com/u/rolf-geisler/</uri></author><id>https://forge.codesys.com7eb53f2ce955460eba7a7d85f7be2275df9318eb</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi,&lt;br/&gt;
just do not use absolute addresses inside the UDC function block&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;FUNCTION_BLOCK&lt;/span&gt; &lt;span class="n"&gt;UDC&lt;/span&gt;
&lt;span class="n"&gt;VAR_OUTPUT&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="n"&gt;qxSomeOutput&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;BOOL&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;that&lt;/span&gt;&lt;span class="err"&gt;'&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="k"&gt;all&lt;/span&gt; &lt;span class="n"&gt;you&lt;/span&gt; &lt;span class="n"&gt;need&lt;/span&gt; &lt;span class="o"&gt;*&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;p&gt;To get the outputs of a module instance, use the instance identifier :&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="err"&gt; &lt;/span&gt; &lt;span class="n"&gt;AnUDCInstance&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;UDC&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="n"&gt;AnUDCOutput&lt;/span&gt;&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;BOOL&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;END_VAR&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="c1"&gt;--- *)&lt;/span&gt;
&lt;span class="n"&gt;AnUDCOutput&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;AnUDCInstance&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;qxSomeOutput&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;With CoDeSys, you need absolute addresses für physical inputs / outputs only. All other data the compiler is able to allocate dynamically.&lt;/p&gt;
&lt;p&gt;Have success&lt;br/&gt;
Rolf&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>allocation of variables for different modules</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/5aecd139f9/?limit=25#7e5b" rel="alternate"/><published>2020-02-27T23:06:47.477000Z</published><updated>2020-02-27T23:06:47.477000Z</updated><author><name>bmattlet</name><uri>https://forge.codesys.com/u/bmattlet/</uri></author><id>https://forge.codesys.com4289fb924a188a6ac73bb4bcc8cbba5b63cb3245</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I have programmed a up/down counter (UDC) module on CoDeSys. &lt;/p&gt;
&lt;p&gt;My problem is : I would like to use the same function_block for all my UDC modules but the addresses of the variables (such as "AT %QX0.0") change from one module to another. All the modules are UDC-type but %QX0.0 become %QX2.0 for module 2 and so on...&lt;/p&gt;
&lt;p&gt;Is it possible to automatically allocate the addresse of the variables so I can use the same function_block for the different modules ?&lt;/p&gt;
&lt;p&gt;Thank you for any response.&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>