Technical Forum

SIMATIC S7-200

Micro/Win "For" loop

Thread Starter: Eng. L   Started: 5/26/2012 3:56 PM   Replies: 1

« Previous thread Next thread »
Page 1 of 1 (2 items)
  5/26/2012, 3:56 PM
Joined 12/6/2011
Last visit: 5/7/2013
Posts: 13
Rating:
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
Dear All,

I am trying to write a program for S7-224 CPU and it seems I have got some programming issues. The project I am working on requires me to repeat a part of my program a specifed number of times as the user enters the amounts of the materials to be mixed for only "one cycle" and then chooses the number of cycles he needs. I think this requires me to use the For loop.

As I read in the instruction, when the Index value (lets say VW10)  is greater then the Final value (lets say 10), the loop will terminate. Now in my program, for instance, the Initial value is 1 and the Final value is 10 and there is a times which sets an output Q0.1 when it completes. The times (or whatever kind of instructions) between the For instruction and the Next instruction should be executed only 10 times, then the loop should terminate. Now, in my program, it didnt terminate!! Everything continued on running, counters, timers, outputs, whatever. Even though I checked the Index VW10 and found its value equals 11 !! So, what is the benefit of the For loop then? What is it the thing I am getting totally wrong?

I am sorry about this long story. I will appreciate any help about this. Thank you ALL.



=== Edited by Eng. L @ 5/26/2012 3:57 PM [GMT ] ===


Top
  5/28/2012, 9:09 AM
Joined 12/6/2011
Last visit: 5/7/2013
Posts: 13
Rating:
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
Hey,

Won't anyone tell me how to repeat a part of my program for a specific no. of times and then stop the operation? I thought it would work out with the use of "For -- Next" loop, but well, I DID NOT!

It is a bit confusing I know, but please any clear idea would help.
Thanks.
Top
Page 1 of 1 (2 items)
Actions