Arithmetic Operators in RSLogix 5000 & Studio 5000 – Structured Text Programming

Published on Aug 19, 2025 | Category: Arithmetic

Share this Page:

Arithmetic operators in RSLogix 5000 and Studio 5000 are used to perform basic math functions inside Structured Text programs. These include addition, subtraction, multiplication, division, and the modulus operator.

With these operators, you can create calculations for timers, counters, scaling values, and different process control tasks. Structured Text makes these operations easy to write and understand in your PLC logic.This page explains how arithmetic works in RSLogix 5000 and Studio 5000, with simple examples and best practices to help you write efficient and reliable programs.

What is an Arithmetic Operator in RSLogix 5000?

In RSLogix 5000 / Studio 5000, arithmetic operators are symbols used in Structured Text (ST) or ladder logic to perform mathematical operations.

These operators work just like in normal mathematics, but are applied inside the PLC logic to calculate values in real time.

Why Use Arithmetic Operators?

1. Reduce Complexity – Instead of creating many rungs with multiple math instructions (ADD, SUB, MUL, DIV blocks), you can write a single line of Structured Text using arithmetic operators.

Result := (Input1 + Input2) * Scale_Factor / 100;

This one line replaces several ladder rungs.

2. Handle Large Formulas Easily – When you have long or nested formulas (like scaling analog signals, PID calculations, or engineering unit conversions), arithmetic operators let you write them directly in one formula instead of breaking them into many instructions.

3. Improve Readability & Maintenance – Engineers can quickly understand the formula in ST, instead of tracing multiple rungs in ladder logic.

Conclusion

Arithmetic operators in RSLogix 5000 help perform math directly inside your PLC logic. They reduce program complexity, make it easier to use large formulas, and improve the readability of your control logic.

Addition Arithmetic Operator (+) in RSLogix 5000

The addition operator (+) is used to add two or more numerical values in your PLC program. It can be applied to integers, real numbers, constants, or tags. In Structured Text (ST), the syntax is:

Result := Value1 + Value2;

You can also add multiple values in a single line:

Result := Value1 + Value2 + Value3;

Example 1 – Simple Two Numbers Addition

Total := 10 + 5;    (* Result will be 15 *)
Total := Part1 + Part2;    (* If Part1 = 12 and Part2 = 8, then Total = 20 *)

Example 2 – Addition with Multiple Operands

Total := A + B + C;   (* If A = 5, B = 7, C = 3 → Total = 15 *)

Example 3 – Addition in a Formula (Scaling Analog Input)

Scaled_Value := ((Raw_Value - 4000) * 100) / 16000 + 0;

This formula scales a 4–20mA signal. The + 0 is an offset added at the end. Structured Text allows this in one line instead of multiple ladder rungs.

Example 4 – Addition with Timer or Counter

New_Count := Counter.ACC + 5;

This adds 5 to the current accumulated counter value.

Key Benefits of Using the + Operator

Subtraction Arithmetic Operator (-) in RSLogix 5000

The subtraction operator (-) is used to subtract one value from another in your PLC program. It can be applied to integers, real numbers, constants, or tags. In Structured Text (ST), the syntax is:

Result := Value1 - Value2;

You can also subtract multiple values in a single line:

Result := Value1 - Value2 - Value3;

Example 1 – Simple Two Numbers Subtraction

Total := 15 - 5;    (* Result will be 10 *)
Total := Part1 - Part2;    (* If Part1 = 20 and Part2 = 8, then Total = 12 *)

Example 2 – Subtraction with Multiple Operands

Total := A - B - C;   (* If A = 20, B = 7, C = 3 → Total = 10 *)

Example 3 – Subtraction in a Formula (Scaling or Offset)

Adjusted_Value := Raw_Value - Offset_Value;

This formula subtracts an offset from the raw signal. Using subtraction in ST allows combining it with other operators in one line.

Example 4 – Subtraction with Timer or Counter

Remaining_Time := Timer.PRE - Timer.ACC;

This calculates how much time is left by subtracting the accumulated timer value from the preset.

Key Benefits of Using the - Operator

Division Arithmetic Operator (/) in RSLogix 5000

The division operator (/) is used to divide one value by another in your PLC program. It can be applied to integers, real numbers, constants, or tags. In Structured Text (ST), the syntax is:

Result := Value1 / Value2;

Example 1 – Simple Division

Quotient := 20 / 5;    (* Result will be 4 *)
Quotient := Total_Value / Count;    (* If Total_Value = 100 and Count = 4 → Quotient = 25 *)

Example 2 – Division in Formula (Scaling)

Scaled_Value := (Raw_Value - Min_Value) / (Max_Value - Min_Value) * 100;

This scales a signal to a percentage using division in a single line.

Example 3 – Division with Timer or Counter

Time_Per_Cycle := Total_Time / Cycle_Count;

This calculates the average time per cycle by dividing the total time by the number of cycles.

Multiplication Arithmetic Operator (*) in RSLogix 5000

The multiplication operator (*) is used to multiply two or more values in your PLC program. It can be applied to integers, real numbers, constants, or tags. The syntax in ST is:

Result := Value1 * Value2;

Example 1 – Simple Multiplication

Total := 5 * 4;    (* Result will be 20 *)
Total := Part1 * Part2;    (* If Part1 = 6 and Part2 = 3 → Total = 18 *)

Example 2 – Multiplication in Formula (Scaling)

Scaled_Value := Raw_Value * Scale_Factor;

This multiplies the raw input by a scale factor to convert units or range.

Example 3 – Multiplication with Counter or Constant

Total_Production := Units_Per_Cycle * Cycle_Count;

This calculates total production by multiplying units per cycle by the number of cycles.

Modulus Arithmetic Operator (MOD) in RSLogix 5000

The MOD operator is used to find the remainder after dividing one value by another in your PLC program. It is often used in counters, cyclic operations, or when you need to check divisibility. In Structured Text (ST), the syntax is:

Result := Value1 MOD Value2;

Example 1 – Simple MOD Operation

Remainder := 10 MOD 3;    (* Result will be 1, because 10 divided by 3 leaves remainder 1 *)

Example 2 – MOD with Tags

Remainder := Total_Count MOD 5;    (* If Total_Count = 12 → Remainder = 2 *)

Example 3 – Using MOD to Create Cycles

Cycle_Position := Current_Step MOD 4;    (* Repeats 0, 1, 2, 3 for cyclic operations *)

Example 4 – MOD with Large Numbers

Remainder := Big_Value MOD Divisor;    (* Handles large numbers easily in one line *)

Key Benefits of Using MOD Operator

Large and Complex Arithmetic Example in RSLogix 5000

This example demonstrates a real-world scenario combining addition, subtraction, multiplication, division, and MOD in one formula for flow scaling and batch calculation in Structured Text.

Scaled_Flow := (((Raw_Flow - Flow_Min) * Scale_Factor / (Flow_Max - Flow_Min)) 
                + Offset_Value) * Temp_Correction MOD Batch_Size;

Explanation of Each Step

Example Values and Calculation

This single Structured Text line replaces multiple ladder rungs and makes complex arithmetic easy to read, maintain, and modify.