Sign in to follow this  
Followers 0
cauchy

OB,FB, etc. struture

6 posts in this topic

Im new with Siemens. I couldnt understand OB,FB, etc. blocks structures and couldn't find using of these in manuels. How will I use these blocks when I generate a new program? Help please... Sorry I haven't indicated that I will use S7-300 so I've Step7 software

Share this post


Link to post
Share on other sites
Hi cauchy. OB1 is the main program that is scanned cyclically by the CPU. You call other FBs and FCs from OB1. The other OBs are called by the CPU upon special events such as errors or interrupts. It is a good idea to consider which errors you want to catch so that the CPU doesnt stop with a fault. For example: If you dont want to stop the CPU if the cycle time is too long, then add OB80 to the blocks included in the project. To see all OBs, open Libraries .. Standard Library .. Organisation Blocks. Select a block and hit F1 to get help for that block. There are standard FBs and FCs with special functions (SFBs, SFCs). To see all SFBs/SFCs, open Libraries .. Standard Library .. System Function Blocks. Note: Not all SFBs/SFCs are available on all CPUs.

Share this post


Link to post
Share on other sites
A bit of extra info on FC's (Functions) and FB's (Function Blocks). Siemens describe them as blocks with memory (FB's) and blocks without memory (FC's). Basically what this comes down to is a couple of things. Both have: IN = Inputs OUT = Outputs IN/OUT's = Input updated as Outputs TEMP's are temporary scratch flags that you can identify in the block and use. but must be conditioned before use. FB's have additionally STAT parameters, these are dedicated flags used only in the block. When an FB is called in the program, you must specify a Data Block as its 'Instance' Data Block, the DB will be generated by the step7 program for that individual call and will contain a 'memory' for all IN's. OUT's. IN/OUT's and STATs. A FC does not need this. Main differences. Because of instance DB's, FB's can be more memory and scan greedy, especially in smaller S7300 systems. In an FB, you can use an OUT parameter, before it is conditioned as its state would have been remembered in the instance DB, in an FC you cannot, as the state of the OUT parameter is unknown until you condition it in the block. Anything put in as a IN would not be updated on completing the block if you change its state in the block. If you want to do any of those things in an FC it must be an IN/OUT parameter. Edited by Groo

Share this post


Link to post
Share on other sites
This almost seems to indicate you cannot use STAT addresses anywhere but in the FB in which they were declared. You can, of course, use addresses from instance DBs anywhere.

Share this post


Link to post
Share on other sites
ssshhhh, don't complicate things. New a programmer who called a group of FB's without inserting any addresses for the four IN parameters, called it 5 times on a trot without a single IN parameter addressed. He actually set the IN parameters in another place in the code via the DB's, saved him making flags for it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0