Step 7 Subprograms, and a LIM block

WilsonNC

Member
Join Date
Dec 2010
Location
Murphy
Posts
24
I am building a new program in step 7. The way I normally structure the program, I have a main, then several subprograms for different parts of the machine. Most subprograms will be in LAD, but some networks within each program will be in STL and call some FC's I have already designed.

If I make OB1 my main, do I program the subprograms as FB's and call them from a box, or FC's and use the (call) operand?

Or should they be OB's?

Also looking for a block that looks like the AB LIM block. I need a block that can have three integer inputs, then a boolean output. The inputs would be a low(constant), and high(constant), and the input variable. The output would be true if the input variable is within the high and low limits.
 
Lim (rs5000)

These don't appear to be examples of what I am looking for. The output of the function I need is boolean. If the input value is between the high and low limits, I need a boolean output. In RS 5000 it is called the LIM (Limit test)(circ)
 
.. and call some FC's I have already designed.

Also looking for a block that looks like the AB LIM block. I need a block that can have three integer inputs, then a boolean output. The inputs would be a low(constant), and high(constant), and the input variable. The output would be true if the input variable is within the high and low limits.

If you have already designed some FCs what exactly is the problem with implementing a function that does what you describe above ?
 
I am building a new program in step 7. The way I normally structure the program, I have a main, then several subprograms for different parts of the machine. Most subprograms will be in LAD, but some networks within each program will be in STL and call some FC's I have already designed.

If I make OB1 my main, do I program the subprograms as FB's and call them from a box, or FC's and use the (call) operand?

Or should they be OB's?

Also looking for a block that looks like the AB LIM block. I need a block that can have three integer inputs, then a boolean output. The inputs would be a low(constant), and high(constant), and the input variable. The output would be true if the input variable is within the high and low limits.



The way you always structure a program is the way it is done in Siemens. OB1 is your 'MAIN" and all normal control blocks are called from there.

The other OB's are for special cases and are called by the system, so unless you have need to use their call conditions then you would not use them. The most commonly used OB's would be the timed interupts and/or the start up blocks.

The blocks called from OB1 can be FC's or FB's, it depends on how you want to structure your code. I would normally call a number of blocks which themesleves would call further blocks and in this way structure code, eg..

- Input Conditioning
- System Flags
- Alarm Handling
- Machine Infeed Control Block
- Machine Functions
- Machine Outfeed Control
- Output Conditioning

In this way it makes it easier for someone to fault find starting from OB1, they can open the area of code they desire and from there perhaps there would be anouther set of choices for specific functions of the machine.

Apart from the instruction set, Siemens comes with an extensive library of pre-programmed blocks available from the code window, its always good to search here first, there are a number of sub sections of these blocks as well, to find quickly what is in each, go to the library and do 'F1' on one of the blocks and a help screen will come up, go to contenets and it will list the blocks in that library folder.

If the excact function is not available, then yopu will have to code yout own. I'm sure people will help here if you require it.
 
Great suggestions PeterW. I do a very similar structure. It makes OB1 much less cluttered and easier to understand.

I would also suggest to the OP that a 'WorkDB' is also created. This is better (for me atleast) then using M bits and a VAT table for troubleshooting, since you can just go online with the DB and not copy and paste from the symbol table.
 

Similar Topics

I am having a step7 v5.4 program where the blocks are encrypted and locked. And the manufacturer is stopped the support. Is there any ways to...
Replies
2
Views
175
Good Morning, Hoping someone with some Siemens experience can give me a hand with this one. Customer has a S7-200 cpu, which has a 6GK7...
Replies
0
Views
248
HI! HOW COULD I OBTAIN THE NAMES OF THE STEPS OF A ROUTINE IN SFC LANGUAGE IN STUDIO5000? Or is there a system variable that gives me those...
Replies
0
Views
339
I'm just trying to figure out the right method of adding a DO card to an existing rack. It's not the *next* open slot, but I have to move the AO...
Replies
5
Views
547
Hi Siemens Experts, I am hoping someone can shed some light on my issue. I have uploaded the code from a S7-300 (317-2PN/DP) using Step 7...
Replies
9
Views
673
Back
Top Bottom