# Buffer parser node "LSW / MSW"

**URL:** https://discourse.nodered.org/t/buffer-parser-node-lsw-msw/61695
**Category:** General
**Created:** [23 April 2022 20:39 UTC](https://discourse.nodered.org/t/buffer-parser-node-lsw-msw/61695 "2022-04-23T20:39:07Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![pararnold](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/pararnold/32/60523_2.png) [@pararnold](https://discourse.nodered.org/u/pararnold)
#### Post date: [23 April 2022 20:39 UTC](https://discourse.nodered.org/t/buffer-parser-node-lsw-msw/61695/1 "2022-04-23T20:39:07Z")

</div>

Hi,  
I found this closed, unsolved topic: [https://discourse.nodered.org/t/going-crazy-trying-to-read-signed-int32-from-buffer](https://discourse.nodered.org/t/going-crazy-trying-to-read-signed-int32-from-buffer)  
as I want to parse data from the same device. The problem is that it is providing int32 data as "LSW / MSW" (Least significant word first) eq. 0xabcd as 0xcdab. Is there anyway to parse this data within the buffer parser node?

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [23 April 2022 22:27 UTC](https://discourse.nodered.org/t/buffer-parser-node-lsw-msw/61695/2 "2022-04-23T22:27:03Z")

</div>

> [@pararnold](#):
>
> Is there anyway to parse this data within the buffer parser node

Yes. Use the swap32 option.

---

<div class="post-metadata">

### Author: ![mickym2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mickym2/32/36128_2.png) [@mickym2](https://discourse.nodered.org/u/mickym2)
#### Post date: [23 April 2022 23:53 UTC](https://discourse.nodered.org/t/buffer-parser-node-lsw-msw/61695/3 "2022-04-23T23:53:39Z")

</div>

You can directly choose if you want (le) or (be).

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/c/9caf3abfb1a56266d491fb7c8559e26b7241579b.png)

---

<div class="post-metadata">

### Author: ![pararnold](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/pararnold/32/60523_2.png) [@pararnold](https://discourse.nodered.org/u/pararnold)
#### Post date: [24 April 2022 05:42 UTC](https://discourse.nodered.org/t/buffer-parser-node-lsw-msw/61695/4 "2022-04-24T05:42:38Z")

</div>

Thank you for your quick answers. Big endian and little endian refers only to the bits inside a byte (LSB / MSB). The solution to my issue was the Byte swap feature. I set Byte swap to Swap 16 and now it's correctly parsed.  
Have a nice day!

---

<div class="post-metadata">

### Author: ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)
#### Post date: [24 April 2022 09:08 UTC](https://discourse.nodered.org/t/buffer-parser-node-lsw-msw/61695/5 "2022-04-24T09:08:50Z")

</div>

AFAIK Little indian/big indian has always referred to the order of bytes within a multibyte integer and has never been used as a description of internal bits in a byte.

I've never seen a byte where the bits are the "wrong" way around 🙂

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [24 April 2022 09:21 UTC](https://discourse.nodered.org/t/buffer-parser-node-lsw-msw/61695/6 "2022-04-24T09:21:58Z")

</div>

> [@pararnold](#):
>
> Big endian and little endian refers only to the bits inside a byte

> [@cymplecy](#):
>
> ittle indian/big indian has always referred to the order of bytes

You are both correct, however when talking about endian as bits inside a byte that is typically called bit-endianess & is often only at communication level (not architecture level)

Good write up here: [Endianness - Wikipedia](https://en.wikipedia.org/wiki/Endianness)

---

<div class="post-metadata">

### Author: ![pararnold](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/pararnold/32/60523_2.png) [@pararnold](https://discourse.nodered.org/u/pararnold)
#### Post date: [24 April 2022 19:05 UTC](https://discourse.nodered.org/t/buffer-parser-node-lsw-msw/61695/7 "2022-04-24T19:05:24Z")

</div>

Thanks for your comments. In the buffer parser node it looks like to be as follows:

- the variable type "int32 be" and "int32 le" parses 0xabcd or 0xdcba
- the byte swap 16 for the same value parses 0xabcd as 0xcdab

That's why the manufacturer of this device speaks from LSW / MSW as a "Word" is two Bytes.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [8 May 2022 19:05 UTC](https://discourse.nodered.org/t/buffer-parser-node-lsw-msw/61695/8 "2022-05-08T19:05:44Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
