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: 2022-12-15 03:11 PM
I have an issue with a Derived FB that creates a Run Times (Hours/Minutes/Seconds) of a motor based on a BOOL being TRUE. The FB works just fine until I have to download a new program to the PLC (Stop the Controller) where my output for Run Times resets back to 0. I did disable Initialize %MWi after cold start but problem still continues, I'm sure it has something to do with the way I've set the FB up.
I've read somewhere that the Output values used in the Derived FB will be overwritten when a cold start is initiated and to use Input/Output in place of the Output so the values will not reset back to 0, but that isn't working for me.
I do have a Reset bit in the code which works, I've eliminated it being a factor by writing in 200 instead of zero. .
Maybe somebody could shed some light on this issue for me. Code and Variables attached.
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: 2022-12-15 03:51 PM
I got it. The INC_UDINT resets it's INOUT to 0 when a cold start is activated.
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-03-20 01:32 AM
It isn't that because INC_UDINT is a function and they do not store any internal info which can be lost on a cold start. They start fresh on each program cycle. It is your variable Inc_Value that is lost because it is internal in your function block and that resets to 0 on cold reboot or program download. To save anything inside a function block you have to expose the data as an In/Out and place a variable there on the outside with a %MW on it which holds the data. Or you can check the %S variable for cold start inside your function block, if it is a cold start you can calculate Inc_Value from your Hours, Minutes and Seconds. Or rewrite the code not to be dependant on the Inc_Value all the time, just keep increasing your time counters which is already on In/Out puts so I guess they are probably stored in %MWs outside. Use the r_trig of %S6 to increase Seconds, if it becomes larger than 59, reset to 0 and inc Minutes and so on. That way it is also possible to adjust the time values from the outside if need, maybe a component is changed to another that already has some runtime on it and you want to continue keeping track of that time for example.
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.
With achievable small steps, users progress and continually feel satisfaction in task accomplishment.
Usetiful Onboarding Checklist remembers the progress of every user, allowing them to take bite-sized journeys and continue where they left.
of