Exploring function blocks
A function block is, for all intents and purposes, a class in any other programming language. Chances are, if you’re reading this book, you’ve programmed a PLC at some point, and you’ve probably used a function block at some point as well. Considering the name function block, it is forgivable to confuse a function block with a standard function; however, a function block is radically different from a function. Many inexperienced PLC programmers will often confuse a function with a function block. However, it is important to understand that a function is simply a callable block of code that will carry out a specific task. In contrast, a function block is a blueprint for something.
A simple way to think of a function block is as a container. Function blocks hold programming code such as unique functions, called methods, and variables.
Note
A method is a function that lives in a function block. Methods will be explored...