Looping problem in Step7 with Siemens PLC S7200


Thread Starter


Hai friends...
I need some help from you.
I work with Siemens S7200 and step7 Ver4.0 programming.

There are 2 problem:

1. I want make a looping process in actual time....using FOR - NEXT.
For example I want 0.1 second for each looping process, so for 100 process need 10 second.
So I will get a data every 0.1 second during looping proccess.

in STL :
LD SM0.0
FOR VW125,+1,+100

2. I want make a looping process continues (no limit).
I don't know how in s7200 the looping process limited on 2000.... So how to make no limited looping???

Do you know, what I mean???
1. Each loop must execute in 0.1 second.
For Example :I have y(t) as a output from a function, where t is time. with loops I need the value of y(0.1)? y(0.2)? y(0.3)? and so on...
(I try with FOR-NEXT)

2. I need loops that function (no 1) become unlimited. So I get y(0.1),y(0.2),y(0.3),.......,y(I stop the program).How the program???

Please Give me the solution in LAD or STL STEP7-Microwin.

Thanks before

marc sinclair

Firstly upgrade to SP5, see the Siemens website, it's free. Secondly don't use timers, use timed interrupts, look in the help under interrupts. You can call a routine at regular intervals, indefinitely!

Marc Sinclair

Michael Griffin

If you do a continuous loop, the watch dog timer will trip and shut down your program. PLCs are not meant to be used this way. This is very basic PLC programming knowledge.

You seem to actually want to use a timed interrupt. You create a subroutine and ask the PLC to call it every 'x' milliseconds. There
is an example of how to do this in the the S7-200 manual.

Slawomir Telman - ALTECH


Basically in each plc You do not make any unlimited looping... each the program is cyclicall - first to last instruction (usually ~20 ms to max 2000ms... normally it is very high time...) Each a PLC has timers for simple time control in program or time interrupt (?) for advance time control (PID loop) Normally you can use any timer T which run 10ms to 999 x 10s time.


JC =next or function block but Yuo must a test A T1 - normally jump to next
it is executed when T1=1 first scan after finish declared time for T1
next A I 0.0

L KT 200.2 - { 200 x 1s}
SD T1 (one puls after 200 x 1s - pulse gen.)

The loops in the PLC are very basic as regards to the PID. These algorithms do not provide very tight/good controls.

To implement a good PID control, you need model base tuning like based on IMC. These are good in case the PI diagram has been designed wrongly and the loop does not get tuned. These facts have been recognised by Siemens personnel themselves (top level) who use this software separately also.