Modicon PAC Forum
A forum for topics related to the scope of Modicon PAC offers and ecosystem along the whole lifecycle: Modicon M580 and 340, EcoStruxure Control Expert, EcoStruxure Process Expert (Unity Pro) and more.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2025-02-03 02:05 AM
As I find solution on internet they advise to uncheck initialize %MW on cold start and cold start then value will be retain but as I tested, I uncheck them and provide the counter value (output) to address %MW10 then reset power. After PLC back to online value set to 0.
Could you please recommend how to retain last value. (M580 P4040s)
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2025-02-09 01:17 PM
I would suggest rather than using a CTU instruction just use some code that increments a value in a located variable (%MW), then use the retain value on cold start option. If you had multiple counters that needed to be retentive then I would develop a custom DFB where the count value was an In/Out variable and that variable was connected to a located variable (%MW)
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2025-02-09 09:43 AM
@dty.jo, unfortunately in this scenario CV is an output, so on first execution of the program cycle it'll be written as the output of the CTU (zero in this case), regardless of the initial value of variable.
You might try a CTUD FB. With this block, you could move the CV output into a unlocated variable that is connected to the LD input of your counter. Then use then the warm startup bit (%S1) to load in the saved value, I uses a SEL FB with the warm startup bit so that I can still us the PV as normal.
The benefit of this method is that you can leave the 'initialize %MW on cold start' in which ever state you prefer.
I like it checked personally. If you keep it unchecked you could use a located variable instead of a unlocated one, as I suggest above.
The downsides are that you might not always want this behavior? There are probably some edge cases where it gets weird, but I can't think of any right away.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2025-02-09 01:17 PM
I would suggest rather than using a CTU instruction just use some code that increments a value in a located variable (%MW), then use the retain value on cold start option. If you had multiple counters that needed to be retentive then I would develop a custom DFB where the count value was an In/Out variable and that variable was connected to a located variable (%MW)
Link copied. Please paste this link to share this article on your social media post.
Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.