Function (FC) and Function Block (FB) Similarities/Differences in Siemens PLC-S7 Programming
Function (FC) and Function Block (FB) Similarities/Differences in Siemens PLC-S7 Programming
net/publication/283170347
CITATIONS READS
0 8,219
1 author:
Shervin Ehrampoosh
Kettering University
12 PUBLICATIONS 36 CITATIONS
SEE PROFILE
All content following this page was uploaded by Shervin Ehrampoosh on 26 October 2015.
Function (FC) and Function Block (FB) Similarities/Differences in Siemens PLC-S7 programming:
Differences:
1- Memory: FC has no instance memory, while FB has an Instance Data Block (IDB). This IDB
saves all IN, OUT, IN_OUT and STAT parameters. They are accessible even after execution of
the relevant FB.
2- Programming Language: You can program FC or FB with FBD, LAD, STL and SCL
programing languages, while just FB has the capability to be programed in GRAPH.
3- Calling: FB call should be along with its instance data block. Otherwise, there will be question
mark “?” at the top the FB with no possibility to save or download to the processor. There is not
such a necessity in FC.
4- Filling Actual Parameters: If there is an FC call, all Actual Parameters should be filled in
with an address, since all Formal Parameters in FC do not save in any memory and as a result
there are no initial values assigned to them. In FB, you can leave any of the Actual Parameters
with no address. If you do not fill out all FC addresses, there is no possibility to save or download
the program.
Similarities:
Tip:
In FC programming, if you do not want to use the results of the FC subroutines outside of it, it is
always a good idea to use TEMP variables, instead of Memory Bits (M) or Data Blocks (DB).
This is because of the possibility to call those M or DB addresses outside of the FC, results in an
inaccurate execution for the FC. Overall, programmers do their best not to use Global
variables in FCs.