Program Structure in S7

PSI_Admin

Member
Join Date
Jul 2006
Location
Toronto
Posts
5
Hello, Our company are AB SI's and have vast experience programming all types of AB hardware and software. This is great if we only utilized AB products, However, we have severa; projects that the customer has specified Siemens S7-300's. I have been reading all of the literature that came with Step 7, post installation and I can't seem to get an answer to the following question.

If i want to call additional OB blocks from within OB1, is this possible. We are trying to simulate AB's program structure with many ladder files being called from the main ladder cyclically. I am not yet into FB's or FC's. I simply want to program linear with more than one ladder.

Is this possible, can i set up OB2, OB3, etc as ladder files and are they automatically called from OB1, or do i have to specifically call them, if so, how?

Any help would be appreciated.
 
Hello PSI_Admin;

OBs cannot be called by the user program; they are called by the system, either cyclically or event-driven. OB1 is called at the start of every PLC scan; it is the OB with lowest priority, so it can be interrupted by any OB that you install in your project: cyclic OBs (OB35, for example, called every 100ms (adjustable)); hardware interrupt OB (OB40), module error OBs (OB85, OB86...), programming error OBs (OB120), first-scan (warm start)OB (OB100).
For example, any code placed into OB100 will be executed once, before the first call to OB1; a great place to initialize your variables and reset your DBs.
In OB1 you can program your whole program, in a single file, if that is what you want, as you would often do it in a PLC5.
But if you are planning to structure your program, using the same different tasks and subroutines that A_B allows, plan on using FCs and FBs. You can program the general working of a motor, a pump, a valve, a transmitter in a FC, call it for each instance of motor, valve, transmitter... you need, simply by using interface areas for parameter passing.
Take the time to open the example programs available in your installed Step7. File-->Open-->example tab. Follow the FC/FB calls in OB1 in any of the programs and you will understand the basic use of the function bl;ocks in Siemens programming.
Hope this helps,
Daniel Chartier
 
You can program ladder in FC's and FB's.

FC's would be simplest to program, use FC1, FC2 etc as you want.

As replied above OB's are not meant for calling, and programming the whole program in OB1 is seen as an extremely bad programming technique in Siemens.

OB1 is the base, from which you call your routines. Normally you would structure your program so that each call is to a related piece of equipment.

FC 1 could be comms, FC2 Conveyor Area 1, FC 3 Machine 1, etc..

FC's and FB's are very similar, the only difference is that FB's must be called with an instance datablock which acts as its memory, FC's you have to make your own retained memory with flags or called datablocks.
 
we have several projects that the customer has specified Siemens S7-300's
... //...
We are trying to simulate AB's program structure
Maybe it's just me but I really think trying to make one system look and behave like a totally different system is guaranteed to end in tears. You get neither one thing nor the other. It's like having a car (automobile) but treating it like a horse and cart, and then looking for the shafts where you strap in the beast. I appreciate you're at least asking questions here, but I'd strongly recommend throwing the Rockwell design structure out for these S7 projects and starting again learning how to design to get access to S7's strengths. This would be every bit as valid if you were moving in the other direction.

Until Mr Rockwell and Mr Siemens agree on addressing, operating system funtions, internal structures etc we're all doomed to failure in trying to replicate all but the simplest tasks (and that comes from someone who actually thinks there's some good in IEC61131-3!)

Regards

Ken
 
I remember a machine by the Demaco company of New York, it had a S5 PLC as specified by my then company. It had many FB's programmed to emulate PLC2/30 instructions, like GET, PUT etc.


Well I thought it was funny anyway.
 

Similar Topics

Hello all, Just to give you an idea of my background, I'm new to the PLC world with a background in IT and currently pursuing my MSEE. I have...
Replies
3
Views
738
OK, (some of) you guys know by now that I'm not a PLC programmer, so I'm not really familiar with how a well-structured PLC program is typically...
Replies
2
Views
1,470
Program structure - s7-1200 MODBUS RTU Master with multiple slaves & multiple registe I'm having problem to make a appropriate structure of my...
Replies
7
Views
11,246
Hello, I am creating a PLC program for a fresh water pump station which will be based on downstream and upstream pressures. There will be several...
Replies
5
Views
2,102
hi guys I have recently completed a basic S7 course and have started creating my own little programs/solutions to small problems using stl. So...
Replies
1
Views
1,219
Back
Top Bottom