Click here to Skip to main content
15,887,350 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to implement Modbus RTU Master in Digi Module connect me 9210 device. For this purpose I am using libmodbus library.

What would be device name I have to give in NetOs to connect with my local Computer.?

Now I am using

C++
ctx = modbus_new_rtu("COM3", 19200, 'N', 8, 1);
modbus_set_slave(ctx, SERVER_ID);

/* TCP */
//  ctx = modbus_new_tcp("10.0.0.66", 502);

modbus_set_debug(ctx, TRUE);

if (modbus_connect(ctx) == -1) {
    fprintf(stderr, "Connection failed: %s\n",
                modbus_strerror(errno));
    modbus_free(ctx);
    return -1;
}

C#
But its keep saying connection failed. I have also tried "/dev/USB0" and "/dev/ttyS0". I have Modbus Slave in my local computer to test with the Module client.
Posted
Comments
Jochen Arndt 27-Jan-16 8:45am    
Your setup is a little unclear. You may edit your question using the green 'Improve question' link to clarify.

How is the module connected to your computer (serial or network) and on which side you have problems?

However, Modbus TCP seems to be not supported according to this: http://www.digi.com/support/forum/49470/digi-connect-me-9210-modbus-net-os-esp
So you can only use a serial connection.

With RTU, the serial port must be specified according to the used OS (COMx with Windows and /dev/ttySx with Linux).

For the configuration of the module (NetOS) you should refer to the documentation. You may also get better help when asking in the Digi forum.
Muhammad Azym 27-Jan-16 8:49am    
Thanks for the reply.

Modbus RTU means serial communication and the module does support both TCP and RTU. I have also implemented modbus TCP which is working fine both slave and master. I have connected the module with USB-Serial Controller.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900