<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Array of Struct Initialisierung</title><link href="https://forge.codesys.com/forge/talk/Deutsch/thread/984df16e27/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Deutsch/thread/984df16e27/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Deutsch/thread/984df16e27/</id><updated>2020-02-28T04:43:00.048000Z</updated><subtitle>Recent posts to Array of Struct Initialisierung</subtitle><entry><title>Array of Struct Initialisierung</title><link href="https://forge.codesys.com/forge/talk/Deutsch/thread/984df16e27/?limit=25#8594" rel="alternate"/><published>2020-02-28T04:43:00.048000Z</published><updated>2020-02-28T04:43:00.048000Z</updated><author><name>Erik Böhm</name><uri>https://forge.codesys.com/u/erik-boehm/</uri></author><id>https://forge.codesys.com5b72c69407339857fdcbaa4ed843ace2dbef2c09</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hallo&lt;/p&gt;
&lt;p&gt;Das wird so wohl nicht funktionieren.&lt;/p&gt;
&lt;p&gt;Präprozessor Funktionen gibts in der 2.3 nicht.&lt;/p&gt;
&lt;p&gt;Warum initialisierst du die Variablen nicht einfach in einer init-Phase, direkt nach dem Einschalten ?&lt;/p&gt;
&lt;p&gt;z.B. mittels einer FOR Schleife ?&lt;/p&gt;
&lt;p&gt;Bsp:&lt;/p&gt;
&lt;p&gt;if not bInit then&lt;/p&gt;
&lt;p&gt;for i:=1 to 3 by 1 do&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="n"&gt;abc&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;BUSNr&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;end_for&lt;/p&gt;
&lt;p&gt;bInit := TRUE;&lt;/p&gt;
&lt;p&gt;end_if&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Array of Struct Initialisierung</title><link href="https://forge.codesys.com/forge/talk/Deutsch/thread/984df16e27/?limit=25#984d" rel="alternate"/><published>2020-02-28T04:42:54.382000Z</published><updated>2020-02-28T04:42:54.382000Z</updated><author><name>bertl71</name><uri>https://forge.codesys.com/u/bertl71/</uri></author><id>https://forge.codesys.com112bdf3580808114449225fd57c77b889b7e4b37</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hallo zusammen,&lt;/p&gt;
&lt;p&gt;habe folgendes Problem.&lt;/p&gt;
&lt;p&gt;Ich habe ein Array of Struct, das folgendermaßen aussieht &lt;/p&gt;
&lt;p&gt;abc:ARRAY&lt;span&gt;[0..3]&lt;/span&gt; OF Txxx&lt;/p&gt;
&lt;p&gt;TYPE Txxx&lt;/p&gt;
&lt;p&gt;STRUCT&lt;/p&gt;
&lt;p&gt;a:BOOL;&lt;/p&gt;
&lt;p&gt;b:BOOL;&lt;/p&gt;
&lt;p&gt;BUSNr:BYTE&lt;/p&gt;
&lt;p&gt;END_STRUCT&lt;/p&gt;
&lt;p&gt;END_TYPE&lt;/p&gt;
&lt;p&gt;So jetzt habe ich folgende Frage. Kann ich den Parameter BusNr beim Initialisieren des Array automatisch hochzählen lassen. Gibt es eventuell eine Möglichkeit  die Array-Feld Nummer als Parameter direkt beim Initialisieren zu übergeben.&lt;/p&gt;
&lt;p&gt;Als Beispiel:&lt;/p&gt;
&lt;p&gt;abc:ARRAY&lt;span&gt;[0..3]&lt;/span&gt; OF Txxx := (a:=false,b:=false,BUSNr:="Laufvariable Array") ,  (a:=false,b:=false,BUSNr:="Laufvariable Array")&lt;/p&gt;
&lt;p&gt;Für eure Antworten schon mal Danke!!&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>