Needing S7-200 functionality in S7-400

Jeebs

Member
Join Date
Feb 2007
Location
Leuven
Posts
1,059
Hi,

Never thought this day would come, but it seems the S7-200 has something the S7-400 is lacking. Or it might just be me missing it.

My problem:

Got Valve. Valve needs to be open for 5 mins total.
When safety-door opens Valve closes due to safety issues.
Need timer to 'pauze' when door is opened.
In S7-200 this would be easy. Just use retentive on-delay timer.
In S7-400 I can't seem to find a fast and easy way to do this.

Am I missing something or is this functionality not natively supported in S7-300/400?


Jeebs
 
Am I reading this as you are solving a safety application in PLC code ?
There are safety relays with timer functions for just that purpose.

Apart from that, it is not clear to me what must do what and when.
What must be "paused". The door ? The valve ? Or both ? Or what ?
 
Hi,

Never thought this day would come, but it seems the S7-200 has something the S7-400 is lacking. Or it might just be me missing it.

My problem:

Got Valve. Valve needs to be open for 5 mins total.
When safety-door opens Valve closes due to safety issues.
Need timer to 'pauze' when door is opened.
In S7-200 this would be easy. Just use retentive on-delay timer.
In S7-400 I can't seem to find a fast and easy way to do this.

Am I missing something or is this functionality not natively supported in S7-300/400?


Jeebs

Hello Jeebs;
History has its uses, as you'll see.
TI sold its PLC department to Siemens around 1995 (if my memory serves). Ti engineers were asked to develop a new family of controllers, and they came up with the S7-200.
[Note: ever wonder why MicroWin is not compatible with Step 7?] They retained some functionnalities of the TI505s in their instruction list.
Later, Siemens had to deal will TI505 (and eventually S7-200) users who longed for some of the canned instructions they were used to. So they incorporated the TI-S7 conversion library in their programming software (hoping the customers would get used to the S7 with more ease); so if you open that library you will find FC80, TONR, that will fulfill your requirements.
By the way, the TI-S7 conversion library contains la lot of other goodies I use very often when i program S7 PLCs, including SCALE/UNSCALE, TABLE functions, and excellent FIFO and LIFO instructions. TI505 engineers had a lot of know-how!
Regards,
Daniel Chartier
 
Hi there Jeebs
Actually you can solve this problem by using a word which increments after every second.
Stop the increment when you want to pause it, and reset the word
once the desired count is reached.

How to do this using actual timer, is a mystery. Was not able to do this in 300 too. In hardware configuration actually you can define the number of retentive timers, but then they work as non-retentive timers only. Something or procedure is missing, because cant believe that Siemens has come out with retentive timers which actually dont work as desired.
 
Am I reading this as you are solving a safety application in PLC code ?
There are safety relays with timer functions for just that purpose.

Apart from that, it is not clear to me what must do what and when.
What must be "paused". The door ? The valve ? Or both ? Or what ?

Nope not changing the safety features, thats just whats giving me the headache.
The problem being quality demands valve to be opened for 5 mins total.
Valve opens, during that 5 mins operator opens door, so safety features makes valve close, but timer still keeps on running. Timer should pauze when door opens, so it can resume when door closes.
No changes to safety features whatsoever.
Just a small change in functionality.


Hello Jeebs;
History has its uses, as you'll see.
TI sold its PLC department to Siemens around 1995 (if my memory serves). Ti engineers were asked to develop a new family of controllers, and they came up with the S7-200.
[Note: ever wonder why MicroWin is not compatible with Step 7?] They retained some functionnalities of the TI505s in their instruction list.
Later, Siemens had to deal will TI505 (and eventually S7-200) users who longed for some of the canned instructions they were used to. So they incorporated the TI-S7 conversion library in their programming software (hoping the customers would get used to the S7 with more ease); so if you open that library you will find FC80, TONR, that will fulfill your requirements.
By the way, the TI-S7 conversion library contains la lot of other goodies I use very often when i program S7 PLCs, including SCALE/UNSCALE, TABLE functions, and excellent FIFO and LIFO instructions. TI505 engineers had a lot of know-how!
Regards,
Daniel Chartier

