Template: Mobus POE ETH Relay Protocol
Modbus RTU Development Protocol
Function Code Introduction
Function Code | Note |
---|---|
01 | Read relay status |
03 | Read the address and version |
05 | Write a single relay |
06 | Set baud rate and address |
0F | Write all relays |
Single Relay Control
Sending Code: 01 05 00 00 FF 00 8C 3A
Fields | Meaning | Remarks |
---|---|---|
01 | Device Address | Fixed 0x01 |
05 | 05 Command | Control the relay command |
00 00 | Address | Control the register address of the relay, 0x00 - 0x0008 |
FF 00 | Command | 0xFF00: relay on; 0x0000: relay off; 0x5500: relay flip |
8C 3A | CRC16 | CRC16 checksum of the first 6 bytes of data |
Return code: 01 05 00 00 FF 00 8C 3A
Field | Meaning | Remarks |
---|---|---|
01 | Device Address | Fixed 0x01 |
05 | 05 Command | Control the relay commands |
00 00 | Address | Control the register address of the relay: 0x0000-0x0008 |
FF 00 | Command | 0xFF00: relay on; 0x0000: relay off; 0x5500: relay flip |
8C 3A | CRC16 | CRC16 checksum of the first 6 bytes of data |
For example:
CH1 relay on: 01 05 00 00 FF 00 8C 3A
CH1 relay off: 01 05 00 00 00 00 CD CA
CH2 relay on: 01 05 00 01 FF 00 DD FA
CH2 relay off: 01 05 00 01 00 00 9C 0A
CH3 relay on: 01 05 00 02 FF 00 2D FA
CH3 relay off: 01 05 00 02 00 00 6C 0A
CH4 relay on: 01 05 00 03 FF 00 7C 3A
CH4 relay off: 01 05 00 03 00 00 3D CA
CH1 relay flip: 01 05 00 00 55 00 F2 9A
CH2 relay flip: 01 05 00 01 55 00 A3 5A
CH3 relay flip: 01 05 00 02 55 00 53 5A
CH4 relay flip: 01 05 00 03 55 00 02 9A
Control All Relays
Sending code: 01 05 00 FF FF 00 BC 0A
Fields | Meaning | Note |
---|---|---|
01 | Device Address | Fixed 0x01 |
05 | 05 Command | Control relay commands |
00 FF | Address | Fixed 0x00FF |
FF 00 | Command | 0xFF00: Relay on 0x0000: Relay off 0x5500: Relay flip |
BC 0A | CRC16 | CRC16 checksum of the first 6 bytes of data |
Return code: 01 05 00 FF FF 00 BC 0A
Fields | Meaning | Code |
---|---|---|
01 | Device Address | Fixed 0x01 |
05 | 05 Command | Control the relay commands |
00 FF | Address | Fixed 0x00FF |
FF 00 | Commands | 0xFF00: relay on 0x0000: relay off 0x5500: relay flip |
BC 0A | CRC16 | CRC16 checksum of the first 6 bytes of data |
For example:
[No. 1 address device]:
All relays on: 01 05 00 FF FF 00 BC 0A
All relays off: 01 05 00 FF 00 00 FD FA
All relays flip: 01 05 00 FF 55 00 C2 AA
Read the Relay Status
Sending code: 01 01 00 00 00 08 3D CC
Fields | Meaning | Note |
---|---|---|
01 | Device address | Fixed 0x01 |
01 | 01 command | Query Relay Status Command |
00 00 | Relay start address | Fixed 0x0000 |
00 10 | Relay numbers | Fixed 0x0008 |
3D C6 | CRC16 | CRC16 checksum of the first 6 bytes of data |
Return code: 01 01 01 00 51 88
Field | Meaning | Note |
---|---|---|
01 | Device address | Fixed 0x01 |
01 | 01 command | Query Relay Status Command |
02 | Number of bytes | Returns all bytes of the status information |
00 | Status of the query | Returned relay status Bit0: the first relay status; Bit1: the second relay status; Bit2: the third relay status; …… Bit7: the 8th relay status. |
8C 35 | CRC16 | CRC16 checksum of the first 6 bytes of data |
For example:
Send: 01 01 00 00 00 08 3D CC
Return: 01 01 01 00 51 88 //All relays off
Send: 01 01 00 00 00 08 3D CC
Return: 01 01 01 01 90 48 //CH1 Relay is on, the rest of the relays are off.
Send: 01 01 00 00 00 08 3D CC
Return: 01 01 01 41 91 B8 //CH1 Relays and CH7 are on, the rest are off
Write Relay Status
Sending code: 01 0F 00 00 00 08 01 FF BE D5
Field | Meaning | Note |
---|---|---|
01 | Device Address | Fixed 0x01 |
0F | 0F Command | Write relay status command |
00 00 | Relay Start Address | Fixed 0x0000 |
00 08 | Relay Numbers | Fixed 0x0008 |
01 | Byte Count | Fixed 0x01 |
FF | Relay status | Bit0: control the first relay; Bit1: control the second relay; Bit2: control the third relay; …… Bit7: control the 8th relay |
BE D5 | CRC16 | CRC16 checksum of the first 6 bytes of data |
Return code: 01 0F 00 00 00 01 94 0B
Field | Meaning | Note |
---|---|---|
01 | Device Address | Fixed 0x01 |
0F | 0F Command | All register control commands |
00 00 | Address | Fixed 0x0000 |
00 08 | Relay Numbers | Fixed 0x0008 |
54 0D | CRC16 | CRC16 checksum of the first 6 bytes of data |
For example:
[No.1 address device]
All relays on: 01 0F 00 00 00 08 01 FF BE D5
All relays off: 01 0F 00 00 00 08 01 00 FE 95
CH1-2 ON; 4-8 OFF: 01 0F 00 00 00 08 01 03 BE 94
Relay Flash On and Flash Off Command
Sending code: 01 05 02 00 00 07 8D B0
Field | Meaning | Note |
---|---|---|
01 | Device Address | Fixed 0x01 |
05 | 05 Command | Single control demmand |
02 | Command | 02 is the command for flashing on, 04 is the command for flashing off |
00 | Relay Address | The address of the relay to be controlled: 0x00~0x08 |
00 07 | Interval Time | Delay time for data *100ms Value: 0x0007, Delay: 7*100MS = 700MS |
8D B0 | CRC16 | CRC16 checksum of the first 6 bytes of data |
Return code: 01 05 02 00 00 07 8D B0
Field | Meaning | Note |
---|---|---|
01 | Device Address | Fixed 0x01 |
05 | 05 Command | Single control command |
02 | Command | 02 is the command for flashing on, 04 is the command for flashing off |
00 | Relay Address | The address of the relay to be controlled: 0x00~0x08 |
00 07 | Interval Time | Delay time for data*100ms Value: 0x0007, delay: 7*100MS = 700MS |
8D B0 | CRC16 | CRC16 checksum of the first 6 bytes of data |
Note:
The maximum setting for the flash on/flash off time is 0x7FFF.
For example:
[No.1 address device]
CH1 Relay flashes on: 01 05 02 00 00 07 8D B0 //700MS = 7*100MS = 700MS
CH2 Relay flashes on: 01 05 02 01 00 08 9C 74 //800MS
CH1 Relay flashes off: 01 05 04 00 00 05 0C F9 //500MS
CH2 Relay flashes off: 01 05 04 01 00 06 1D 38 //600MS
Read the Device Address Command
Sending code: 00 03 40 00 00 01 90 1B
Field | Meaning | Note |
---|---|---|
00 | Device Address | Fixed 0x01 |
03 | 03 Command | Read the device address command |
40 00 | Command Register | 0x4000 is to read the device address, 0x8000 is to read the software version |
00 01 | Bytes Number | Fixed 0x0001 |
90 1B | CRC16 | CRC16 checksum of the first 6 bytes of data |
Return code: 01 03 02 00 01 79 84
Field | Meaning | Note |
---|---|---|
00 | Device Address | Fixed 0x01 |
03 | 03 Command | Read software version, read device address command |
02 | Byte Number | Return the number of bytes |
00 01 | Device Address | Set device address, fixed 0x01 |
79 84 | CRC16 | CRC16 checksum of the first 6 bytes of data |
For example:
Sending: 00 03 40 00 00 01 90 1B
Return: 01 03 02 00 01 79 84 //address 0x01
Read Software Version Command
Sending code: 00 03 80 00 00 01 AC 1B
Field | Meaning | Note |
---|---|---|
01 | Device Address | 0x00 indicates the broadcast address; 0x01-0xFF indicates the device address |
03 | 03 Command | Read software version, read device address command |
80 00 | Command Register | 0x4000 is to read the device address, 0x8000 is to read the software version |
00 01 | Byte Number | Fixed 0x0001 |
8F CA | CRC16 | CRC16 checksum of the first 6 bytes of data |
Return code: 01 03 02 00 64 B9 AF
Field | Meaning | Note |
---|---|---|
01 | Device Address | 0x00 indicates the broadcast address; 0x01-0xFF indicates the device address |
03 | 03 Command | Read the software version and the device address commands |
02 | Byte Number | Return code |
00 64 | Software Version | Convert to decimal and move the decimal point two places to the left to indicate the software version 0x0064 = 100 = V1.00 |
B9 AF | CRC16 | CRC16 checksum of the first 6 bytes of data |
For example:
Sending: 00 03 80 00 00 01 AC 1B
Return: 01 03 02 00 64 B9 AF //0x0064 = 100 =V1.00