<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to indirect addressing</title><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/6a46213250/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/6a46213250/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/CODESYS-V2/thread/6a46213250/</id><updated>2020-02-27T20:51:56.989000Z</updated><subtitle>Recent posts to indirect addressing</subtitle><entry><title>indirect addressing</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/6a46213250/?limit=25#6ab1" rel="alternate"/><published>2020-02-27T20:51:56.989000Z</published><updated>2020-02-27T20:51:56.989000Z</updated><author><name>RolandWagner</name><uri>https://forge.codesys.com/u/rowa/</uri></author><id>https://forge.codesys.com93a79696c636e42893a0036cce6122419e861ac6</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi,&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Zitat:&lt;/strong&gt;&lt;br/&gt;
So how can you create a DO loop that will increment the address in the array each time?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;There are several possibilities. The best is to use a FOR loop:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;   &lt;span class="nv"&gt;arr1&lt;/span&gt; : &lt;span class="nv"&gt;ARRAY&lt;/span&gt; [&lt;span class="mi"&gt;1&lt;/span&gt;..&lt;span class="mi"&gt;5&lt;/span&gt;] &lt;span class="nv"&gt;OF&lt;/span&gt; &lt;span class="nv"&gt;INT&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
   &lt;span class="nv"&gt;i&lt;/span&gt;: &lt;span class="nv"&gt;INT&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
   &lt;span class="nv"&gt;read&lt;/span&gt;: &lt;span class="nv"&gt;INT&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;i&lt;/span&gt;:&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="nv"&gt;TO&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="nv"&gt;BY&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="k"&gt;DO&lt;/span&gt;
   &lt;span class="nv"&gt;read&lt;/span&gt; :&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;arr1&lt;/span&gt;[&lt;span class="nv"&gt;i&lt;/span&gt;]&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;END_FOR&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Alternatively you can use REPEAT ... UNTIL or the WHILE loops.&lt;br/&gt;
You will find examples to both in the online help of CoDeSys.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Zitat:&lt;/strong&gt;&lt;br/&gt;
is possible indirect addressing in codesys&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Yes, even if this is an extension to the IEC 61131-3 you can use indirect addressing.&lt;/p&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="nt"&gt;var1&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nt"&gt;var2&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nt"&gt;var3&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;INT&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="nt"&gt;pAdress&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;POINTER&lt;/span&gt; &lt;span class="nt"&gt;TO&lt;/span&gt; &lt;span class="nt"&gt;INT&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nt"&gt;pAdress&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="nt"&gt;ADR&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;Var1&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="nt"&gt;pAdress&lt;/span&gt;&lt;span class="o"&gt;^:=&lt;/span&gt;&lt;span class="nt"&gt;5&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;You can find more information on pointers in the online help.    But please be careful! Writing on addresses you are not supposed to can really harm your application, the controller or the machine. Thus I can only recommend to use pointers in case you really know how to use them. &lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>indirect addressing</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/6a46213250/?limit=25#21ac" rel="alternate"/><published>2020-02-27T20:51:53.053000Z</published><updated>2020-02-27T20:51:53.053000Z</updated><author><name>dansaxton</name><uri>https://forge.codesys.com/u/dansaxton/</uri></author><id>https://forge.codesys.com0c90079e69337feb152f26de7451d0aeb42571e3</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;So how can you create a DO loop that will increment the address in the array each time?&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>indirect addressing</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/6a46213250/?limit=25#df89" rel="alternate"/><published>2020-02-27T20:51:51.592000Z</published><updated>2020-02-27T20:51:51.592000Z</updated><author><name>ndzied1</name><uri>https://forge.codesys.com/u/ndzied1/</uri></author><id>https://forge.codesys.com41791a9f97e7d2ab0a46835980750befcdfa73a6</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I am assuming that you are referring to the Allen Bradley term Indirect Addressing.&lt;/p&gt;
&lt;p&gt;In CoDeSys this type of manipulaiton is not necessary as you can define arrays.    It is actually much clearer to do this type of programming in CoDeSys.&lt;/p&gt;
&lt;p&gt;Here is a sample array declaration.  Look in the help for more information.&lt;/p&gt;
&lt;p&gt;arr1 : ARRAY &lt;span&gt;[1..5]&lt;/span&gt; OF INT;&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>indirect addressing</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/6a46213250/?limit=25#a395" rel="alternate"/><published>2020-02-27T20:51:47.609000Z</published><updated>2020-02-27T20:51:47.609000Z</updated><author><name>fractalmind</name><uri>https://forge.codesys.com/u/fractalmind/</uri></author><id>https://forge.codesys.comb7e497bdac8cd38af3c23e1165fb8dab0b55034a</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;hi , i work with codesys and wago plc 750-841 ...... is possible indirect&lt;/p&gt;
&lt;p&gt;addressing in codesys ?&lt;/p&gt;
&lt;p&gt;thanks&lt;/p&gt;
&lt;p&gt;(excused for my very bad English)&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>