<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Addressing I/O by string configuration</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/a996ffb890/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/a996ffb890/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/a996ffb890/</id><updated>2020-02-27T13:48:13.519000Z</updated><subtitle>Recent posts to Addressing I/O by string configuration</subtitle><entry><title>Addressing I/O by string configuration</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/a996ffb890/?limit=25#d14d" rel="alternate"/><published>2020-02-27T13:48:13.519000Z</published><updated>2020-02-27T13:48:13.519000Z</updated><author><name>yannickasselin1</name><uri>https://forge.codesys.com/u/yannickasselin1/</uri></author><id>https://forge.codesys.com3662170c848688a17484d82e9730dad7a84daecf</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Watch this:&lt;br/&gt;
&lt;a class="" href="https://www.youtube.com/watch?v=cN_Jz9ziUTM" rel="nofollow"&gt;https://www.youtube.com/watch?v=cN_Jz9ziUTM&lt;/a&gt; m &lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Addressing I/O by string configuration</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/a996ffb890/?limit=100#220e" rel="alternate"/><published>2020-02-27T13:48:13.251000Z</published><updated>2020-02-27T13:48:13.251000Z</updated><author><name>aliazzz</name><uri>https://forge.codesys.com/u/aliazzz/</uri></author><id>https://forge.codesys.com02f064d16b9891bbd03beecea432d0502d74e4db</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;There is a free package in the Codesys store for this. That package is very very powerful. I have used this package in a project and using it was a breeze.&lt;br/&gt;
Apart from providing a mechanic for free arrangeable IO channels, with different datatypes (BOOL, BYTE, WORD etc etc), it can restore previous made configurations and store current configurations onto disk. &lt;/p&gt;
&lt;p&gt;&lt;a class="" href="https://store.codesys.com/io-mapping-tool.html" rel="nofollow"&gt;https://store.codesys.com/io-mapping-tool.html&lt;/a&gt;&lt;br/&gt;
Plus, it's open source so you can take a look inside the library to learn more about it's mechanics &lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Addressing I/O by string configuration</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/a996ffb890/?limit=25#eb9d" rel="alternate"/><published>2020-02-27T13:48:13.169000Z</published><updated>2020-02-27T13:48:13.169000Z</updated><author><name>josepmariarams</name><uri>https://forge.codesys.com/u/josepmariarams/</uri></author><id>https://forge.codesys.comb773e11c570fb28bf7932711486bb4d2489b44d1</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi &lt;/p&gt;
&lt;p&gt;Another solution&lt;/p&gt;
&lt;p&gt;Create an FB_dio.&lt;/p&gt;
&lt;p&gt;Inside, put an (which could be static) pointer to array&lt;span&gt;[0..1024]&lt;/span&gt; of usint (call him iomem).&lt;/p&gt;
&lt;p&gt;Create two persistent vars:&lt;/p&gt;
&lt;p&gt;Index:int&lt;br/&gt;
Bit:int&lt;/p&gt;
&lt;p&gt;In your fb code, if is an dinput.&lt;/p&gt;
&lt;p&gt;Iomem:= adr(ib0);&lt;/p&gt;
&lt;p&gt;Out:= iomem^&lt;span&gt;[index]&lt;/span&gt; and (shl(1, bit))&amp;lt;&amp;gt;0.&lt;/p&gt;
&lt;p&gt;Changing index and bit, you can, programaticaly change your map.&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;
&lt;p&gt;Sent from my Moto G (5S) Plus using Tapatalk&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Addressing I/O by string configuration</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/a996ffb890/?limit=25#bed7" rel="alternate"/><published>2020-02-27T13:48:13.035000Z</published><updated>2020-02-27T13:48:13.035000Z</updated><author><name>dFx</name><uri>https://forge.codesys.com/u/dfx/</uri></author><id>https://forge.codesys.comf819d7855038980c4fe5af3f363e6a9f915a324b</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;What I purposed earlier totaly conforms in your needings.&lt;/p&gt;
&lt;p&gt;So step 1 : create a generic plc program that address all I/Os (IO_DI/DOs arrays, Mapping arrays). You can forget about the constants.&lt;br/&gt;
Step 2 : create an array for each FB type you will have to use (tank with 1 outlet, tank with inlet+outlet …)&lt;br/&gt;
Step 3 : create fb call Inside a loop for each different fb you got, with a independant variable max loop count (1 for each fb type), using mapped I/Os as fb I/Os&lt;br/&gt;
Step 4 : just configure your program by whatever way you want (like reading txt file or settings manually values) by settings the right values in ioMap arrays and loop counts (loop count = 0 if you have no instance of this type)&lt;/p&gt;
&lt;p&gt;exemple :&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="o"&gt;//&lt;/span&gt; &lt;span class="nv"&gt;FB&lt;/span&gt; &lt;span class="nv"&gt;calls&lt;/span&gt;
&lt;span class="k"&gt;FOR&lt;/span&gt; &lt;span class="nv"&gt;index&lt;/span&gt;:&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="nv"&gt;TO&lt;/span&gt; &lt;span class="nv"&gt;MaxFbTankOneValve&lt;/span&gt; &lt;span class="k"&gt;DO&lt;/span&gt;
   &lt;span class="nv"&gt;FbTankOneValve&lt;/span&gt;[&lt;span class="nv"&gt;index&lt;/span&gt;] &lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;ValveInput&lt;/span&gt;:&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;IO_DI&lt;/span&gt;[&lt;span class="nv"&gt;ioMapDI&lt;/span&gt;[&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nv"&gt;index&lt;/span&gt;]],
      &lt;span class="nv"&gt;ValveOutput&lt;/span&gt;&lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;&lt;span class="nv"&gt;IO_DO&lt;/span&gt;[&lt;span class="nv"&gt;ioMapDO&lt;/span&gt;[&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nv"&gt;index&lt;/span&gt;]]&lt;span class="ss"&gt;)&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;END_FOR&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;FOR&lt;/span&gt; &lt;span class="nv"&gt;index&lt;/span&gt;:&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="nv"&gt;TO&lt;/span&gt; &lt;span class="nv"&gt;MaxFbTankTwoValves&lt;/span&gt; &lt;span class="k"&gt;DO&lt;/span&gt;
   &lt;span class="nv"&gt;FbTankTwoValves&lt;/span&gt;[&lt;span class="nv"&gt;index&lt;/span&gt;] &lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;ValveInput&lt;/span&gt;:&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;IO_DI&lt;/span&gt;[&lt;span class="nv"&gt;ioMapDI&lt;/span&gt;[&lt;span class="mi"&gt;100&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nv"&gt;index&lt;/span&gt;]],
      &lt;span class="nv"&gt;ValveOutput&lt;/span&gt;&lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;&lt;span class="nv"&gt;IO_DO&lt;/span&gt;[&lt;span class="nv"&gt;ioMapDO&lt;/span&gt;[&lt;span class="mi"&gt;100&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nv"&gt;index&lt;/span&gt;]]&lt;span class="ss"&gt;)&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;END_FOR&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Assuming you will later set :&lt;br/&gt;
MaxFbTankOneValve as the count of instances of tanks with 1 valve&lt;br/&gt;
MaxFbTankTwoValves as the count of instances of tanks with 2 valves&lt;br/&gt;
ioMapDI&lt;span&gt;[0]&lt;/span&gt; + MaxFbTankOneValve to the correct inputs indexes of tanks with 1 valve&lt;br/&gt;
ioMapDO&lt;span&gt;[0]&lt;/span&gt; + MaxFbTankOneValve to the correct outputs indexes of tanks with 1 valve&lt;br/&gt;
ioMapDI&lt;span&gt;[100]&lt;/span&gt; + MaxFbTankTwoValves to the correct inputs indexes of tanks with 2 valves&lt;br/&gt;
ioMapDO&lt;span&gt;[100]&lt;/span&gt; + MaxFbTankTwoValves to the correct outputs indexes of tanks with 2 valves&lt;/p&gt;
&lt;p&gt;Edited for code correction&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Addressing I/O by string configuration</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/a996ffb890/?limit=25#9db4" rel="alternate"/><published>2020-02-27T13:48:12.948000Z</published><updated>2020-02-27T13:48:12.948000Z</updated><author><name>mikeardy</name><uri>https://forge.codesys.com/u/mikeardy/</uri></author><id>https://forge.codesys.com080585a95fecf4d8197947c13295c04dd038a95f</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;ok&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;a plc on a site must manage for example a tank with 1 valve (output) and 1 feedback (input)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;a plc must manage a tank with 2 valves (2 outputs) and 2 feedbacks (inputs)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;a plc must manage two tanks with 1 valve each and 1 feedback each (2 outputs and 2 inputs)&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;in my idea I will develop only one application delivered to all plcs and send the plcs to the destination, remotely I will put the txt file and the application will arrange dynamically the addressing, that is my need &lt;br/&gt;
a text file like&lt;br/&gt;
I0.0&lt;br/&gt;
I0.1&lt;br/&gt;
I0.2&lt;br/&gt;
....&lt;br/&gt;
O0.2&lt;br/&gt;
O0.3&lt;br/&gt;
and the plc will address the relatives I/O.&lt;br/&gt;
if some input or output gate is going out for some reason a qualified person could switch physically to another and I remotely could change the txt file addressing correctly the new one.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Addressing I/O by string configuration</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/a996ffb890/?limit=25#f3ef" rel="alternate"/><published>2020-02-27T13:48:12.881000Z</published><updated>2020-02-27T13:48:12.881000Z</updated><author><name>dFx</name><uri>https://forge.codesys.com/u/dfx/</uri></author><id>https://forge.codesys.coma60d49f0111090c147549ac88373e6834cb0ee74</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;give us at least 3 exemples sites&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Addressing I/O by string configuration</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/a996ffb890/?limit=25#3db8" rel="alternate"/><published>2020-02-27T13:48:12.812000Z</published><updated>2020-02-27T13:48:12.812000Z</updated><author><name>mikeardy</name><uri>https://forge.codesys.com/u/mikeardy/</uri></author><id>https://forge.codesys.com19ca9e16c33c5f7644017bcb34949430cb7e567b</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;No no, maybe I'm not so clear...&lt;/p&gt;
&lt;p&gt;I have to deploy many PLC in different sites.&lt;br/&gt;
Every sites can have a different configuration in term of I/O.&lt;br/&gt;
So the idea is to write one time the generic application program and configure the behaviour by a TXT file read at startup.&lt;br/&gt;
In the past I managed something like that but for parameters only, not for I/O.&lt;br/&gt;
So I need to be able to configure dynamically this I/O.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Addressing I/O by string configuration</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/a996ffb890/?limit=25#2a24" rel="alternate"/><published>2020-02-27T13:48:12.737000Z</published><updated>2020-02-27T13:48:12.737000Z</updated><author><name>dFx</name><uri>https://forge.codesys.com/u/dfx/</uri></author><id>https://forge.codesys.combb04b9cd0ee3d8337ba280e7b00ad4fa9e0cebf4</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;So you mean, you have different number of process instances ? -&amp;gt; just do a loop call for each instances, with variable count.&lt;br/&gt;
this exemple totally conforms with your needings, assuming you write by yourself TXT file reading and values setting from it (functionnal mapping, number of instances …)&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Addressing I/O by string configuration</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/a996ffb890/?limit=25#d57d" rel="alternate"/><published>2020-02-27T13:48:12.643000Z</published><updated>2020-02-27T13:48:12.643000Z</updated><author><name>mikeardy</name><uri>https://forge.codesys.com/u/mikeardy/</uri></author><id>https://forge.codesys.combd440ed656f152c847739406bb7c95237dce2848</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi,&lt;br/&gt;
it is not my situation.&lt;br/&gt;
Let me explain in deep.&lt;br/&gt;
I need a solution to address the I/O on different systems that may differ between them. &lt;br/&gt;
For example one system may have only one valve and a feedback and the other may have three valves and some other feedback. The main program must be the same but via txt file I would like to "configure' the behaviour of the system, so a dynamic block could address different I/O based on the file.&lt;br/&gt;
I don't have to modify the application program. Just download to the destination PLC, change the txt file and... that's it.&lt;br/&gt;
Thank you&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Addressing I/O by string configuration</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/a996ffb890/?limit=25#30ad" rel="alternate"/><published>2020-02-27T13:48:12.516000Z</published><updated>2020-02-27T13:48:12.516000Z</updated><author><name>dFx</name><uri>https://forge.codesys.com/u/dfx/</uri></author><id>https://forge.codesys.com65fd6e84f23e043441c6a87533e127d46c6cd06e</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;To correctly map your inputs to the wired inputs, just change the value of :&lt;br/&gt;
IoMapDO&lt;span&gt;[MAP.PUMP_RUN]&lt;/span&gt; &lt;br/&gt;
IoMapDI&lt;span&gt;[MAP.PUMP_REQUEST]&lt;/span&gt; &lt;br/&gt;
IoMapDI&lt;span&gt;[MAP.PUMP_FAULT]&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;to the index of your input.&lt;/p&gt;
&lt;p&gt;Sample project attached.&lt;/p&gt;
&lt;p&gt;For more code readability, but requiring more treatment, you may also copy every IO_DI/DO array value to the right tag (adding one more layer, but every access will have the same tag)&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: 1.png" rel="nofollow" src="https://forum.codesys.com//download/file.php?id=4204"/&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: 2.png" rel="nofollow" src="https://forum.codesys.com//download/file.php?id=4205"/&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: 3.png" rel="nofollow" src="https://forum.codesys.com//download/file.php?id=4206"/&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: 4.png" rel="nofollow" src="https://forum.codesys.com//download/file.php?id=4207"/&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: 5.png" rel="nofollow" src="https://forum.codesys.com//download/file.php?id=4208"/&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>