Difference between FB and FC's Siemens PLC

Siemens PLC Difference between FB and FC's



 characteristic FC FB
 Can be called as a subroutine Yes Yes
 Can assign parameters to Input/Output/InOut Yes Yes
 Temporary variables can be used Yes Yes
 Can use static variables (can be kept) No Yes
 Requires instance data block (per call) No Yes
 Parameters passed as addresses to internal use Yes No
 Parameters are passed to the internal use via the instance data block No Yes
 Can call FB or FC Yes Yes
 Can be called by FB or FC Yes Yes
 Can use FB as multiple background calls No Yes
 Can not write all parameters when called No Yes

Articles 7 and 8 in the above table are very important.
FB has memory (except Temp variable), FC has no memory (cannot remember the result of the last scan cycle),


To emphasize that the FC parameter is passed to the block to pass the address, remembering the address instead of a data.


FB parameter input and output block is the data, remember that the data is not the address, FB has a private storage space, the parameter access block is transferred through the DB data block, copy into / copy out


See the following example to understand:
FC block content.



FB block content, exactly the same as FC



Call FC block




Call FB block



Top