Basic calculations
As logic has it, the basics of any calculations are the four basic operations of addition, subtraction, multiplication, and division. If you’ve worked with LL in the past, you may have noticed that the programming interface utilizes function blocks that have to be strung together, which can make long equations relatively complex. This is where ST shines as equations that are comprised of many variables can be easily programmed.
Solution variable
All operations have solutions – that is, all equations have an output value that is the result of the calculation. In programming, it’s usually wise to have an extra variable to hold the resultant of an equation. For example, if you were to add two numbers together, you may have a third variable called sum
and your code may look like something akin to the following:
sum = a + b
Using a solution variable will help keep your code cleaner and easier to maintain. However, there are times when you...