Modbus between PC and Laptop using USB-A to USB-B Cable

Hi.
I am trying to set up a control system on an Arduino Mega 2560. As part of this a PC (master) needs to read/write to coils and holding registers on the Arduino.
To keep wiring simple I have connected the two with a standard serial USB-A to USB-B Cable.

I have tried to get the system working using the following libraries & examples:

  1. GitHub - epsilonrt/modbus-serial: A library that allows your Arduino to communicate via Modbus protocol, acting as a slave. Over serial line implementation (OSI 2/OSI 1)
    modbus-serial/examples/Lamp/Lamp.ino at master · epsilonrt/modbus-serial · GitHub
    Lamp.ino (1.4 KB)

Arduino_Modbus_RTU_example.ino (668 Bytes)

  1. GitHub - CMB27/ModbusRTUSlave: This is an Arduino library that implements the slave/server logic of the Modbus RTU protocol.
    ModbusRTUSlaveExample.ino (4.6 KB)

On the PC I have installed Modscan. I match the baud rate, and Device ID, connect, and Poll the Arduino but do not receive any 'Valid Slave Responses' using these programs.

There are lots of discussions/examples about using RS485 (eg https://www.youtube.com/watch?v=zTanigwP5ow&ab_channel=MYSONACADEMY%26TECHNOLOGY) but I can't find any about this simple issue.

Has anyone been successful in doing this?
Do I need additional hardware, or wiring changes?

Thanks in advance for your help.

I am facing same issue do not receive any 'Valid Slave Responses please give any solution....

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.