Yeah, knew most of the history.
Also browsed the library, but the problem I found was that FC80 needs OB1_PREV_CYCLE_TIME local data from OB1. Meaning I need to change OB1 aswell to get that data.
And I don't feel thats justified for such a small change.

Seems I'm gonna have to use Manmeet's suggestion. Easiest way to achieve my goal.

Real shame it can't be done with the S5 timers......

Anyways thnx for the help guys.....:D
 
Also browsed the library, but the problem I found was that FC80 needs OB1_PREV_CYCLE_TIME local data from OB1. Meaning I need to change OB1 aswell to get that data.
And I don't feel thats justified for such a small change.
You prefer to write your own retentive timer, in stead of using a tested and debugged one that works as intended ? Just to avoid having to write
L #OB1_PREV_CYCLE_TIME
T "int_cycletime_ms"
in OB1 ?!?
 
Hello Jeebs;
Look at the following post from PLCDev.com
It will illustrate how to use the parameters of FC80 TONR, even easier than Jesper showed earlier:
http://www.plcdev.com/siemens_s7_retentive_ondelay_timer

Note the following explanation about the FC80 requirement for the elapsed time of the last cyclic scan:
The trick here is the DELTA_T input. The timer uses this value to determine the time difference since it was last scanned therefore the function call has to be in a block with a repetitive nature such as OB1 or one of the cyclic OBs. When in OB1, use the interface value #OB1_PREV_CYCLE (OB1s previous cycle time in milliseconds) for DELTA_T.

The author even proposes basic code to generate your own retentive timer, if you prefer.
Hope this helps,
Daniel Chartier
 
Last edited:
Daniel
Great code at PLC DEV.
Great to know that how timer counts the time, just keep on adding the scan time and you are done!! Is this a concept of timers in all the PLC?Is the code shown over there is actually a FC80 code?

And great to know that this is actually same as in post#4, because I hope that seconds bit being given by the PLC is counted the same way as code mentioned in PLC DEV !

I actually thought that there are embedded real time timers in PLC chips supported by fact that CPU manuals mentions the number of timers available in a given CPU model. (317 having 512 S7 timers, while 315 has 256)
 
Last edited:
You prefer to write your own retentive timer, in stead of using a tested and debugged one that works as intended ? Just to avoid having to write
L #OB1_PREV_CYCLE_TIME
T "int_cycletime_ms"
in OB1 ?!?

In short: Yes

Using FC80 requires more changes then simply using a counter.
Why change more then absolutely required?


Daniel
Great code at PLC DEV.
Great to know that how timer counts the time, just keep on adding the scan time and you are done!! Is this a concept of timers in all the PLC?Is the code shown over there is actually a FC80 code?

And great to know that this is actually same as in post#4, because I hope that seconds bit being given by the PLC is counted the same way as code mentioned in PLC DEV !

I actually thought that there are embedded real time timers in PLC chips supported by fact that CPU manuals mentions the number of timers available in a given CPU model. (317 having 512 S7 timers, while 315 has 256)

It's only FC80 that works like that.
The S7 timers you mention at the end of your post are 'real time timers'.
FC 80 needs to be scanned cyclicly. S7 timers don't.
 
Using FC80 requires more changes then simply using a counter.
Why change more then absolutely required?
I cant see how it can be easier than writing the two lines in OB1, and inserting the canned library function. But you seem to be hell-bent on doing it with the counter. Each to his own.

FC 80 needs to be scanned cyclicly. S7 timers don't.
Any retentive timer would have to be scanned cyclically. How else does it know when to time up or to wait at the timed value ? How would you program your counter without scanning the code cyclically ?
 
