Introduction
Many people know that PLCs are capable of working with numbers and mathematical calculations but the instruction set and rules can be confusing when trying to implement them in GX IEC Developer.
Design Considerations
Most Mitsubishi PLCs include 3 different mathematical instruction sets. There is a set of instructions for 16-bit signed integers, another set for 32-bit signed integers and a third set for floating point variables. This in itself is manageable but it starts to get tricky when, for example, the result of a 16-bit multiply gives a 32-bit answer which can then not be used with any other 16-bit instructions without conversion back to 16-bit.
The best way to simplify the maths challenge is to use the IEC instruction set and not the Mitsubishi instruction set which, after all, is what you should be using if you are trying to write a pure IEC compliant application.
From the examples below you can see that when using the IEC instruction set, it does not matter if you are trying to do 16-bit, 32-bit or floating point maths, the instructions are the same.
Further Information
For further information, please refer to the GX IEC Developer help files and the structured text manuals or contact our support desk (support@adroit.co.za).
You can download this Tip in PDF format here.