Step 7 pause/wait/hold programming?

W

Thread Starter

Waynes McBrown

I am trying to program my Siemens 314 PLC with Step 7. A problem I am having is trying to make a particular subroutine pause or wait for a second or 2. The situation is that when someone presses the start button on the HMI, the PLC will turn on 1 pump, wait a couple seconds, then turn on another pump. I cannot seem to figure out how to make the stupid program wait a couple seconds. I looked through the libraries and called up a block called "wait" where I can make the program hold or wait for x time. The problem is that the max value is 32676 or whatever the max value is for int and this value is for microseconds! 30000 microseconds is nowhere near the 2-5 seconds I wish. Any advice?
 
Advice.. well maybe

Try OB35. Set interupt to 1
Second or 100 mS and run a counter on that.

or

Try Time_Tick SFC64.. This will give You the current real time. When You start first motor get the time. Then keep getting time until the diff is greater than 5 Seconds or what ever.

or

Try TON SFB4

or

try OB1_PREV_CYCLE temp variable in OB1. keep adding up differences till You get 5 Seconds.

If one of these isn't enough I can send You some code to do it for You.
 
> Why do you want the program to wait?? <

1. Call output for pump 1 (call it x)
2. when x is on start delay on timer (say T1)
set for 10 seconds (s5t#5s)
3. on next line if pump 1 on (x) and T1 on then turn on pump 2.

job done
 
H

Hakan Ozevin

Contrary to a PC program, you cannot make a PLC program to wait. A PLC should make scans, otherwise it will not catch changes in the inputs (inputs are only read at the beginning of the program cycle).
Just look at the time relay commands. You can easily solve this by internal time relays.
 
W

Waynes McBrown

I see your point about wanting the program to wait. I need some help here with my poor coding skills and timers. I just can't seem to get them to work. Here is a sample network.

-----------

L MB 0
L 10
==D
JCN M012
FR T 1
T QB 125
L S5T#10S
SF T 1
JCN M012
L 12
M012: T QB 125

---------

qb 125 is controlling the pumps. When it is set to 4 then pump 1 turns on. When it is 12 then pump 2 turns on. MB 0 is just a check to see if something else was tripped before the pumps actually work. Thanks for your help.
 
J

James Ingraham

You might try using Sequential Function Charts (SFC) instead.

-James Ingraham
Sage Automation, Inc.
 
D
Do you really need the program scan to wait are do you just need outputs and logic to wait? I find it hard to believe that you would need to pause the program scan to accomplish the desired control.
 
M

Michael Griffin

You don't want to make the whole program wait - you will trip the watch dog if you do that. You want to use an on-delay timer. You start the timer when you meet the first condition (the first pump starts), and your program
continues to run. Your program then watches for the timer to be done (you set the timer preset to whatever you want it to be), before starting the second pump.

I suspect you don't have much experience with PLCs, as this sort of problem is very simple in ladder logic - it is exactly the sort of thing it was intended to solve with minimal effort. The solution you were looking for is the way a computer programmer would try to solve things. That is not how you do things with a PLC. A PLC program is always scanning, it never stops. All
of your program rungs execute "in parallel" every scan (to put it simply). There is no real "start" or "end" to the program - it just goes round and
round all the time.

I suggest you look up "timers" and look for some examples. Siemens has another series of PLCs called the S7-200 which are much simpler. The manual for the S7-200 series is written in a manner which you may find easier to understand (you can download it for free). You should be able to apply the general principles you learn in the S7-200 manual to the S7-300, just keeping
in mind the details of how they work is different.

************************
Michael Griffin
London, Ont. Canada
************************
 
S

simone stefani

Sorry, may be i'm not understanding
but why you are not using a simple timer ??

Simone Stefani
Elettrocommerciale S.r.l.
Divisione automazione
Mailto:s.stefani(AT)elettrocommerciale.it
 
C
A good way to do this and avoid the problem might be
to energize the first pump and start the second with
proof from a pressure/flow switch or a current monitor.
This would depend on why you are staging the pumps in
the first place. Delays and programs that depend on
timers operate "open loop" and can be a headache when
things don't happen in the allotted time.
For example, if you are staging pumps to stagger the
starting currents, if the first pump is slow to start
you will have breakers popping for no obvious reason.
If starting the second pump happens when the first is
up to normal speed as proven by flow, pressure, or
return to normal running current. This doesn't happen.
Timing is okay for heating and lighting, etc. But' it's
kinda iffy for motors. This is IMHO, of course. I'm
sure others will disagree, as I've seen programs where
everything is on timers. There was a reason I was looking
at them :^)

