Jump to content
Flex727

Timer (TON function) problem after power cycle

Recommended Posts

I seem to be seeing an issue with the TON function. Any timer that is running when the PLC gets power cycled or rebooted will immediately trigger when the PLC comes back on. The timers are set for "Retained". Shouldn't they just continue timing from where they left off?

Share this post


Link to post
Share on other sites

I found the same issue with retained TA timer. if the timer is not counting (running) when the PLC reset's or power cycle, then the current value retained as should be. But! if a retained direct contact is used to trigger the timer, and its status is "1" when the PLC Resets/Power cycle, then the TA timer status returns with current value off ZERO (instead of continue the countdown as expected),  and the output bit is "1", all before the preset time actually elapsed.

 

I guess there is a bug with timers, if triggered on the initial cycle its behave unexpectedly (current value become zero)

Share this post


Link to post
Share on other sites

I need some of my timers to resume from their last Current value following a system reset (which can happen following a software upgrade). If I just retain them they simply re-initialise.

I think I can achieve this as follows:
1) Set the timer T to Retained. This just affects the Preset value.
2) In the main scan regularly store a copy of T.Current into a retained tag TC.
3) On the Ladder Initial Cycle (which happens following reset):
               3.1) Store T.Preset into a temporary location TP
               3.2) Store TC into T.Preset
               3.3) Reset timer T. It's Preset and Current values are both now equal to TC
               3.4) Store TP into T.Preset.

Timer T is now running with its Current value at TC and its Preset at TP, which is where they were prior to reset.
In my (limited) testing so far, this works for Reset, Reboot and Power Off.


Robin Proctor

Share this post


Link to post
Share on other sites

ofer.yishai, I've found a workaround to the timer bug. The timers are being triggered on the Initial Ladder Cycle when active on bootup. If you place an inverted contact for "General.Ladder Initial Cycle" in front of the timer logic, then the timer will behave as it should (reset on bootup without triggering the Out bit, and continue timing).

  • Upvote 2

Share this post


Link to post
Share on other sites

Thanks Robin,
It sound good as a workaround, but definitively this will be "work more do less",  in opposite of the whole new concept. don't you agree?

Should the retained only affect the preset value?  ..I wonder... because  its sometimes affect current value as well (TA at least..), but only if  timer is not running when the power is lost? should current value be retained, I'm not sure, but it is not consistence..

I think it worth some official reference from Unitronics. 

Another workaround would be to abandon the use of timers, and prefer Inc/Dec functions as time counter with retained or non retains tags depend on the needs. 


Ofer

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...