Back to tutorials
Beginner

PLC Programming Computational Mathematical Instructions – MUL | Multiply

By
Vladimir Romanov
|
October 10, 2018
Table of Contents

Introduction

The MUL, also known as the multiply, is an instruction which will perform a mathematical multiplication of two integers or floats. This mathematical instruction will be executed upon the registers specified in “Source A” and “Source B” and have the result stored within the register specified in the “Dest” field. This is a fundamental PLC instruction which is frequently used for scaling purposes. This need arises quite frequently when dealing with analog signals.

Paired with other mathematical instructions, the MUL can be a powerful tool for an array of different applications and calculations.

Example & Usage of MUL

Here’s a real-world scenario of a MUL instruction:

  1. A Micrologix 1100 Allen Bradley PLC is used to control a process.
  2. In rung 0000, a MUL  instruction is used to multiply an integer N7:0 by a constant value and store the result in the integer N7:1.
  3. Since the value of the integer is currently 23 and the value of the constant is 12, the result is evaluated to 156.
  4. In rung 0001, a MUL  instruction is used to multiply an integer N7:2 by an integer N7:3 and store the result in the integer N7:4.
  5. Since the value of the integer is currently 123 and the value of the second integer is 21, the result is evaluated to 2583.
  6. In rung 0002, a MUL  instruction is used to multiply a float F8:0 by a float F8:1 and store the result in the float F8:2.
  7. The MUL instruction is preceded by an XIC tied to B3:0/0 which will prevent the ADD to execute until it’s set to HIGH.
  8. Since the value of the float is currently 242.45 and the value of the second float is 123.123, the result is evaluated to 365.573.

Programming example in RSLogix 500:

MULMultiplyInstructionRSLogix5000
  1. In rung 0003, a MUL instruction is used twice on the same value. The demonstration here is that you can easily convert an integer into a float through the use of the instruction.
  2. In the first branch of the rung, the MUL is used to multiply two INTs and stores the result in a FLOAT.
  3. The second branch multiplies the result of the first branch by the inverse of the value (0.001) which results in the original value in a FLOAT form.
  4. Do note that you can simply multiply by 1 and store the value in a FLOAT.

Programming example in RSLogix 500:

MULInstructionRSLogix500PLCProgramming

Outcome:

The MUL instruction is used to multiply a set of integers or floats. These values can be specified through a constant or within a register. The rungs above showcase some examples of how the MUL instruction is used to evaluate the multiplication of several registers and store the final value into the register specified within the “Dest” cell.

The last rung showcases a simple example in which two MUL instructions are chained. These instructions multiply two integers and store the result in a float. The result becomes a float value which is something common to all mathematical functions. This property is often used to convert an integer into a float.

Data Types Allowed for MUL

The MUL can be used to compare two values of identical types or mismatching types such as float and integer. These value can be INTs or FLOATs.

  • Integer – You may specify each operand to be of “Integer” type.
  • Float – You may specify each operand to be of “Float” type.

Video Tutorial

Back to tutorials

Got a question or comment?

Related Tutorials

Beginner

Opto 22 groov RIO Getting Started

The groov RIO module from Opto 22 has been released only a few months ago. The groov RIO is a feature packed piece of hardware that is easy to install, configure and deploy for many different field applications. The module comes pre-loaded with an array of software tools used across the industry and is ready to hit the floor running out of the box. Furthermore, the module is equipped with user configurable input and output nodes that have the capability unlike anything else on the market.

August 2, 2020
|
By
Vladimir Romanov
Beginner

Micro800 PLC Programming Getting Started

The Micro800 Control Systems by Rockwell Automation provide a cost effective solution for small to medium automation systems. The controllers within this family are typically used on stand alone machines or small process applications. The family offers five distinct controller types that are further customizable through add-on modules: Micro810, Micro820, Micro830, Micro850 and Micro870.Micro800 Programmable Logic Controllers Getting StartedUnlike the other Rockwell Automation controllers, this line of PLCs is programmed through a dedicated software: Connected Components Workbench. From within this tool, the programmer can flash the firmware, load the program and monitor the state of the controller. Furthermore, Connected Components Workbench (CCW) is often used to program other non-PLC Rockwell Automation devices such as Variable Frequency Drives (VFDs) and certain Safety Relays.

July 26, 2020
|
By
Vladimir Romanov
Beginner

An Introduction to DeviceNet Industrial Networks

In this tutorial you will learn about the DeviceNet industrial network, go over a basic offline configuration, and explore some advanced features.

July 24, 2020
|
By
Jacques Venter