This is the current "stable" version.
modbus_set_debug (&host->connection, 1);
modbus_set_debug (&host->connection, 1);
/* We'll do the error handling ourselves. */
modbus_set_error_handling (&host->connection, NOP_ON_ERROR);
/* We'll do the error handling ourselves. */
modbus_set_error_handling (&host->connection, NOP_ON_ERROR);
if ((host->port < 1) || (host->port > 65535))
host->port = MODBUS_TCP_DEFAULT_PORT;
if ((host->port < 1) || (host->port > 65535))
host->port = MODBUS_TCP_DEFAULT_PORT;
host->node, host->port);
modbus_init_tcp (&host->connection,
host->node, host->port);
modbus_init_tcp (&host->connection,
- /* host = */ host->node);
-#if 0
+ /* host = */ host->node,
/* port = */ host->port);
/* port = */ host->port);
status = modbus_connect (&host->connection);
if (status != 0)
status = modbus_connect (&host->connection);
if (status != 0)
static int mb_read_data (mb_host_t *host, mb_slave_t *slave, /* {{{ */
mb_data_t *data)
{
static int mb_read_data (mb_host_t *host, mb_slave_t *slave, /* {{{ */
mb_data_t *data)
{
int values_num;
const data_set_t *ds;
int status;
int values_num;
const data_set_t *ds;
int status;