logo elektroda
logo elektroda
X
logo elektroda

ESP8266 LUA: Example of RTU CRC16 calculation for RS485 communication

piotr411 5169 0
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 15760491
    piotr411
    Level 22  
    I searched the web for ready-made examples for calculating the RTU CRC16 for the ESP8266 and it didn't work, so I wrote my own code and and to make it easier for others to play with ESP with RS485 I give the solution. in the example.
    Code: Lua
    Log in, to see the code


    After pasting the script, all you need to do as in the example is to write

    CRC16M("here in HEX our command, and as a result we get, command + calculated CRC). That is, by typing the function:

    Code: Lua
    Log in, to see the code


    the result will be
    01050000FF00 3A8C
  • ADVERTISEMENT
ADVERTISEMENT