S7 Retentive Timer

2 posts in this topic

Hey all. Been on here forever but rarely post. I'm working on an S7 project that I need some assistance with as I rarely use S7 and when I do, it's typically to troubleshoot, not develop. The code I'm working on was written by someone else and I noticed it doesn't work as I would expect. The original developer used an S_ODTS timer to ensure an event only happens every 20 minutes. The resets are based on if the system is turned off, or if it's completed. The problem is the S_ODTS timer will continue timing when one of the conditions drops out, and then resets when the condition is true again. I've found the FC80 Retentive timer, but the program I'm working in has an FC80 and when I drop it in the program, it says it already exists and asks if I want to overwrite it. I said no, and gave it a new name. I then dropped it in OB1, populated it with everything that was necessary and toggle the bits to enable it, but it's still not functioning.

I apologize in advance if this sounds unintelligent, I just don't use this much at all and I'm lost. Any help in the right direction would be greatly appreciated.

Share this post

Link to post
Share on other sites

Here is some information / descriptions - 


S_ODTS (Retentive On-Delay S5 Timer) starts the specified timer if there is a positive edge at the start (S) input. A signal change is always necessary in order to enable a timer. The timer runs for the time interval specified at input TV even if the signal state at input S changes to "0" before the time interval has elapsed. The signal state at output Q is "1" when the timer has elapsed without regard to the signal state at input S. The timer will be restarted (re-triggered) with the specified time if the signal state at input S changes from "0" to "1" while the timer is running.

The timer is reset if the reset (R) input changes from "0" to "1" without regard to the RLO at the S input. The signal state at output Q is then "0".

For FC 80 (TONR)

This is the enable for the code block. This pin can be permanently true.

When the code block is enabled, the function of the pin can be used. The time counting will count time as long as this pin is true.

The time counter will be reset to 0 if this pin becomes true.

This is the preset value or target value. It is a double integer (DINT), for that reason the "L#" before the number. In the case of the example the L#1000 represents 1000 msec.

This is the duration of time that has gone by since the code block was called (master enable) last. We are able to read the scan cycle time of the PLC. In OB1 there is a "TEMP" variable called OB1_PREV_CYCLE that gives the cycle duration in msec. If you call the code block every cycle then this number should be accurate. This number is added to the elapsed time when TMR_EN is true.

This is the elapsed time. This IN_OUT parameter tracks the time counting and is also the memory.

This is the block output indicating if ET >= PV.

Can you post a image of your FC80 call ?


Edited by Moggie

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now