- 积分
- 230
- 金钱
- 197
- 威望
- 0
- 贡献
- 0
- HASS币
- 0
中级会员
- 积分
- 230
- 金钱
- 197
- HASS币
- 0
|
求一个add8校验流程,已有CRC校验流程
[{"id":"a5bf631c.2f00a","type":"function","z":"8c8d612f.59ef3","name":"CRC GEN","func":"var input=msg.payload;\nvar cs=0x00;\nvar CRCResult = 0xFFFF;\n//const buf = new Buffer([0x00, 0x00]);\nfor (i=0;i<input.length-2;i+=1)\n{\n CRCResult = CRCResult ^ input[i];\n for (j=0;j<8;j++)\n {\n if ((CRCResult & 1) == 1)\n CRCResult = (CRCResult >> 1) ^ 0xA001;\n else CRCResult >>= 1;\n }\n}\ninput[input.length-2]=(CRCResult & 0xff);\ninput[input.length-1]=(CRCResult >> 8);\nmsg.payload = input;\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1190,"y":960,"wires":[["325b8ca7.d6ff54"]],"info":"Out1 = Pass\nOut2 = Drop"}] |
|