Command line tool to access Modbus devices
- MPL 2.0
- Manual section:
modbus [-h] [-r REGISTERS] [-s SLAVE_ID] [-b BAUD] [-p STOP_BITS] [-v] device access [access …]
modbus allows reading and writing registers of Modbus devices from the command line.
It can talk to both TCP and RTU (i.e. serial) devices and can encode and decode types larger than 16 bits (e.g. floats) into Modbus 16 bits registers.
Register definitions (consisting of a register address and its type) can be provided directly on the command line or loaded from a file and referred by symbolic name, for convenience.
modbus is implemented in python on top of the protocol implementation provided by the umodbus python library.
/dev/ttyXXX for serial devices, or hostname[:port] for TCP devices
One or more read or write operations. See ACCESS SYNTAX below.
- -r FILE, --registers=FILE
Read registers definitions from FILE.
- -v, --verbose
Print on screen the bytes as transfered on the wire.
- -b BAUD, --baud=BAUD
Set the baud rate for serial connections.
- -p BITS, --stop-bits=BITS
Set the number of stop bits for serial connections.
- -h, --help
Show this help message and exit.
- MODBUS_TYPE = h|i|c|d
The modbus type, one of
- ADDRESS = <number>
0-based register address
- BINARY_TYPE = <pack format>
Any format description accepted by the python standard pack module. Some common formats are:
16 bits signed integer
16 bits unsigned integer
32 bits signed integer
32 bits unsigned integer
32 bits IEEE 754 float
The default byte order is big-endian, use a < prefix in the format to specify little-endian.
- VALUE = <number>
The value to be written to the register. If not present, the register will be read instead.
read the 32-bits unsigned integer stored in holding registers at addresses 39 and 40
same as above (h is the default modbus type)
write the integer 42 to that register
the value can be specified in hexadecimal
read coil at address 5
write a floating point value to holding registers at addresses 24 and 25
REGISTERS FILE SYNTAX
A # starts a comment.
Each line contains a symbolic name followed by the register definition, separated by spaces.
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.