Category Archives: PLC programming

PLC programming mathematical operations

PLC programming and mathematical operations

Let’s talk about mathematical operations in the allen bradley plc. There are four main operations which you can use when doing calculations in your plc program. Here is a basic overview of these operations. We get the same operations as we would in conventional programming languages as you may have guessed. We have addition, subtraction, multiplication and division operations which we can use in our plc programs.

What are the operations in plc programming?

MUL is one of the operations that can be used. It is important to note that constants are only allowed in one source value at a time. As it generally is quite pointless just multiplying two constant numeric values together over and over again. So be sure to make use of only one constant on your rung. MUL is the multiply operator and allows you to multiply two values together and store them in the Dest register.

DIV is the division operator and can be used for any division which you need to do. Depending on the dest type you could potentially have a rounded off value if it’s an integer or a value with decimal places if not.

ADD as you may have guessed is for addition in your plc programs. It too uses two source values and saves to a dest value.

SUB is subtraction and can be used to do subtraction calculations. Same as with add it uses two source values and yet again saves it to dest value.

We have put together a small example of what this might look like in your ladder diagram below. It should be quite simple to see how all this fits together if you look at the below diagram.

Example ladder diagram

plc programming mathematical operations

plc programming mathematical operations

Some other plc programming resources which you can look at

plc programming website – plc programming
plc programming in pretoria – plc programming in pretoria