S7 Retentive On-Delay Timer

minerman

Member
Join Date
Nov 2012
Location
Columbus, OH
Posts
82
Can you give me a suggestion for using a retentive on-delay timer within a function block that will have multiple instances?

I have found two possible options but I am unsure how to implement either:

1. FC80 (under TI-S7 Converting Blocks). I am nervous that this will not work when its inside an FB that has multiple instances. I am also unsure of what to use for the DELTA_T input. The examples that I have seen, say to use #OB1_Prev_Cycle. I am not programming inside of OB1, so I don’t think the FB recognizes this.

2. S_ODTS (standard instruction set). I’m still unsure how to specify a memory location for any type of timer that will be reused in a function block with multiple instances. I know I can assign data T10 to the timer, but I don’t understand how this works with multiple instances. If I assign T10, what memory will be used for the 2nd instance of the function block?

Thanks!
 
There is several ways

Hi:

I'm thniking on several ways to solve your problem. If you are planning to use an FB with retentive DBs (the default behabiour in S7-300 with MMC), you could create IEC TON Timer in the stats part of the FB declaration. If you this in this way, The instance DB will contain the IEC TON data.

I'm in a hurry, so I can't send you any example.

Best Regards,
Kelkoon
 
Thank you. I have actually been doing this for when I need a traditional on-delay timer.

So you're saying that the SFB 4 timer actually is a retentative timer? How is it reset? I don't see an input for a reset bit.

I guess this means I should go back and replace the sfb 4 blocks that I had inserted before, because I think I would like my timer to reset when my input goes false.

Do you have any suggestions for a block to use that would act more like a rockwell TON? (timer count goes to 0 when input goes to 0).
 
OK, good.

I'm still failing to find a solution, or a timer with a retentive count (elapsed time remains when input goes false, and resumes when input goes true).

I need one that can be used in an FB, with multiple instances.

Thanks!
 
First:

There are a few things, I find, that should always be in OB1.
Among them is putting #OB1_PREV_CYCLE in a DB or memory location.
This will enable you to use it anywhere in your program.

Now on to your issue:

Using FC80 should work. Even with Multi-instance FB's.
For this to work, you will have to modify OB1.
(well L D might say this is not entirely true as you could use V-data to get the correct info without modifying OB1)

If you want to use a simple S_ODTS, declare the timer as IN in the FB. On each call of the FB you'll have to assign a unique timer to it.
 
Last edited:
Jeebs said:
If you want to use a simple S_ODTS, declare the timer as IN in the FB. On each call of the FB you'll have to assign a unique timer to it.
How would you do that with multiple instance ?

Anyway, I agree that FC80 should work even with multiple instance FBs. You merely have to declare in the calling FB the data passed to and from FC80 for each instance.
And yes, in OB1 just pass #OB1_PREV_CYCLE to a global MD address.
 
You are forwarding absolute S5 timer addresses in one level. That is not multiple instance.

If you have to create an upper-level FB with lower-level embedded FBs (as multiple instance) and the lower level FBs should have S5 timers. Then on the higger level FB you have to make as many IN pins as there are S5 timers.
 
Multiple Instance refers to how you nest FB's within another.
Where you use the STAT area of the calling FB to store the data of the called FB.

My example shows 2 FB's called from a main FB, where their data is stored in the STAT area of the main FB as Instance 1 and Instance 2.

What my example is not, and I think this is what you meant, is reusable.
Due to the absolute adressing of the timers within the FB, it renders the main FB not reusable. Your comment will help solve that 'problem'.
 
You may be right that your code can be called multiple instance.
I would argue that the S5timer that is passed one level isnt part of the multiple instance. But who cares, it is a fruitless discussion.
In my opinion important is that using absolute addresses with multiple instance defeats the purpose.

Apart from this, I am certain that minerman can get the functionality he wants with FC80 as it has already been discussed.
 

Similar Topics

Hello guys, I am currently looking through some examples of how timers work, but this ladder logic diagram gets me really confused. Once I:1/0 is...
Replies
2
Views
1,847
Hello Again, I am in need of some guidance again. I am kind of stuck.I can not seem to come up with a solution yet.It is a class assignment.It...
Replies
11
Views
3,171
It seems to be a very straightforward question but I need a help.For S7 200 Micro PLCs there is a Retentive On-Delay timer(TONR) that satisfies...
Replies
18
Views
14,189
C
I NEED SOMEONE TO PLEASE HELP ME OR AT LEAST SOME HINTS ON HOW TO GET LOW VOLTAGE PROTECTION WITH THE DONEBIT BEEN TRUE ALL THE TIME IT SEEMS HARD...
Replies
16
Views
8,827
Back
Top Bottom