# Modbus Byte Swap

**URL:** <https://forum.inductiveautomation.com/t/modbus-byte-swap/108575>\
**Category:** Ignition\
**Created:** [July 16, 2025, 7:33pm UTC](https://forum.inductiveautomation.com/t/modbus-byte-swap/108575 "2025-07-16T19:33:27Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![james.martin](https://avatars.discourse-cdn.com/v4/letter/j/3da27b/32.png) [@james.martin](https://forum.inductiveautomation.com/u/james.martin)\
**Post date:** [July 16, 2025, 7:33pm UTC](https://forum.inductiveautomation.com/t/modbus-byte-swap/108575/1 "2025-07-16T19:33:27Z")

</div>

Hi, I am attempting to add a register that will only display properly with ModbusPoll as a 32-bit Integer with Little-endian byte swap. This is an ABB Ekip breaker Current. Is there any way to do a byte swap in Ignition? Any other suggestions? Here is a screenshot: [image]

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/2/4268dc1a218839dda5665fbc715c5631ee1ddb6f.png)

---

<div class="post-metadata">

**Author:** ![robertm](https://avatars.discourse-cdn.com/v4/letter/r/ea5d25/32.png) [@robertm](https://forum.inductiveautomation.com/u/robertm)\
**Post date:** [July 16, 2025, 7:36pm UTC](https://forum.inductiveautomation.com/t/modbus-byte-swap/108575/2 "2025-07-16T19:36:08Z")

</div>

James, youll probably want to start a new topic.

Edit: Thanks Phil

---

<div class="post-metadata">

**Author:** ![robertm](https://avatars.discourse-cdn.com/v4/letter/r/ea5d25/32.png) [@robertm](https://forum.inductiveautomation.com/u/robertm)\
**Post date:** [July 16, 2025, 7:42pm UTC](https://forum.inductiveautomation.com/t/modbus-byte-swap/108575/3 "2025-07-16T19:42:32Z")

</div>

Theres probably better ways, but you could create your own UDT and do the swapping with expressions within the UDT.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [July 16, 2025, 8:05pm UTC](https://forum.inductiveautomation.com/t/modbus-byte-swap/108575/4 "2025-07-16T20:05:01Z")

</div>

Have you already tried the "swap words" setting on Ignition's Modbus device?

---

<div class="post-metadata">

**Author:** ![michael.flagler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.flagler/32/26272_2.png) [@michael.flagler](https://forum.inductiveautomation.com/u/michael.flagler)\
**Post date:** [July 17, 2025, 3:51am UTC](https://forum.inductiveautomation.com/t/modbus-byte-swap/108575/5 "2025-07-17T03:51:11Z")

</div>

Here's the byte order so you know what you need to swap:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/8/8899adcc47a13bd1a1b3fac865a4d9b6ba99ab8b.png)

---

<div class="post-metadata">

**Author:** ![james.martin](https://avatars.discourse-cdn.com/v4/letter/j/3da27b/32.png) [@james.martin](https://forum.inductiveautomation.com/u/james.martin)\
**Post date:** [July 17, 2025, 3:22pm UTC](https://forum.inductiveautomation.com/t/modbus-byte-swap/108575/6 "2025-07-17T15:22:41Z")

</div>

How is byte swapping done in the UDT? I am trying to write an expression to do this, but I do not see any examples. Can do little-endian, swapping two registers to create a derived point, then use that point to swap the two bytes within a register? (({[.]CurrentAA} & 0xFF) \<\< 8) | (({[.]CurrentAA} \>\> 8) & 0xFF) ??

---

<div class="post-metadata">

**Author:** ![james.martin](https://avatars.discourse-cdn.com/v4/letter/j/3da27b/32.png) [@james.martin](https://forum.inductiveautomation.com/u/james.martin)\
**Post date:** [July 17, 2025, 3:25pm UTC](https://forum.inductiveautomation.com/t/modbus-byte-swap/108575/7 "2025-07-17T15:25:01Z")

</div>

> [@robertm](#):
>
> ut you could create your own UDT and do th

What is the swapping expression for the UDT? I am editing the "write expression" or UDT in text.

---

<div class="post-metadata">

**Author:** ![james.martin](https://avatars.discourse-cdn.com/v4/letter/j/3da27b/32.png) [@james.martin](https://forum.inductiveautomation.com/u/james.martin)\
**Post date:** [July 17, 2025, 3:29pm UTC](https://forum.inductiveautomation.com/t/modbus-byte-swap/108575/8 "2025-07-17T15:29:26Z")

</div>

Where is the "swap words" setting?

---

<div class="post-metadata">

**Author:** ![james.martin](https://avatars.discourse-cdn.com/v4/letter/j/3da27b/32.png) [@james.martin](https://forum.inductiveautomation.com/u/james.martin)\
**Post date:** [July 17, 2025, 3:31pm UTC](https://forum.inductiveautomation.com/t/modbus-byte-swap/108575/9 "2025-07-17T15:31:42Z")

</div>

In your example, I need to write an expression to derive that "Mid-Little Endian" CDAB. How did you get that?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [July 17, 2025, 3:46pm UTC](https://forum.inductiveautomation.com/t/modbus-byte-swap/108575/10 "2025-07-17T15:46:57Z")

</div>

It's an advanced setting on the Modbus device you set up in the Ignition Gateway.
