# The CRC16 code in the flow example is strange

**URL:** <https://discourse.nodered.org/t/the-crc16-code-in-the-flow-example-is-strange/48164>\
**Category:** General\
**Created:** [8 July 2021 05:10 UTC](https://discourse.nodered.org/t/the-crc16-code-in-the-flow-example-is-strange/48164 "2021-07-08T05:10:18Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Athurian](https://avatars.discourse-cdn.com/v4/letter/a/dbc845/32.png) [@Athurian](https://discourse.nodered.org/u/Athurian)\
**Post date:** [8 July 2021 05:10 UTC](https://discourse.nodered.org/t/the-crc16-code-in-the-flow-example-is-strange/48164/1 "2021-07-08T05:10:18Z")

</div>

I used the example code below.  
[https://flows.nodered.org/flow/28e9e10c72a9d00f438ec1150734c7a9](https://flows.nodered.org/flow/28e9e10c72a9d00f438ec1150734c7a9)

The problem arises only with certain strings.

The string looks like this:  
0103500001000000000002000000000000000000000000000000000000001200000014000000160017000000000000000000000000000000000000000000000000000000000000000000000000000000000000

If you input this to the CRC16 modbus rtu node, it comes out as follows.

0103500001000000000002000000000000000000000000000000000000001200000014000000160017000000000000000000000000000000000000000000000000000000000000000000000000000000000000D9B

To come out normally, the last part should come out "BD09".

However, if you put the NodeRed example code, it comes out in the form of "D9B".

Even if I try to insert other strings, they all come out normally, but only the code I put in, the CRC modbus code comes out abnormally. Any solution?  
 ![1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/1/c1d693465127471e92f7c370770f5c037104b0a9.jpeg)

---

<div class="post-metadata">

**Author:** ![Gunner](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gunner/32/43582_2.png) [@Gunner](https://discourse.nodered.org/u/Gunner)\
**Post date:** [8 July 2021 06:37 UTC](https://discourse.nodered.org/t/the-crc16-code-in-the-flow-example-is-strange/48164/2 "2021-07-08T06:37:24Z")

</div>

> [@Athurian](#):
>
> I used the example code below.

Almost sounds like something you want to ask first on the author's github page.

---

<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:** [8 July 2021 06:45 UTC](https://discourse.nodered.org/t/the-crc16-code-in-the-flow-example-is-strange/48164/3 "2021-07-08T06:45:34Z")

</div>

> [@Athurian](#):
>
> To come out normally, the last part should come out "BD09"

Not according to [this website](https://crccalc.com/?crc=0103500001000000000002000000000000000000000000000000000000001200000014000000160017000000000000000000000000000000000000000000000000000000000000000000000000000000000000&method=crc16&datatype=hex&outtype=hex)

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/b/fb81eaba2dfae1179a0df6cf94bb4babf102dd3d.png)

---

<div class="post-metadata">

**Author:** ![Athurian](https://avatars.discourse-cdn.com/v4/letter/a/dbc845/32.png) [@Athurian](https://discourse.nodered.org/u/Athurian)\
**Post date:** [8 July 2021 08:29 UTC](https://discourse.nodered.org/t/the-crc16-code-in-the-flow-example-is-strange/48164/4 "2021-07-08T08:29:26Z")

</div>

Perhaps there is a problem with nodered. As you can see it should come out as 170 bytes, not 169 bytes. Only that string comes out like that. When you do the rest it works fine.

---

<div class="post-metadata">

**Author:** ![Gunner](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gunner/32/43582_2.png) [@Gunner](https://discourse.nodered.org/u/Gunner)\
**Post date:** [8 July 2021 09:17 UTC](https://discourse.nodered.org/t/the-crc16-code-in-the-flow-example-is-strange/48164/5 "2021-07-08T09:17:20Z")

</div>

> [@Athurian](#):
>
> Perhaps there is a problem with nodered

Why?? I suspect that neither Node-Red (nor the makers of) made the node contrib you are testing with... that would be [nixator](https://flows.nodered.org/user/nixator). And it is just over about a month old, so perhaps still in development? Perhaps you should post a bug report there.

---

<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:** [6 September 2021 09:17 UTC](https://discourse.nodered.org/t/the-crc16-code-in-the-flow-example-is-strange/48164/6 "2021-09-06T09:17:43Z")

</div>

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