<< modbus_getTimeout modbus modbus_newTcp >>

modbus >> modbus > modbus_newRtu

modbus_newRtu

create a Modbus RTU connection

Calling Sequence

modbus_newRtu(device, baud, parity, data_bits, stop_bits)

Arguments

device

a string containing the name of the serial port handled by the OS.

baud

the baud rate of the communication, eg. 9600, 19200, 57600, etc.

parity

a string for the parity. Should be 'N' for none, 'E' for even, 'O' for odd.

data_bits

The data_bits argument specifies the number of bits of data, the allowed values are 5, 6, 7 and 8.

stop_bits

The stop_bits argument specifies the bits of stop, the allowed values are 1 and 2.

Description

This function will allocate and initialize a Modbus structure to communicate in RTU mode on a serial line.

Examples

// Linux example
mbc = modbus_newRtu("/dev/ttyS0", 115200, 'N', 8, 1);
modbus_close(mbc)
// Windows example
mbc = modbus_newRtu("COM1", 115200, 'N', 8, 1);
modbus_close(mbc)

See Also


Report an issue
<< modbus_getTimeout modbus modbus_newTcp >>