Modbus master daemon based on libmodbus. Maintainer: Taka Wang
3.7K
Modbus master daemon
I do continuous integration and build docker images after git push by self-hosted drone.io server for armhf platform , circleci server for x86 platform and dockerhub service.
FC Description #Len API 0x01 read coils 2000 int modbus_read_bits(modbus_t *ctx, int addr, int nb, uint8_t *dest) 0x02 read discrete inputs 2000 int modbus_read_input_bits(modbus_t *ctx, int addr, int nb, uint8_t *dest) 0x03 read holding registers 125 int modbus_read_registers(modbus_t *ctx, int addr, int nb, uint16_t *dest) 0x04 read input registers 125 int modbus_read_input_registers(modbus_t *ctx, int addr, int nb, uint16_t *dest) 0x05 write single coil - int modbus_write_bit(modbus_t *ctx, int addr, int status) 0x06 write single register - int modbus_write_register(modbus_t *ctx, int addr, int value) 0x0F write multi coils 1968 int modbus_write_bits(modbus_t *ctx, int addr, int nb, const uint8_t *src) 0x10 write multi registers 125 int modbus_write_registers(modbus_t *ctx, int addr, int nb, const uint16_t *src)
Coil/Register numbers data address type table name offset function code 1-9999 0000 to 270E (9998) Read-Write Discrete Output Coils 1 1, 5, 15 10001-19999 0000 to 270E (9998) Read-Only Discrete Input Contacts 10001 2 30001-39999 0000 to 270E (9998) Read-Only Analog Input Registers 30001 4 40001-49999 0000 to 270E (9998) Read-Write Analog Output Holding Registers 40001 3, 6, 16
Command Number Description fc1 1 modbus fc 1 fc2 2 modbus fc 2 fc3 3 modbus fc 3 fc4 4 modbus fc 4 fc5 5 modbus fc 5 fc6 6 modbus fc 6 fc15 15 modbus fc 15 fc16 16 modbus fc 16 set_tcp_timeout 50 set tcp timeout get_tcp_timeout 51 get tcp timeout
{
"syslog": 1,
"zmq":
{
"sub": "ipc:///tmp/to.modbus",
"pub": "ipc:///tmp/from.modbus"
},
"mbtcp":
{
"connect_timeout": 200000
}
}
Please refer to command definition.

sudo apt-get update
sudo apt-get install -y git build-essential autoconf libtool pkg-config cmake
git clone https://github.com/stephane/libmodbus/
cd libmodbus
./autogen.sh
./configure
make
sudo make install
sudo ldconfig
wget https://github.com/zeromq/zeromq3-x/releases/download/v3.2.5/zeromq-3.2.5.tar.gz
tar xvzf zeromq-3.2.5.tar.gz
cd zeromq-3.2.5
./configure
make
sudo make install
sudo ldconfig
git clone git://github.com/zeromq/czmq.git
cd czmq
./autogen.sh
./configure
make
sudo make install
sudo ldconfig
git clone modbusd
cd modbusd
mkdir build
cd build
cmake ..
make
./modbusd ../modbusd.json # load external configuration file
4X Table: 60000 Read/Write uint16 value test: FC6, FC34X Table: 30000 Read/Write int16 value test: FC6, FC34X Table Multiple read/write test: FC16, FC34X Table Multiple read/write test: FC16, FC30X Table Single read/write test:FC5, FC10X Table Multiple read/write test: FC15, FC11X Table read test: FC23X Table read test:FC4Set timeout testGet timeout test
docker pull edgepro/c-modbus-slave:x86
docker build -t takawang/modbusd .
docker build -t takawang/dummy-psmbtcp test/dummy-psmbtcp/.
docker run -itd --name=slave edgepro/c-modbus-slave:x86
docker run -v /tmp:/tmp --link slave -it --name=modbusd takawang/modbusd
docker run -v /tmp:/tmp -it --link slave takawang/dummy-psmbtcp
docker-compose up --abort-on-container-exit
MIT
Content type
Image
Digest
Size
6.4 MB
Last updated
over 9 years ago
docker pull edgepro/modbusd