<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Retain areas doesn't work</title><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/4f2963b220/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/4f2963b220/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/CODESYS-V2/thread/4f2963b220/</id><updated>2020-02-27T22:22:12.643000Z</updated><subtitle>Recent posts to Retain areas doesn't work</subtitle><entry><title>Retain areas doesn't work</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/4f2963b220/?limit=25#cee1" rel="alternate"/><published>2020-02-27T22:22:12.643000Z</published><updated>2020-02-27T22:22:12.643000Z</updated><author><name>RajeshGandhi</name><uri>https://forge.codesys.com/u/rajeshgandhi/</uri></author><id>https://forge.codesys.come29f31143712f1a4c4dd2d40d500caf216f276ab</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello All, &lt;/p&gt;
&lt;p&gt;I also had the same issue in our HMI, At last we could able to manage by writing in a .ini file externally.&lt;/p&gt;
&lt;p&gt;Hope your HMI also have a runtime/firmware to run the codesys application. Try to shutdown the runtime/firmware properly in order to retain the values. If that works, there is a problem in your runtime/firmware.&lt;/p&gt;
&lt;p&gt;Thanks and Regards,&lt;br/&gt;
Rajesh G&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Retain areas doesn't work</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/4f2963b220/?limit=25#4abe" rel="alternate"/><published>2020-02-27T22:22:08.309000Z</published><updated>2020-02-27T22:22:08.309000Z</updated><author><name>Rolf-Geisler</name><uri>https://forge.codesys.com/u/rolf-geisler/</uri></author><id>https://forge.codesys.comc57458f252108c123e39c59358ee60ea21aefabe</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi shooter,&lt;/p&gt;
&lt;p&gt;maybe Modbus requires markers, don't know (never used this by now). But - did Shohadawy talk about Modbus?&lt;/p&gt;
&lt;p&gt;Rolf&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Retain areas doesn't work</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/4f2963b220/?limit=25#6891" rel="alternate"/><published>2020-02-27T22:22:06.750000Z</published><updated>2020-02-27T22:22:06.750000Z</updated><author><name>ndzied1</name><uri>https://forge.codesys.com/u/ndzied1/</uri></author><id>https://forge.codesys.comf7804a3ce9e57fb55a744cef00cb5fdbbc113ed4</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;shooter hat geschrieben:&lt;/strong&gt;&lt;br/&gt;
yeah rolf you are good, however on modbus it is needed to use markers.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;What hardware are you using?  We use Modbus in Moeller controllers without using markers.  But we do have to use function blocks.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Retain areas doesn't work</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/4f2963b220/?limit=25#d877" rel="alternate"/><published>2020-02-27T22:22:05.192000Z</published><updated>2020-02-27T22:22:05.192000Z</updated><author><name>shooter</name><uri>https://forge.codesys.com/u/shooter/</uri></author><id>https://forge.codesys.combe49b4cac19b97ba19dfa6004afc4d1ada1457e2</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;yeah rolf you are good, however on modbus it is needed to use markers.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Retain areas doesn't work</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/4f2963b220/?limit=25#2271" rel="alternate"/><published>2020-02-27T22:22:00.858000Z</published><updated>2020-02-27T22:22:00.858000Z</updated><author><name>Rolf-Geisler</name><uri>https://forge.codesys.com/u/rolf-geisler/</uri></author><id>https://forge.codesys.comee817692aaff5afdce513c921a1901f98a915859</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;In CoDeSys - and other IEC compliant PLCs -, there is no need to put variables to a certain address. Let the compiler allocate them. Access is working on the symbolic level only.&lt;/p&gt;
&lt;p&gt;This is useful for RETAIN vars as well. The compiler knows, where to store it. MW0 as given in your example may be outside the battery buffered memory. You would have to study the system manual of the PLC to find out, which addresses are inside.&lt;/p&gt;
&lt;p&gt;I use declarations with an absolute address with IO only. This works fine for lots of years now.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Retain areas doesn't work</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/4f2963b220/?limit=25#578c" rel="alternate"/><published>2020-02-27T22:21:59.274000Z</published><updated>2020-02-27T22:21:59.274000Z</updated><author><name>shooter</name><uri>https://forge.codesys.com/u/shooter/</uri></author><id>https://forge.codesys.com808d3b666a15af9cd69ea6294d6eadee882989ab</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;the retain does not work when you change the program, did you set retain memory correct?&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Retain areas doesn't work</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/4f2963b220/?limit=25#e940" rel="alternate"/><published>2020-02-27T22:21:54.943000Z</published><updated>2020-02-27T22:21:54.943000Z</updated><author><name>Shohadawy</name><uri>https://forge.codesys.com/u/shohadawy/</uri></author><id>https://forge.codesys.comad901b0c21ab21ba4f25d5c262dd337bae50ab44</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Rolf_Geisler hat geschrieben:&lt;/strong&gt;&lt;br/&gt;
3. Why do you use the keyword "Var" as an identifier? This might confuse the compiler.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This is just an example to clarify how I declare variables in my application&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Rolf_Geisler hat geschrieben:&lt;/strong&gt;&lt;br/&gt;
Try to declare the variable as&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;VAR_GLOBAL&lt;/span&gt; &lt;span class="n"&gt;RETAIN&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="n"&gt;RetainVar&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;WORD&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;and put it to MW0, when you need it there.&lt;br/&gt;
Regards&lt;/p&gt;
&lt;p&gt;Why you are declaring the variable without address. "RetainVar: WORD;" Why don't you declare it as "RetainVar AT %MW0: WORD;"&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Retain areas doesn't work</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/4f2963b220/?limit=25#b9bb" rel="alternate"/><published>2020-02-27T22:21:53.393000Z</published><updated>2020-02-27T22:21:53.393000Z</updated><author><name>JAPIB</name><uri>https://forge.codesys.com/u/japib/</uri></author><id>https://forge.codesys.com9f93733bd2ad74a1e30dffd087362e48156c0c9e</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I think you have several ways of search : &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;read the documentation of the product to see if this product accepts retain variables or how to configure this variables. For example, with IFM PLC, there is a function block to use to declare retain variables.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;look for a firmware update.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Hoping to be helpful, best regards&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Retain areas doesn't work</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/4f2963b220/?limit=25#2f9c" rel="alternate"/><published>2020-02-27T22:21:49.015000Z</published><updated>2020-02-27T22:21:49.015000Z</updated><author><name>ndzied1</name><uri>https://forge.codesys.com/u/ndzied1/</uri></author><id>https://forge.codesys.comc494ecd0ceebf55a694f3bad74af09e4425755ca</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;We had a unit, I think it was a Moeller/Microinnovations HMI/PLC that wouldn't retain values only to find out there was a bug in the firmware. When we updated the firmware it all worked out fine.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Retain areas doesn't work</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/4f2963b220/?limit=25#81b7" rel="alternate"/><published>2020-02-27T22:21:47.448000Z</published><updated>2020-02-27T22:21:47.448000Z</updated><author><name>Rolf-Geisler</name><uri>https://forge.codesys.com/u/rolf-geisler/</uri></author><id>https://forge.codesys.com40bdf4d88a4e88980bdcd1774889a652076e0228</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;nobody else seems to have a solution, so let me try an answer.&lt;/p&gt;
&lt;p&gt;On reading the post, three questions came up on me:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Which hardware do you use? Does this support RETAIN variables? (I know PLCs, which support a few bits only)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;I think, it is not always possible to have a variable on a specific address as RETAIN. Some (or all??) PLCs may restrict the RETAIN address space. I normally use the RETAIN clause with symbolic variables only.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Why do you use the keyword "Var" as an identifier? This might confuse the compiler.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Try to declare the variable as&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;VAR_GLOBAL&lt;/span&gt; &lt;span class="n"&gt;RETAIN&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="n"&gt;RetainVar&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;WORD&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;and put it to MW0, when you need it there.&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>