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; }
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.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)