<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to CmpApp library and the "AppStoreRetainsInFile" function</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/74485fd9ed/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/74485fd9ed/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/74485fd9ed/</id><updated>2023-04-17T06:53:12.729000Z</updated><subtitle>Recent posts to CmpApp library and the "AppStoreRetainsInFile" function</subtitle><entry><title>CmpApp library and the "AppStoreRetainsInFile" function</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/74485fd9ed/?limit=25#a1bd" rel="alternate"/><published>2023-04-17T06:53:12.729000Z</published><updated>2023-04-17T06:53:12.729000Z</updated><author><name>murdemon</name><uri>https://forge.codesys.com/u/murdemon/</uri></author><id>https://forge.codesys.comb24011a017adca6da08f8898954e6f2ff675766d</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;yes thanks this is help.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>CmpApp library and the "AppStoreRetainsInFile" function</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/74485fd9ed/?limit=25#a6eb" rel="alternate"/><published>2023-04-16T06:17:02.031000Z</published><updated>2023-04-16T06:17:02.031000Z</updated><author><name>kislov</name><uri>https://forge.codesys.com/u/kislov/</uri></author><id>https://forge.codesys.comb4e521648b894b736be2df748b0e1927658ca196</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I think you need file placeholders ($$PlcLogic$$/Application/...) instead of direct filepath.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>CmpApp library and the "AppStoreRetainsInFile" function</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/74485fd9ed/?limit=25#af2c" rel="alternate"/><published>2023-04-15T09:06:42.535000Z</published><updated>2023-04-15T09:06:42.535000Z</updated><author><name>murdemon</name><uri>https://forge.codesys.com/u/murdemon/</uri></author><id>https://forge.codesys.com2b5efa55342635f3c3f068845c0a625fcaa0e4cc</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Have problem with AppStoreRetainsInFile, AppRestoreRetainsFromFile function. All time return &lt;br/&gt;
ERR_OPERATION_DENIED. &lt;br/&gt;
Maybe need add something in Codesys Config file (/etc/CODESYSControl_User.cfg) to make it accessible ? Using ARM SL 4.7.0.0 Runtime. &lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>CmpApp library and the "AppStoreRetainsInFile" function</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/74485fd9ed/?limit=25#857c/20c8/d733" rel="alternate"/><published>2022-01-26T05:10:24.304000Z</published><updated>2022-01-26T05:10:24.304000Z</updated><author><name>matthew</name><uri>https://forge.codesys.com/u/matthew/</uri></author><id>https://forge.codesys.com8e9b0bfdb63082e6fe2c1f7d3b8341d248a441ae</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi Patrik,&lt;/p&gt;
&lt;p&gt;I have everything working well now using a different method posted in another forum.&lt;br/&gt;
&lt;a href="https://forge.codesys.com/forge/talk/Engineering/thread/1f8eee253c/"&gt;https://forge.codesys.com/forge/talk/Engineering/thread/1f8eee253c/&lt;/a&gt;&lt;br/&gt;
This works perfect and is instant. I point the FB MemLocation to the ADR of a Struct. In the struct I have a bunch of different data types and variables, all of them work well. For the length I make sure it is more than all the data types and variables ( Real is 8 bytes and Int is 4 bytes etc ) Note: Under Application settings You have to enable "Use dynamic memory allocation" and set the maximum size of memory.&lt;br/&gt;
Hope this helps you out and a big thanks to arj3090. &lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>CmpApp library and the "AppStoreRetainsInFile" function</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/74485fd9ed/?limit=25#857c/20c8/814f" rel="alternate"/><published>2022-01-25T08:48:27.945000Z</published><updated>2022-01-25T08:48:27.945000Z</updated><author><name>matthew</name><uri>https://forge.codesys.com/u/matthew/</uri></author><id>https://forge.codesys.com4ba2501c1e7e175231712fd0c70f140f86754f5c</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi Patrik,&lt;/p&gt;
&lt;p&gt;I also get the 2 but only after "sudo service codesyscontrol restart" and when I use the save button via webvisu the execution is correct and returns 0. &lt;/p&gt;
&lt;p&gt;From my testing I have to wait on average for 2 minutes for the .ret file to save ( may still be in ram during this time ) Sometimes it will be fine in 10 secs or 30 sec but will still fail at times even after waiting 90 sec so to be save if I wait 120+ sec it seems to work every time. I have tried the sudo sync commands etc but does not seem to help. The Log shows no faults. I don't know what format the .ret is or if there is a way to read the .ret to see if the file is being written to the SD card etc. I will post my code below.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;PROGRAM&lt;/span&gt; &lt;span class="n"&gt;AppRetain&lt;/span&gt;

