I'm use CRC16 XModem as shown in the flow but getting wrong Result, Where it use ASCII Inputs and I need to use it as Hex Input.
For Example the below flow result is 9f8e but the expected result is 834A
flows (4).json (5.7 KB)
I'm use CRC16 XModem as shown in the flow but getting wrong Result, Where it use ASCII Inputs and I need to use it as Hex Input.
For Example the below flow result is 9f8e but the expected result is 834A
flows (4).json (5.7 KB)
Here is a demo using easy-crc node package
Example...
Demo flow...
[{"id":"e2beeb574d982801","type":"inject","z":"cba04618014a760c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"},{"p":"type","v":"hex","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"calculate","payload":"8500A9000002005202","payloadType":"str","x":1950,"y":80,"wires":[["4bf21b40a1445e15"]]},{"id":"4bf21b40a1445e15","type":"function","z":"cba04618014a760c","name":"xmodem crc16 (easy-crc)","func":"//See https://www.npmjs.com/package/easy-crc?activeTab=readme for list of supported algorithms\nconst { crc16 } = easyCrc;\nconst data = Buffer.from(msg.payload, 'hex');\nmsg.payload = crc16('XMODEM', data);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[{"var":"easyCrc","module":"easy-crc"}],"x":1890,"y":140,"wires":[["25cd665db5eaa0d9"]]},{"id":"25cd665db5eaa0d9","type":"debug","z":"cba04618014a760c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":2110,"y":140,"wires":[]}]
Wow, Thanks for your Support its working
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.