Hello, panthripu;
Program control and Loop instructions are available for Siemens PLCs in SCL, an add-on package to Step 7; SCL uses a Pascal-like programming environment where you can use FOR...Next, IF..Then..Else and Case() instructions.
If you do not have SCL, you can programm STL (Statement List) functions that will do the same as IF..Then..Else:
For example, say this is part of the code for FC1:
L MW24 //load control variable (content of the register MW24)
L 2 //load control value (decimal 2)
> I //evaluate if control variable is greater than control value
JNB _M00 //if not true, go to code at label _M00 (ELSE THEN)
JC _M01 // if true, go to code at label _M01 (IF)
.... // more code
_M00: L MW24
L 1
- I // if first comparision is not true, decrement MW24
_M01 : S Q0.5 //if first comparsion was true, set an output
Look at the help files on STL in the programming editor of Step7 for more details.
Hope this helps,
Daniel Chartier