&lt;span class="n"&gt;VAR&lt;/span&gt;
    &lt;span class="n"&gt;fbDelete&lt;/span&gt;            &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;FILE&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;Delete&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;Function&lt;/span&gt; &lt;span class="n"&gt;block&lt;/span&gt; &lt;span class="k"&gt;to&lt;/span&gt; &lt;span class="k"&gt;delete&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;file&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;The&lt;/span&gt; &lt;span class="n"&gt;retain&lt;/span&gt; &lt;span class="n"&gt;file&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;application&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ret&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="n"&gt;placed&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;directory&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;bootproject&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;sFileName&lt;/span&gt;           &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;STRING&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'ApplicationTest.ret'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="o"&gt;//&lt;/span&gt;  &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;opt&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;codesys&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;PlcLogic&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;Application&lt;/span&gt;
    &lt;span class="n"&gt;pApp&lt;/span&gt;                &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;POINTER&lt;/span&gt; &lt;span class="k"&gt;TO&lt;/span&gt; &lt;span class="n"&gt;APPLICATION&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;Result&lt;/span&gt;              &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;RTS_IEC_RESULT&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;Result&lt;/span&gt; &lt;span class="n"&gt;code&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;xInit&lt;/span&gt;               &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;BOOL&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;SaveButton&lt;/span&gt;          &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;BOOL&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;ReadButton&lt;/span&gt;          &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;BOOL&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;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c"&gt;(* The retain variables are stores in a file and get retrieved afterwards. *)&lt;/span&gt;
&lt;span class="n"&gt;IF&lt;/span&gt; &lt;span class="n"&gt;NOT&lt;/span&gt; &lt;span class="n"&gt;xInit&lt;/span&gt; &lt;span class="n"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;SaveButton&lt;/span&gt; &lt;span class="n"&gt;THEN&lt;/span&gt;
    &lt;span class="c"&gt;(* First delete the retain file.&lt;/span&gt;
&lt;span class="c"&gt;       This is necessary, because the function AppStoreRetainsInFile appends the data at the end of the file. *)&lt;/span&gt;
    &lt;span class="n"&gt;fbDelete&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;xExecute&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="n"&gt;TRUE&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sFileName&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="n"&gt;sFileName&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;IF&lt;/span&gt; &lt;span class="n"&gt;fbDelete&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;xDone&lt;/span&gt; &lt;span class="n"&gt;OR&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fbDelete&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;xError&lt;/span&gt; &lt;span class="n"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;fbDelete&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;eError&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;FILE&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ERROR&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;NOT_EXIST&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="n"&gt;THEN&lt;/span&gt;
        &lt;span class="c"&gt;(* Attention: It takes at least one cycle until xDone is TRUE *)&lt;/span&gt;
        &lt;span class="n"&gt;fbDelete&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;xExecute&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="n"&gt;FALSE&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="n"&gt;xInit&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;TRUE&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
        &lt;span class="c"&gt;(* Now, it's the time to save the retains. *)&lt;/span&gt;
        &lt;span class="n"&gt;pApp&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;AppGetCurrent&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pResult&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="n"&gt;ADR&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Result&lt;/span&gt;&lt;span class="o"&gt;));&lt;/span&gt;
        &lt;span class="n"&gt;IF&lt;/span&gt; &lt;span class="n"&gt;pApp&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="n"&gt;THEN&lt;/span&gt;
            &lt;span class="c"&gt;(* Store the variables in a file*)&lt;/span&gt;
            &lt;span class="n"&gt;Result&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;AppStoreRetainsInFile&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pApp&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="n"&gt;sFileName&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
            &lt;span class="n"&gt;xInit&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;FALSE&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
        &lt;span class="n"&gt;END_IF&lt;/span&gt;
    &lt;span class="n"&gt;END_IF&lt;/span&gt;
&lt;span class="n"&gt;END_IF&lt;/span&gt; 

&lt;span class="n"&gt;IF&lt;/span&gt; &lt;span class="n"&gt;ReadButton&lt;/span&gt; &lt;span class="n"&gt;THEN&lt;/span&gt;
    &lt;span class="c"&gt;(* Restore the Retain Variables from the file.&lt;/span&gt;
&lt;span class="c"&gt;    For storing and restoring, the same pointer to application (pApp) must be used.*)&lt;/span&gt;
    &lt;span class="n"&gt;Result&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;AppRestoreRetainsFromFile&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pApp&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sFileName&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt; 
