FB and FC are two types of subroutines that make STEP 7 a very flexible and powerful tool.
As subroutines, FC and FB can be used to optimize the programming. Main uses for FC and FB: Divide and organize the user program.
Divided in small parts the units can be easily understood. This helps specially maintenances and alterations of the program.
Rationalize and optimize the programming. FC and FB can be created and used as users’ library. So, an algorithm is programming just one time, and can be used many times in one our more projects.
Reduce and rationalize resources of the CPU (e.g. memory occupation). Both FB and FC has an important feature that is the possibility to have input/output parameters. This permits that a same algorithm could be used many times, each with different set of variables.
While a FC uses the address of the given parameter to read and write directly in then, a FB copy this parameters to/from a associated DB, and work internally just with the DB variables. The uses of an associated DB for each call (so called Instance DB), open the possibility to store variables internally.
Note:The FB copy the input parameters to the instance DB at start call and, at end, copy back from the instance DB to the outputs. This could take a little bit more memory and processing time as a FC.
In other hand, internally it works just with instances DB variables; this means that the internal processing of a FB could be a little faster as FC. However, these differences will depends of many factors like ratio parameters / codes, type of parameters, etc.