One of the problems with software development is that the increase in efficiency is very low. No Moore’s Law here, no doubling of the efficiency every 18 months. And it is even worse: With increasing functionality, the complexity increases exponentially. To solve this one needs modern software development tools and modern development methodologies.
Part of a modern software-development methodology is creating reusable components, called function blocks, which contain part of the application software functionality. This process is called encapsulation. The next step is to integrate these tested and documented components in your own library, from which everybody in and outside your organization can make use and in this way create extended application software faster and with fewer errors.
Edge-triggered vs. level-controlled
Basically, there are two types of function blocks:
- those that are initialized (started) at a rising input and stay active until finalized or aborted
- those that are active as long as the corresponding input is high.
The first are called edge-triggered, and the second are called level-controlled. An example of edge-triggered functionality is a move-to-position command which, after being initialized via the input, “Execute,” runs until finalized. An example of a level-triggered functionality is a PowerOn function, where the power is switched on as long as the relevant input (Enable) is set. Notice that the Enable input pairs with Valid output, and that Execute pairs with Done.
Sometimes it is important to choose a level-controlled model rather than an edge-triggered model. For the detection of a rising edge in a function block, two PLC cycles are necessary. Thus, if the requirement is to be able to process a new value in each cycle, an edge-triggered model cannot serve as a solution. In this case, a level-controlled function block model is the preferred way to implement the required functionality.
The basic function block is the Etrig. This is the edge-triggered functionality in its simplest form with only an Execute as input, both in textual and in graphical representation (Figure 1).