Simplifying logic tips
There are hundreds of different ways of completing the same task when it comes to logic writing. There is no clear approach that is the perfect way to achieve the desired logic output; all that should matter is that it is easy to read, easy to modify, and well documented. In addition to this, programmers should write logic code with their own style that is comfortable to them but be considerate of the fact that it is likely that other programmers will also work on the project.
Good logic will be simple and easy to follow without much deciphering required by those that find themselves working on it.
Delay timers
When using timers, such as the Timer On Delay (TON) timer, it is important to understand why that timer is being used. Consider a scenario where an output is required to be delayed both before and after a signal is set to True
. This may look something like Figure 15.1: