August 6, 2026

Why Do We Use MW40, MW42, MW44… Instead of MW40, MW41, MW42 in Siemens PLC Programming?

There is a small concept in Siemens PLC programming that often creates confusion for beginners:

Why do we use MW40, MW42, MW44, MW46… instead of MW40, MW41, MW42, MW43…?

At first, it may look like a simple numbering convention.

But it is actually related to how the PLC memory is organized.

Understanding this concept is important because incorrect memory addressing can create overlapping data, unexpected values, and difficult-to-troubleshoot PLC programs.

Let's understand it with a simple practical example.

 


First, Understand MB, MW and MD

Before understanding why MW addresses normally increase by 2, we need to understand three common Siemens memory formats.

MB – Memory Byte

MB represents one byte.

One byte contains:

8 bits

For example:

MB40

represents the byte located at memory address 40.

 

MW – Memory Word

MW represents a word.

A word contains:

2 bytes = 16 bits

Therefore:

MW40 = MB40 + MB41

This is the most important point to remember.

 

MD – Memory Double Word

MD represents a double word.

A double word contains:

4 bytes = 32 bits

Therefore:

MD40 = MB40 + MB41 + MB42 + MB43

This memory structure explains why address planning is important.

 

Why MW40, MW42, MW44?

Let's take a practical example.

Suppose we want to store four integer values:

Value 1 → MW40 = 30

Value 2 → MW42 = 50

Result → MW44 = 80

Final Output → MW46 = 80

Why did we select 40, 42, 44 and 46?

Because an MW occupies 2 bytes.

Therefore:

MW40 → MB40 + MB41

MW42 → MB42 + MB43

MW44 → MB44 + MB45

MW46 → MB46 + MB47

Notice something important.

Each word has its own two-byte area.

There is no overlap.

This makes the memory structure clear and predictable.

 

What Happens If We Use MW40 and MW41?

Now let's consider another example.

Suppose someone writes:

MW40

and then:

MW41

At first glance, it may look like two different words.

But let's look at the actual byte allocation.

MW40 → MB40 + MB41

While:

MW41 → MB41 + MB42

Now we have a problem.

MB41 is being used by both memory words.

This means the two MW areas overlap.

That can create unexpected behavior if both values are being written or used independently.

For beginners, this is one of the most important memory-addressing concepts to understand.

 

Visualizing the Memory

Think of PLC memory as a row of boxes.

For example:

MB40 | MB41 | MB42 | MB43 | MB44 | MB45 | MB46 | MB47

If we create:

MW40

it occupies:

MB40 + MB41

Then the next available two-byte word starts at:

MB42

So:

MW42 = MB42 + MB43

Then:

MW44 = MB44 + MB45

And:

MW46 = MB46 + MB47

This is why you commonly see even-numbered MW addresses.

The important principle is not that Siemens requires every MW address to be even.

The important principle is:

A Word occupies two consecutive bytes, so adjacent non-overlapping word storage is naturally allocated at 2-byte boundaries.

 

Practical TIA Portal Example

Let's take a simple addition program.

Suppose:

Value 1 = 30

stored in:

%MW40

and:

Value 2 = 50

stored in:

%MW42

We want the result to be stored in:

%MW44

The logic is:

%MW40 + %MW42 → %MW44

Therefore:

30 + 50 = 80

So:

%MW44 = 80

Now suppose we want to transfer the result to another memory location.

We can use a MOVE instruction:

%MW44 → %MW46

The final result becomes:

%MW46 = 80

The memory allocation looks like this:

%MW40 → Value 1 → 30

%MW42 → Value 2 → 50

%MW44 → Result → 80

%MW46 → Final Output → 80

This is a very simple example, but it teaches an important PLC programming principle:

Plan your memory addresses properly.

 

Why Does This Matter in Real Industrial Projects?

A beginner may think:

"If the PLC accepts the address, why should I worry about it?"

Because industrial PLC programs can become very large.

A machine may have:

  • Hundreds of signals
  • Hundreds of calculations
  • Multiple motors
  • Multiple drives
  • Analog values
  • Production counters
  • Setpoints
  • Alarm values
  • Recipe parameters
  • Communication data

If memory addresses are not planned properly, troubleshooting can become difficult.

Imagine a technician is troubleshooting a machine.

The engineer expects:

MW40 = Motor Speed

But because of overlapping memory usage, another program operation changes a byte that is part of MW40.

Suddenly, the motor-speed value may change unexpectedly.

The technician may initially suspect:

  • Sensor problem
  • Communication problem
  • PLC hardware problem
  • Analog input problem
  • Scaling problem

when the real problem is simply incorrect memory addressing.

 

Understanding Byte-Level Memory Helps Troubleshooting

This is why PLC programmers should not only learn Ladder Logic.

They should also understand how the PLC stores data.

For example, if you know:

MW40 = MB40 + MB41

you can investigate the memory at the byte level.

If a value is unexpected, you can check:

  • Which byte is being modified?
  • Which instruction is writing to the memory?
  • Is another word using the same byte?
  • Is a byte instruction affecting a word?
  • Is a double-word instruction overlapping the same area?

This type of thinking makes troubleshooting much more systematic.

 

What About MD Addressing?

The same principle becomes even more important with Double Words.

An MD occupies four bytes.

For example:

MD40 → MB40 + MB41 + MB42 + MB43

If you then use:

MD44

it occupies:

MB44 + MB45 + MB46 + MB47

There is no overlap.

But if you use another double word beginning at a nearby address, you need to carefully check the byte ranges.

This becomes especially important when working with:

  • DINT values
  • REAL values
  • Floating-point calculations
  • Large counters
  • Data communication
  • Process values

 

What About SCL Programming?

The same memory concepts apply even when you move from Ladder Logic to SCL.

For example:

"Result" := "Value 1" + "Value 2";

"Final Output" := "Result";

Here, the programmer may work with symbolic tag names rather than directly writing addresses such as MW40 or MW42.

This is one reason symbolic programming is useful.

Instead of remembering:

MW40 = Value 1

you can use a meaningful name such as:

"Value_1"

Similarly:

MW42 → "Value_2"

MW44 → "Result"

MW46 → "Final_Output"

This can make programs much easier to understand.

However, even when using symbolic addressing, understanding the underlying memory structure remains valuable.

A good PLC programmer should know both:

What the variable means

and

How the PLC stores the data.

 

Direct Addressing vs Symbolic Addressing

In older PLC programs, you may frequently see addresses such as:

MW40

MW42

MW44

In newer TIA Portal projects, symbolic tags are often preferred because they improve readability.

For example:

Instead of:

MW40

we can have:

Motor_Speed

Instead of:

MW42

we can have:

Speed_Setpoint

Instead of:

MW44

we can have:

Speed_Error

This makes troubleshooting and program maintenance easier.

But when you work with existing machines, legacy programs, or direct memory addressing, understanding MB/MW/MD is extremely important.

 

A Simple Rule for Beginners

When working with Word data, remember:

WORD = 2 bytes

Therefore, if you want consecutive non-overlapping word locations, think:

MW40 → MW42 → MW44 → MW46 → MW48

For Double Word data:

DWORD = 4 bytes

So consecutive non-overlapping double-word locations would follow the byte boundaries accordingly.

The exact address you choose depends on the memory layout and the application, but always check the number of bytes occupied by the data type.

 

The Bigger Lesson

This small addressing concept teaches something much bigger.

PLC programming is not only about writing logic.

You also need to understand:

How data is stored.

How memory is organized.

How different data types occupy memory.

How instructions access that memory.

How overlapping addresses can create unexpected behavior.

When these fundamentals are clear, troubleshooting becomes much easier.

 

Final Thought

For beginners, MW40, MW42, MW44 may initially look like a simple numbering pattern.

But behind this pattern is an important concept:

A Memory Word occupies 2 bytes.

Therefore:

MW40 → MB40 + MB41

MW42 → MB42 + MB43

MW44 → MB44 + MB45

MW46 → MB46 + MB47

Whereas:

MW40 → MB40 + MB41

MW41 → MB41 + MB42

creates an overlapping byte area.

The goal is not simply to memorize:

"Always use even MW addresses."

The real lesson is:

Understand the memory structure and allocate addresses according to the size of the data.

And whenever possible, use meaningful symbolic tags in your TIA Portal projects for better readability and maintainability.

Small PLC concepts may look simple.

But these small concepts build strong PLC fundamentals.

And strong fundamentals lead to:

Better programming.

Faster troubleshooting.

Cleaner machine control.

More reliable automation systems.

Small PLC concepts → Strong PLC fundamentals → Better troubleshooting skills.

 

No comments: