Step 7 Timers

katratzi

Member
Join Date
Mar 2005
Posts
210
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 create one yourself? If so, can you, for example use a less than to examine the value in parameter TV, and a greater than zero compared to the remaining time value (BI or BCD) and as long as these two conditions are met, assume that the timer is timing? There has got to be a better way.
 
There are a couple of ways to do it. You can evaluate the timer directly anywhere in the program like this:

A M10.0
L S5T#2s
SD T10
.
.
.
A T10
= Q1.0

Or, you can set a bit wherever the timer is created and then reference that bit elsewhere in the program:

A M10.0
L S5T#2s
SD T10
A T10
= M10.1
.
.
.
A M10.1
= Q1.0

(I used STL, but ladder works the same way).

I always use the second method, because timers run asynchronously to the scan, and it could change state during the scan. If I set a bit and then reference this bit in the program, then this problem is eliminated.

Also, you can use L T10 to get the current timer value as an int, and LC T10 to get it as BCD. The problem with LC though is that you also get the time maultipler, which would have to be masked out. Stick with the int if you need to do math.
 
Last edited:
Thanks, S7. I will try this. I know little about STL, but if this is convertible to LAD, I can do it.
 
Your probably better of to use the TON function (SFB4) in the library). It's got a lot more going for it then S5 Timers and you don't have to deal with S5T or BCD.


Nick
 
I'm not sure if I'm missing something here, but I don't think S7Guy's solution is what is being asked for.

S7Guy's solution is the timer has completed timing bit, what is being asked for is a bit which show's the timer is actually timing bit.

Am I right here?

Edit: add a solution if I'm correct

Maybe use a pulse or extended pulse timer, as in both cases the Tx boolean is on whilst the timer is timing, the difference being the extended pulse timer continues timing until the preset is complete and keeps Tx on regardless of the input condition, whilst the pulse timer stops if the input condition goes off and Tx drops too.
 
Last edited:
I figured that would be enough to get him going. Once you understand how a timer works, then it's just a matter of adding logic.

It really requires an understanding of the type of timer to determine if the timer is actually running.
For an On-Delay timer, someone would have to add the start conditions of the timer along with the state of the timer:

A #ThisStartsTheTimer
AN T10
= #TimerRunning

But for an extended pulse timer (SE), then all you have to do is evaulate the timer:

A T 10
= #TimerRunning
 

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,777
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,337
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,746
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,236
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...
Replies
30
Views
12,065
Back
Top Bottom