Exploring why flow control is important
As stated before, a program will rarely take a straight path from top to bottom. The necessary logic that needs to run will often vary based on a given input. Think about the motor example at the beginning of the chapter. For different VDFs to operate properly, they need certain logic such as special startup commands, startup sequences, and so on. Flow control is vital for applications such as this. The motor type can be considered the input, and the specialized logic is the varying output.
A more conceptual application for flow control is the aforementioned beer-buying example. In short, that program determines if a person can buy beer or not. A user is inputting an age, and the program determines if a person can drink. This program may seem trivial, but applications such as this are very common in the PLC realm. It is very common to have to take an input value such as a motor’s voltage, current, or temperature and adjust the VDF&...