Ok Jeebs
So hardware timers as well as software timers co-exist......

I think that soft timers will accumulate error over a long duration whereas hardware timers wont!

JesperMP even non-retentive timers also needs to be scanned cyclically else how to know in which scan to start and in which scan to stop them ;)
 
I cant see how it can be easier than writing the two lines in OB1, and inserting the canned library function. But you seem to be hell-bent on doing it with the counter. Each to his own.

Well lets see:

Changing a non critical block vs changing OB1 and adding a new block.
On a machine in production. 1 min unplanned downtime on said machine costs close to €500.
I'd rather take the path of least risks.

Any retentive timer would have to be scanned cyclically. How else does it know when to time up or to wait at the timed value ? How would you program your counter without scanning the code cyclically ?

So what exactly did I say wrong? FC80 is the only retentive one you got so FC80 is the only one you gotta scan cyclicly.
Not including the IEC-timers.
For the regular T's you just need to enable them and that it. It'll keep counting.
Go ahead, try it.
As long as the RLO at the SD/SF/etc doesn't change, ie doesn't get scanned, the timer will keep it's current status.

Go ahead, use the following code and check it:

Code:
AN M20.0
JC End
A M20.0
L S5T#30s
SD T1
SET
R M20.0
End: NOP 0

Put M20.0 and T1 in VAT, set M20.0 using the VAT, watch the timer go.....
Non of the S7 timer need to be scanned cyclicly, but rather, on use/on demand. Keyword here is 'need'.
 
Last edited:
JesperMP even non-retentive timers also needs to be scanned cyclically else how to know in which scan to start and in which scan to stop them
Thats the funny thing with the S5 Timers (which I prefer to call them, as they originate from S5). If you look closer, an S5 timer only has to be started, wherafter it will continue to operate until it hits zero.
It works in the way, that the desired time value is loaded into the memory of the timer. The CPU then sees that the time value is not zero, and starts to time down. The code that evaluates the status of the timer is really a comparison of that the time value is zero or not.
From all this you can also see that it is not possible to make a retentive S5 timer. Once it is started it will continue to time until zero.

What irritates me is that there is no retentive IEC timer. I see no reason why it should not be possible.
 
Well lets see:
Changing a non critical block vs changing OB1 and adding a new block.
On a machine in production. 1 min unplanned downtime on said machine costs close to €500.
I'd rather take the path of least risks.
Any block called in OB1 is as "risky" as OB1.

Jeebs said:
So what exactly did I say wrong?
Jeebs said:
It's only FC80 that works like that.
I mean that ANY retentive timer, not jsut FC80, has to be scanned cylically.
For the regular T's you just need to enable them and that it. It'll keep counting.
I know that, see my post before this one. The S5 timers works in a special way that makes it impossible to make a retentive S5 timer.
 
Ah..
Lot to learn about timers too. Iam very curious about the functionality of making timers retentive in properties of CPU in hardware configuration. It clearly states to mention the number of timers which we want to work as retentive!!
Now a Siemens guy must have checked this before mentioning in the manual isn't it ??o_O
 

Similar Topics

MY question may be silly but am a student and i've got in my graduate project a S7-200 PLC. i've made the pc/ppi cable by myself and it worked...
Replies
1
Views
1,730
Hi I would like to know if you can suggest a solution to a problem. I have a piece of machinery that is primarily pneumatic in its operation and...
Replies
8
Views
1,860
So I have the following assignment for a class I am taking. "Program overview: The size of the load to be wash is selected first. The start...
Replies
6
Views
2,568
So we just wired up a small automotive shop. They bought a second-hand lift but only have a single phase service. The motor is 3 phase, and the...
Replies
19
Views
7,193
Does anyone know of a good HMI that works well with Opto 22? I've been trying Red Lion G306M000 and have been coming up with difficulties in...
Replies
1
Views
1,876
Back
Top Bottom