<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Pointer in CoDeSys V3</title><link href="https://forge.codesys.com/forge/talk/Deutsch/thread/315193322a/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Deutsch/thread/315193322a/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Deutsch/thread/315193322a/</id><updated>2020-02-28T00:31:05.284000Z</updated><subtitle>Recent posts to Pointer in CoDeSys V3</subtitle><entry><title>Pointer in CoDeSys V3</title><link href="https://forge.codesys.com/forge/talk/Deutsch/thread/315193322a/?limit=25#e751" rel="alternate"/><published>2020-02-28T00:31:05.284000Z</published><updated>2020-02-28T00:31:05.284000Z</updated><author><name>singleton</name><uri>https://forge.codesys.com/u/singleton/</uri></author><id>https://forge.codesys.com7a3e9928fc0a5c930c8d105ec4af22f4ff42bcb1</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Zuweisungen auf nicht initialisierte Pointer sind keine gute Idee   &lt;/p&gt;
&lt;p&gt;Du musst den Pointer erst initialisieren:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nt"&gt;TYPE&lt;/span&gt; &lt;span class="nt"&gt;Test&lt;/span&gt;
&lt;span class="nt"&gt;STRUCT&lt;/span&gt;
&lt;span class="nt"&gt;gruen&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;Bool&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nt"&gt;end_struct&lt;/span&gt;
&lt;span class="nt"&gt;End_type&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nt"&gt;Funktion_Block&lt;/span&gt; &lt;span class="nt"&gt;Farbe&lt;/span&gt;
&lt;span class="nt"&gt;Var&lt;/span&gt;
&lt;span class="nt"&gt;pt&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nd"&gt;POINTER&lt;/span&gt; &lt;span class="nt"&gt;TO&lt;/span&gt; &lt;span class="nt"&gt;test&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nt"&gt;stTest&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;Test&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nt"&gt;gelb&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nd"&gt;bool&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="nt"&gt;false&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nt"&gt;end_Var&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Code:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nt"&gt;pt&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;stTest&lt;/span&gt;&lt;span class="o"&gt;);&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;initialisieren&lt;/span&gt;
&lt;span class="nt"&gt;pt&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;gruen&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="nt"&gt;false&lt;/span&gt;&lt;span class="o"&gt;;//&lt;/span&gt; &lt;span class="nt"&gt;Steuerung&lt;/span&gt; &lt;span class="nt"&gt;sollte&lt;/span&gt; &lt;span class="nt"&gt;nicht&lt;/span&gt; &lt;span class="nt"&gt;mehr&lt;/span&gt; &lt;span class="nt"&gt;stehen&lt;/span&gt; &lt;span class="nt"&gt;bleiben&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;/div&gt;</summary></entry><entry><title>Pointer in CoDeSys V3</title><link href="https://forge.codesys.com/forge/talk/Deutsch/thread/315193322a/?limit=25#81ba" rel="alternate"/><published>2020-02-28T00:31:03.563000Z</published><updated>2020-02-28T00:31:03.563000Z</updated><author><name>sysV3</name><uri>https://forge.codesys.com/u/sysv3/</uri></author><id>https://forge.codesys.com1a7f316d9b4c8b137684e6763857387d67bc3ac0</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Ich habe folgendes Problem. Ich verwende einen Pointer und bekomme beim Übersetzen keine Fehlermeldung. Sobald ich aber &lt;br/&gt;
in den Online-Modus gehe, kommt ein Ausnahmefehler und die Steuerung bleibt an der Stelle des Pointeraufrufes stehen.&lt;/p&gt;
&lt;p&gt;&lt;span style="color: #0000BF;"&gt;Das Beispiel:&lt;/span&gt;&lt;br/&gt;
TYPE Test &lt;br/&gt;
STRUCT&lt;/p&gt;
&lt;p&gt;gruen: Bool;&lt;/p&gt;
&lt;p&gt;end_struct&lt;br/&gt;
End_type&lt;/p&gt;
&lt;p&gt;In meiner Funktionblock "Farbe" ist folgendes deklariert:&lt;/p&gt;
&lt;p&gt;Funktion_Block Farbe&lt;br/&gt;
Var&lt;br/&gt;
pt:POINTER TO test;&lt;br/&gt;
gelb:bool:=false;&lt;br/&gt;
end_Var&lt;/p&gt;
&lt;p&gt;Code:&lt;/p&gt;
&lt;p&gt;pt^.gruen:=false;// Steuerung bleibt hier stehen!!!!&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>