In image [
MSG Setup.jpg] for the the
15 0x0F Write Multiple Coils example, the Slave Node Address in the MSG Setup Screen is 0, and it should be 1. That said, 0 can used as a broadcast, so PyModSlave may receive it anyway, and since it is broadcast, the Modbus Master MSG instruction in the MicroLogix 1400 will not be expecting a response, which is why the "Message Done (DN)" bit has a value of 1, indicating success, i.e. the ML1400 put the ADU and PDU data on the wire like it was supposed to.
The Bus Monitor/Raw Data in image [
bus monitor.jpg] shows PyModSlave receiving the correct number of bytes, 10, for the Write Multiple Coils command, every 5s:
- 1 byte for the Modbus Slave adddress (i.e. should be a value of 1 - "Slave Node Address (dec)" in the MSG Setup screen)
- 1 byte for the Function Code (should be 0x15 for Write Multiple Coils - "Modbus Command" in the MSG Setup Screen)
- 2 bytes for the starting PDU address (should be 0x0000 to correspond to the Modbus Data Model address of 1 - "MB Data Address (1-65536)" in the MSG Setup Screen)
- 2 bytes for the number of coils (should be 0x0008 - "Size In Elements" in the MSG Setup screen)
- 1 byte for the protocol data Byte Count (should be 0x01 - 8 bits fit into one byte)
- 1 byte for the protocol data (8 bits => 1 byte)
- 2 bytes for the CRC.
The correct number of bytes being received says to me the baudrate and the 8N1 are correct on both ends. The odd values (lots of 0xFF, all bits have a value of 1, when most of the values should be closer to 0x00, all bits have a value of 0) suggest the sense of the bits on the wire are flipped (the UART on the PyModSlave side is making its best guess with the signals it is seeing), which I why I suggested swapping the A and B wires, assuming this is RS-485, which is likely if the 1763-NC01 is being used.
A terminating jumper between pins 5 and 6 of the 1763-NC01 terminal connector, if not present now, might also improve the situation, but I suspect that is more of an issue for a DH-485 network, and not RS-485 at 9600baud on a short cable.