Skip to content

Commit dc2173e

Browse files
committed
Fixed Modbus write single coil function
1 parent 1607722 commit dc2173e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Platform/Platform.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2286,7 +2286,7 @@ GCodeResult Platform::SendI2cOrModbus(GCodeBuffer& gb, const StringRef &reply) T
22862286
reply.copy("Invalid Modbus data");
22872287
return GCodeResult::error;
22882288
}
2289-
registersToSend[0] = (values[0] == 0) ? 0 : 0x00FF;
2289+
registersToSend[0] = (values[0] == 0) ? 0 : 0xFF00;
22902290
break;
22912291

22922292
case (uint8_t)ModbusFunction::writeSingleRegister:

src/modbus-rtu.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ rcv: slave addr, function, byte count, (data hi, data lo)*, crc
3939
Read input registers: as read holding registers
4040

4141
Write coil:
42-
send: slave addr, function, coil addr hi, coil addr lo, write data hi, write data lo, CRC. Write data hi:lo must be 00:00 or 00:FF. Other values are illegal and do not write the coil.
42+
send: slave addr, function, coil addr hi, coil addr lo, write data hi, write data lo, CRC. Write data hi:lo must be 00:00 or FF:00. Other values are illegal and do not write the coil.
4343
receive: same, returning state of the coil after it has been written.
4444

4545
Write single register:

0 commit comments

Comments
 (0)