&lt;span class="n"&gt;END_IF&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;/div&gt;</summary></entry><entry><title>CmpApp library and the "AppStoreRetainsInFile" function</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/74485fd9ed/?limit=25#857c/20c8" rel="alternate"/><published>2022-01-25T08:28:16.600000Z</published><updated>2022-01-25T08:28:16.600000Z</updated><author><name>patrik</name><uri>https://forge.codesys.com/u/patrik/</uri></author><id>https://forge.codesys.com2a707dddc538e37bbdd80b06348bf411a3027de7</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi!&lt;/p&gt;
&lt;p&gt;Thanks for the response. My problem also originates from unreliable power with regular outages. The best solution would be a working UPS but we have tried to get the customer to use it but with no success. This is a work around more or less. If I can save the data in regular intervals then the problem would be solved. I will try to save it to a different file name.&lt;br/&gt;
but to my original question of the return value of the function. what does 2 mean? is it&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt;ERR_PARAMETER   UDINT   16#2    Invalid parameter for this operation&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;from the CmpErrors2 interfaces lib?&lt;/p&gt;
&lt;p&gt;Thanks in advance!&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>CmpApp library and the "AppStoreRetainsInFile" function</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/74485fd9ed/?limit=25#857c/9d34" rel="alternate"/><published>2022-01-25T05:09:40.472000Z</published><updated>2022-01-25T05:09:40.472000Z</updated><author><name>matthew</name><uri>https://forge.codesys.com/u/matthew/</uri></author><id>https://forge.codesys.comc762028666f0fd2293312f67fc439154f361db18</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi eschwellinger,&lt;/p&gt;
&lt;p&gt;Thanks for the response. I have read through the other threads and understand the risks. I have used UPS Hats in the past for my other RPI projects with no issues. The problem with this project is it uses the RPI4 Compute module in a touch screen.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://chipsee.com/product/industrial-pi-cm4-70-pa/" rel="nofollow"&gt;https://chipsee.com/product/industrial-pi-cm4-70-pa/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The screen does not use an SD but has EMMC memory ( my understanding a bit more robust memory ) There is no UPS available nor built into the screen. I do have a shutdown button for the system to be shutdown correctly. The issue is the supply of electricity is unreliable with regular outages. So I need to make sure any changes to the setpoints etc are saved. &lt;/p&gt;
&lt;p&gt;I have the AppRetain working but not reliable, maybe works every 1 in 5 times. I have also been using Sudo Sync and sudo sync -f /var/opt/codesys/PlcLogic/Application this seems to help a bit but not every time. I will try your recommendations of using a different file name and see how I get on. Note: I only plan to save to the disk if the value of the setpoint changes. I have also tried the Persistence Manager without success ( would only work the odd time ) &lt;/p&gt;
&lt;p&gt;Thanks,&lt;br/&gt;
Matthew&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>CmpApp library and the "AppStoreRetainsInFile" function</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/74485fd9ed/?limit=25#857c" rel="alternate"/><published>2022-01-25T04:43:08.594000Z</published><updated>2022-01-25T04:43:08.594000Z</updated><author><name>eschwellinger</name><uri>https://forge.codesys.com/u/eschwellinger/</uri></author><id>https://forge.codesys.comb17eb815b57ae0d6acdc7238f7b467fd86fa723a</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi,&lt;br/&gt;
I try to explain, the persistence/retain feature:&lt;br/&gt;
Usually if you do nothing in your application and you shutdown your plc graceful( not just poweroff), this means Linux shutdown or - you have for example a UPS connected, Application.ret will be written by tthe runtime, no need to call anything.&lt;br/&gt;
on next restart the Application.ret will be loaded with the bootproject on startup.&lt;br/&gt;
This is how retains in generell work.&lt;/p&gt;
&lt;p&gt;Now if you trigger this 'save retains' from the application to application.ret it might that these interact with the in background working feature.&lt;br/&gt;
Try to save the retains with another name.ret, and recover them on startup of your application.&lt;/p&gt;
&lt;p&gt;Altough the proper solution is to have a UPS and a graceful shutdown. Then no need to do anything with this function and additional you protect your OS against damage on the SD card/flash, makes it more robust against the ' I could not start my OS because filesystem is corrupt' problem.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>CmpApp library and the "AppStoreRetainsInFile" function</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/74485fd9ed/?limit=25#60b8/bbe6/0ab1" rel="alternate"/><published>2022-01-24T20:20:29.590000Z</published><updated>2022-01-24T20:20:29.590000Z</updated><author><name>patrik</name><uri>https://forge.codesys.com/u/patrik/</uri></author><id>https://forge.codesys.comeea8a387c2d9d2636cbc692dfba89ff387600556</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Can you post your code and I can see if I can help.&lt;br/&gt;
I think my problem is related to the functions having issues with child applications.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>CmpApp library and the "AppStoreRetainsInFile" function</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/74485fd9ed/?limit=25#60b8/bbe6" rel="alternate"/><published>2022-01-24T20:00:20.381000Z</published><updated>2022-01-24T20:00:20.381000Z</updated><author><name>matthew</name><uri>https://forge.codesys.com/u/matthew/</uri></author><id>https://forge.codesys.comc4e44dc601b1aba37bd9919eafb6a779115fbe2b</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi Patrik,&lt;/p&gt;
&lt;p&gt;I did try with my own save button as a test. I think my issue could be reading the file back. Or it's just not writing to the file correctly. If I restart the CodeSys service after saving it should read that .ret file, but it's just reading the old original file. Maybe if I back up the file and remove it and see if it will create a new file or create a blank file and see if any data is being stored.  &lt;/p&gt;
&lt;p&gt;My Plan was the store all my retain variables for the parameters/setpoints etc in a struct and monitor the struct for any changes in values and then trigger the save automatically using the AppRetain. But I can't even get a simple test to work correctly. So hopefully someone who has been down this track can shed some light on this issue. &lt;/p&gt;&lt;/div&gt;</summary></entry></feed>