Step 7 Timers

danielcarter

Member
Join Date
Jun 2006
Location
St. John's, Newfoundland
Posts
10
Good day everyone... Im using a siemens plc and step7 to program it. I want to time a coil so that when the time counts down the timers contacts change state, ive tried a couple of timers but i cant get it to work the way i want, can anyone help me on how to use timers or counters if thats what i need to use....

Thanks
Daniel
 
Something like this you mean??

timer2.JPG
 
Not really, I assume he wants to activate or de activate the time coil at different timer values? But only using one timer? I would rather use a memory bit in the place of the timer coil and write in comparators to set and reset the memory bit at different values of the timer. But you cant use a timer for this (well not easily) you have to generate a clock pulse then use that to drive a counter and then compare the counter values with a preset value and then set or reset a bit when the comparison is true.



Do you want me to generate some code and attach it?
 
just in case

A "1s_pulse"
FP M 10.0
A "activate"
= "clock pulse"
A "clock pulse"
CU C 0

L C 0 //counter
T MW 40 //tx counter v to word
NOP 0
L MW 40 // load word and compare
L 5
==I
S M 50.0 // m50.0 to be used in prog

L MW 40
L 20
==I
R M 50.0
 
If thats the case how about a ladder type (makes a change for me).

timer3.JPG



remembering the timer shows time left, therefore counts down.
 
danielcarter said:
... ive tried a couple of timers but i cant get it to work the way i want, can anyone help me on how to use timers or counters if thats what i need to use....

A precise description of what you want to happen would be a good start.
 
I think the key to this is
...ive tried a couple of timers but i cant get it to work the way i want

You haven't actually told us what it is you want. And equally importantly, what was unsatisfactory about your previous attempts.
All timers that I know of will have an effect on an output coil once the preset time has elapsed. What that effect is may vary between timers. There are certainly several different types of timer available in STEP7. Most of these are based on the utterly ridiculous S5TIME data type and should have been left behind in S5 by Siemens rather than repeated as part of the S7 instruction set. There are other IEC-compatible timers available as SFBs which are much more usable.

regards

Ken

(PS : Damn it, Simon! Beat me again!)
 
I must admit I am having trouble understanding Siemens antiquated timers. Is there an on delay timer that does not require resetting? In other words, the timer resets when the input is turned off.

I do not mind the S5 timers if they will do what I want although having to programme words to be able to see the PV is quite frankly a "pain in the a***"
 
I try not to dwell on the S5 timer issue too much, I don’t think it’s about to change soon. That is why I opt for Pulse clocks and counters, and then I don’t have to bother with the issue.



Ladder isn’t my cup of tea, but the way Peter did it should work fine, by the looks of it, it’s actually quite impressive. You have to take your hat off to people that can still write good ladder code.

 
Ladder isn’t my cup of tea,
I find that statement quite interesting. I use ladder exclusively as do many of my clients, including Siemens exclusive customers. Many consultants in Ozz actually specify ladder and will not accept anything else. That does not bother me to be honest. Troubleshooting STL for example is an absolute pain in the "A". Ladder is easy if properly structured.

I must admit I normally use Omron and the function list is quite awesome and directed at ladder programmers, although FB and STL are available.

My current client is exclusively a Siemens user and is also exclusively a ladder programmer so that others in the organisation can understand the code and trouble shoot systems. This is not a small organisation. It is quite a large hospital and they monitor the temperature in every room as well as temperatures in every refrigerator in the hospital to the point that at the present moment they are monitoring over 2000 temperatures. They even manufacture their own temperature sensors/transducers in their workshop. The Citect SCADA system currently runs at 100,000 plus tags. That is a pretty big SCADA system.

They exclusively use S5 timers although I wish that were not the case.

They have almost exhausted the Siemens MPI network for communications peer to peer from what they tell me. The programmer/engineer has been working with Siemens PLCs for over 15 years and is a very competant and smart engineer. Has just obtained a Dell 30" wide screen monitor - I am very jealous as I cannot afford one. It is awesome!!!

Writing good ladder code is very much my business and many have complemented me on how easy the code is to understand - with or without extensive commenting. I am of the belief that writing good code is an essential part of my/every other programmers job. I am well aware that there are some terrible code writers out there as I have had to try to understand really bad code and fix it many times. Quite often it is easier to start again quite frankly. But then I remember my first programming job and shudder.
 
Hi Bob, I guess it all depends on perspective and what you “grew up” with. I find writing huge amounts of code in ladder a bit restricting, but that’s just me. I must admit that I am very impressed when someone does, probably because I am an electrician by trade and I can relate to the logic. But there are very few people in South Africa whom still use ladder, definitely not any of the “big” system integrators, also all the code we receive from our Italian mother company is all in STL.



I agree that ladder is easy to trouble shoot for the end user, and I try to write my STL so that it can convert, I also try and steer clear of indirect addressing, as this can also be confusing for the end user.
 
a bit off topic....ok a lot off topic....

You like rugby Bob? Your team only but kicked our buts the other day….lol
 
BobB said:
I must admit I am having trouble understanding Siemens antiquated timers. Is there an on delay timer that does not require resetting?

The On-Delay (SD) timer works that way. In fact, the only timer that requires a reset is the Stored On-Delay timer (SS).

I don't think there is anything inherently easier about ladder. I program and troubleshoot only in STL as well, and it's quite easy if you understand it. If I look at Peter's ladder equivelent to DDV's example, in this case I think STL would be much easier to program and monitor. Most of the techs I have worked with in the past are amazed how easy it is once I show them, mostly because they were always told that STL is hard to work with.
 

Similar Topics

I have done a fair share of PLC programming in my time... but not with Siemens. So far I don't like it very much. The timers are nearly...
Replies
31
Views
16,794
Greetings, I am coding for S7-300 CPU315-2 DP and I have come to an impasse. I made a function to generate pulses of varying duty cycle. As an...
Replies
4
Views
3,342
This is my first program with Step 7 (300 series PLC) and I have to say it is extremely frusterating. And the fact that the company we bought the...
Replies
9
Views
5,759
Do any of the Siemens timers (specifically S_ODT) have a timer timing bit that you can examine in logic like the A-B TT bit, or do you have to...
Replies
5
Views
2,185
Anyone have any words of wisdom regarding step 7 and timers? I found FC80 TONR and may be able to use that. The built in functions S_ODT and...
Replies
7
Views
3,247
Back
Top Bottom