ModBus

From ElectroDragon
Jump to navigation Jump to search

Command

  • (Device address 1byte) + (CMD code 1byte) + (register address 2bytes) + (register data 2bytes) + CRC code (2bytes)
  • CRC check by CRC-16/MODBUS
Full CMD ADDR. CMD register address register data CRC Return
FF / 10 / 03 E9 00 01 02 00 / 02 / 4A 0C FF 10 - set baudreate 03 E9 00 01 02 00 02 - 4800 CRC FF 10 03 E9 00 01 C5 A7
FF / 10 / 03 E9 00 01 02 00 / 02 / 8B CC FF 10 - set baudreate 03 E9 00 01 02 00 03 - 9600 CRC FF 10 03 E9 00 01 C5 A7
FF / 10 / 03 E9 00 01 02 00 / 03 / CA 0E FF 10 - set baudreate 03 E9 00 01 02 00 04 - 19200 CRC FF 10 03 E9 00 01 C5 A7
FF / 01 / 00 00 / 00 08 / 28 12 FF 01 - read relay status 00 00 00 08 CRC FF 01 01 01 A1 A0 - 4st byte for 8 relay status
FF / 02 / 00 00 / 00 08 / 6C 12 FF 02 - read optical coupler status 00 00 00 08 CRC FF 02 01 01 51 A0
FF / 03 / 03 E8 / 00 01 / 11 A4 FF 03 - read baudrae 03 E8 00 01 CRC
FF / 05 / 00 00 / 00 00 / D8 14 FF 05 - relay control 00 00 - relay 0 00 00 - relay OFF CRC
FF / 05 / 00 00 / FF 00 / 99 E4 FF 05 - relay control 00 00 - relay 0 00 00 - relay ON CRC
FF / 05 / 00 01 / 00 00 / 89 D4 FF 05 - relay control 00 01 - relay 1 00 00 - relay OFF CRC
FF / 05 / 00 01 / FF 00 / C8 24 FF 05 - relay control 00 01 - relay 1 FF 00 - relay ON CRC
FF / 05 / 00 02 / 00 00 / 79 D4 FF 05 - relay control 00 02 - relay 2 00 00 - relay OFF CRC
FF / 05 / 00 02 / FF 00 / 38 24 FF 05 - relay control 00 02 - relay 2 FF 00 - relay ON CRC
FF / 05 / 00 03 / 00 00 / 28 14 FF 05 - relay control 00 03 - relay 3 00 00 - relay OFF CRC
FF / 05 / 00 03 / FF 00 / 69 E4 FF 05 - relay control 00 03 - relay 3 FF 00 - relay ON CRC
FF / 0F / 00 00 / 00 08 / 01 FF / 30 1D FF 0F - turn ON all relays 00 00 00 08 01 FF CRC
FF / 0F / 00 00 / 00 08 / 01 00 / 70 5D FF 0F - turn OFF all relays 00 00 00 08 01 00 CRC


CMD Description Return Return Description
00 01 00 00 00 01 02 00 (01) 6A 00 set device address 01 00 01 00 00 00 01 02 00 (01) 6A 00 return the same
00 01 00 00 00 01 02 00 (FF) EB 80 set device address FF 00 01 00 00 00 01 02 00 (FF) EB 80 return the same
00 / 03 / 00 00 / 00 01 / 85 DB read device address 00 03 02 00 /FF C5 C4 FF is the return device address
FF 10 (00 03) 00 02 04 00 04 (00 14) C5 9F turn on then off after 2s, (relay address), (delay time 0x14 * 0.1 = 20 * 0.1)
FF 10 (00 03) 00 02 04 00 02 (00 1E) A5 99 turn of then on after 3s, (relay address), (delay time 0x1E * 0.1 = 30 * 0.1)

Reference