I am trying to read an Omron PLC from a C# program. I have connected Omron PLC with my laptop using USB cable. In the program while I am trying to make an object I am failed to understand what value should I provide in the connect method:
EasyModbus.ModbusClient modbusClient = new EasyModbus.ModbusClient("Com4", 502);
instead of Com4 it MUST need to provide some value so that it can understand that it is a USB port which needs to be connected.
Please note that this is a direct USB cable no convetor.
Could you please help me to provide help on it.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am not sure if your Omron PLC proviedes Modbus Slave funktionalities, but you are using the constructor for Modbus-TCP if you try to connect via serial Port that can only be Modbus-RTU. Your USB to serial converter should add a COM-Port. If you are using Modbus-RTU you should use EasyModbus.ModbusClient modbusClient = new EasyModbus.ModbusClient("Com4");
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am trying to read an Omron PLC from a C# program. I have connected Omron PLC with my laptop using USB cable. In the program while I am trying to make an object I am failed to understand what value should I provide in the connect method:
EasyModbus.ModbusClient modbusClient = new EasyModbus.ModbusClient("Com4", 502);
instead of Com4 it MUST need to provide some value so that it can understand that it is a USB port which needs to be connected.
Please note that this is a direct USB cable no convetor.
Could you please help me to provide help on it.
I am not sure if your Omron PLC proviedes Modbus Slave funktionalities, but you are using the constructor for Modbus-TCP if you try to connect via serial Port that can only be Modbus-RTU. Your USB to serial converter should add a COM-Port. If you are using Modbus-RTU you should use EasyModbus.ModbusClient modbusClient = new EasyModbus.ModbusClient("Com4");