Regards

cww
 
M

Michael Griffin

On November 22, 2002 07:15 pm, Waynes McBrown wrote:
<clip>
> I see your point about wanting the program to wait. I need some help
> here with my poor coding skills and timers. I just can't seem to get
> them to work. Here is a sample network.
>
> -----------
>
> L MB 0
> L 10
> ==D
> JCN M012
> FR T 1
> T QB 125
> L S5T#10S
> SF T 1
> JCN M012
> L 12
> M012: T QB 125
>
> ---------
>
> qb 125 is controlling the pumps. When it is set to 4 then pump 1 turns
> on. When it is 12 then pump 2 turns on. MB 0 is just a check to see if
> something else was tripped before the pumps actually work. Thanks for
> your help.
<clip>

I would really suggest that you read a basic book on PLC programming. Some of the better manufacturer's manuals provide a good introduction (and they're free to download). The basic concepts you are using are completely wrong. It really is much simpler than what you are trying to implement. I will make a few basic points first.

1) If you are looking at individual inputs, or logic states (boolean variables), or outputs, then you are dealing with bit operations. Typical PLC programs consist mainly of bit operations. PLCs have lots of instructions for manipulating individual bits.

2) Byte and word operations are used very seldom. Many (perhaps even most) PLC programs don't contain any. They are typically used when dealing with analogue values, and occasionally for special mathematical operations.

3) There is no need for "jumps" in what you are trying to do. Indeed, you can get yourself in a lot of trouble with jumps, especially when using
timers. The timer needs to be in the program scan if it is to be expected to have a chance to do its job properly. When you jump around it, the timer control logic is bypassed.

4) Writing bytes to output cards is usually a bad idea, unless you really need to control all the bits together. When you write a byte to a card you
are not only turning on certain bits, you are also turning off the others.

I am not sure I understand exactly what you are trying to do from either your description or from your code sample. Particularly, I am not sure what
is supposed to turn on the first pump. However, I will attempt to provide a timer example using ladder logic. I don't know if the fonts you are using will line up the characters properly in your e-mail software but if not, you should be able to fiddle with them.

In the first rung of the following example, bit M1.0 is turned on by some means elsewhere in your program. When it turns on, the pump control contactor wired to output Q125.2 turns on.

In the second rung, the logic examines the state of Q125.2. If it is on, it turns on timer T1. If Q124.2 is off, timer T1 is automatically reset.

In the third rung, the logic examines timer T1 to see if the time delay has completed. If it has, then output Q125.3 is turned on. This should energise the contactor which controls pump 2.

M1.0 Q125.2
----------[ ]----------------( )-----

Q125.2 ----------------
----------[ ]----------------| T1 |----
| SS5T#10S |
| |
----------------

T1 Q125.3
---------[ ]-------------------( )------


So, the end result should be that pump 2 is turned on 10 seconds after pump 1. If pump 1 turns off, then the timer resets, which turns off pump 2 at the same time.

************************
Michael Griffin
London, Ont. Canada
************************
 
You are describing a very simple problem, there are a number of timers avalialble to you in s7 why not just choose one of these and create a delay timer.

I suggest using an instance of sfb4.

Regards
Dane
 
Top