FancyModbus Library & Tools
Overview
fancmodbus is a wrapper library for the libmodbus library, which can be found under http://libmodbus.org/
The modbus protocol is an industry standard protocol for controlling switchboards over serial lines or TCP. The standard is maintained at http://www.modbus.org/
Location of Packages
SVN: svn+ssh://fancylibs@svn.clazzes.org/fancylibs/trunk/fancymodbus
repositories:
- http://deb.clazzes.org/debian/sources.list.d/wheezy/wheezy-fancylibs-3.list
- http://deb.clazzes.org/debian/sources.list.d/jessie/jessie-fancylibs-3.list
Installation
Tools
These packages are standalone programs to deal with the modbus protocol:
apt-get install fancymodbus-tool fancymodbus-simulator
Library only
If you only need the library, install the following packages:
apt-get install libfancymodbus1 libfancymodbus
Debug symbols
All packages have a counterpart containing debug symbols for gdb:
fancymodbus-tool-dbg fancymodbus-simulator-dbg libfancymodbus-dbg
Using the command line tool
Read Output Bits
The fancymodbus-tool client lets you read and write DO output bits/coils using the following commands:
fancymodbus-client writeDO 127.0.0.1:1502 1 0x105 1 0 1 0 1 fancymodbus-client readDO 127.0.0.1:1502 1 0x105 5
These example reads and writes 5 output bits starting with address 0x105.
If you do not want to conenct to the locally listening fancymodbus-simulator, you need to specify the IP of a real device like 192.168.127.254
.:502
Configuring fancymodbus-simulator
Edit /etc/fancymodbus/simulator.conf
and change the listen port or the number of registers.
For the most part you should not need to edit the default configuration, which listens to 127.0.0.1:1502 and provides for 512 registers of each kind.
Activate the daemon in /etc/default/fancymodbus-simulator
# set to yes if you want automatic starting FANCYMODBUS_SIMULATOR_START="yes"
Start the daemon
/etc/init.d/fancymodbus-simulator start
The daemon logs it's diagnostics to /var/log/syslog