modbus v0.1.0 Modbus.TCP
Server module to handle a socket connection.
Summary
Functions
Sends an TCP command.
Returns {:ok, response}.
Example:
#write 1 to coil at slave 2 address 3200
:ok = TCP.cmd(pid, {:wdo, 2, 3200, 1}, 400)
#write 0 to coil at slave 2 address 3200
:ok = TCP.cmd(pid, {:wdo, 2, 3200, 0}, 400)
#read 1 from coil at slave 2 address 3200
{:ok, [1]} = TCP.cmd(pid, {:rdo, 2, 3200, 1}, 400)
Starts the GenServer.
state is a keyword list to be merged with the following defaults:
%{
ip: {0,0,0,0},
port: 0,
timeout: 400,
}
ip is the internet address to connect to.
port is the tcp port number to connect to.
Returns {:ok, pid}.
Example
Modbus.TCP.start_link([ip: {10,77,0,211}, port: 8899], [name: Modbus.TCP])