Common PLC function blocks
As with anything else in programming, there are certain features that you’ll use more than others. Depending on what job you’re working on, you’re likely to use either a counter or a timer. Let’s explore a counter function block.
Counter function blocks
As the name suggests, a counter block counts. These function blocks are often used to measure the number of parts that pass through a given point, the number of times a button has been pressed, the number of times a machine has been started, or any other counting operation. The easiest way to explore this function block is to see it in action. The first thing we’re going to do is create the following variables in the code snippet:
PROGRAM PLC_PRG VAR counter : CTU; count : REAL; buttonPress : BOOL; END_VAR...