Sign in to follow this  
Followers 0
Tom749

The difference of Function and Function Block

3 posts in this topic

Hi, there. What is the main difference between Function and Function Block? (Just because of the Data Block....) Please explain or give an information in detail. Thanks for your help in advance.

Share this post


Link to post
Share on other sites
You just answered it for yourself... the data block. This sounds an awful lot like a test question?

Share this post


Link to post
Share on other sites
A Function Block is like a function but with memory and the Data Block is the memory. There is a bit more to it, some complex parameters can be passed to a Function Block but not a Function. For a Function, if you create a parameter as type IN, you cannot turn it on and use it in that state outside the block because the IN parameter is not passed back out, similar for the OUT, you cannot use the OUT bit as memory i.e. it cannot be used to retain itself. For these above you need an IN/OUT. The FB saves the state of even IN/OUT parameters in the DB. For an FB you do not need to assign any tags to the I/O parameters, you have to with a Functions. Functions are normally used where it does something and the result is in the one call, it could for instance be used as a calculation. Functions don't need parameters if you don't want, I'd usually use Functions as a central distribution for other block calls. Having no parameters for a FB makes no sense, I have actually seen someone do this and they ended up with an empty DB. Also if you unconditionally call a FB without a DB, it automatically uses whatever DB is already used as the instance DB.

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