| MBPOLL(1) | User Commands | MBPOLL(1) |
NAME¶
mbpoll - ModBus(R) Master Simulator
SYNOPSIS¶
mbpoll [ options ] device|host [ writevalues... ] [ options ]
DESCRIPTION¶
mbpoll is a command line utility to communicate with ModBus slave devices (RTU or TCP). It allows to read and write in ModBus slave registers connected by serial (RTU only) or TCP.
mbpoll can:
- read discrete inputs
- read and write binary outputs (coil)
- read input registers
- read and write output registers (holding register)
The reading and writing of registers may be in decimal, hexadecimal or floating single precision.
mbpoll's output syntax and command line option syntax is similar to the original modpoll command line program published by proconX. However mbpoll is a completely independent project and based on different source code than the original modpoll program. mbpoll is distributed under the GPL license, but the original modpoll program is not covered by the GPL license.
ARGUMENTS¶
- device
- Serial port when using ModBus RTU protocol.
- COM1, COM2, ... on Windows
- /dev/ttyS0, /dev/ttyS1, ... on Linux
- /dev/ser1, /dev/ser2, ... on QNX
- host
- Host name or dotted IP address when using ModBus/TCP protocol.
- writevalues
- List of values to be written. If none specified (default), mbpoll reads data. If negative numbers are provided, precede the list of data to be written by two dashes (--). For example:
mbpoll -t4:int /dev/ttyUSB0 -- 123 -1568 8974 -12
GENERAL OPTIONS¶
- -m mode
- Communication mode: rtu or tcp. Default is tcp.
- -a address
- Slave address. Range: 1-255 for RTU, 0-255 for TCP. Default is 1. For reading, it is possible to give an address list separated by commas or colons. For example:
-a 32,33,34,36:40 reads slaves [32,33,34,36,37,38,39,40].
- -r reference
- Start reference. Default is 1. For reading, it is possible to give a reference list separated by commas or colons.
- -c count
- Number of values to read (1-125). Default is 1.
- -u
- Read the description of the type, the current status, and other information specific to a remote device (Report Slave ID). RTU only.
- -t type
- Data type. The following types are supported:
- 0
- Discrete output (coil) data type (binary 0 or 1).
- 1
- Discrete input data type (binary 0 or 1).
- 3
- 16-bit input register data type.
- 3:int16
- 16-bit input register with signed integer display.
- 3:hex
- 16-bit input register with hexadecimal display.
- 3:string
- 16-bit input register with string (char) display.
- 3:int
- 32-bit integer data type in input register table.
- 3:float
- 32-bit float data type in input register table.
- 4
- 16-bit output (holding) register data type (default).
- 4:int16
- 16-bit output (holding) register with signed integer display.
- 4:hex
- 16-bit output (holding) register with hexadecimal display.
- 4:string
- 16-bit output (holding) register with string (char) display.
- 4:int
- 32-bit integer data type in output (holding) register table.
- 4:float
- 32-bit float data type in output (holding) register table.
- -0
- First reference is 0 (PDU addressing) instead of 1.
- -W
- Use function code 0x10 (Write Multiple Registers) for writing a single register, instead of 0x06 (Write Single Register).
- -B
- Big endian word order for 32-bit integer and float.
- -1
- Poll only once, otherwise poll at every poll rate interval.
- -l rate
- Poll rate in milliseconds. Must be greater than 100. Default is 1000.
- -o timeout
- Response time-out in seconds (0.01 - 10.00). Default is 1.00 s.
- -q
- Quiet mode. Minimum output only.
- -x
- Print addresses (references) in hexadecimal format.
- -Q
- Enable MAX_SLAVE quirk (accept slave id 0-255).
- -X
- Enable REPLY_TO_BROADCAST quirk (send reply to broadcast).
MODBUS/TCP OPTIONS¶
- -p port
- TCP port number. Default is 502.
MODBUS RTU OPTIONS¶
- -b baudrate
- Baud rate (1200-921600). Default is 19200.
- -d databits
- Data bits: 7 or 8. Default is 8 for RTU.
- -s stopbits
- Stop bits: 1 or 2. Default is 1.
- -P parity
- Parity: none, even, or odd. Default is even.
- -R [pin]
- RS-485 mode. /RTS is on (active low) after sending. An optional parameter specifies the GPIO pin number for RTS (only available when compiled with GPIO RTS support).
- -F [pin]
- RS-485 mode. /RTS is on (active low) when sending. An optional parameter specifies the GPIO pin number for RTS (only available when compiled with GPIO RTS support).
OTHER OPTIONS¶
EXAMPLES¶
Read input registers 1 and 2 from slave 33 via RTU on /dev/ttyUSB2 at 38400 baud:
Read holding registers 100 to 109 from slave 1 via TCP on host 192.168.1.10:
Write value 1234 to holding register 100 of slave 1 via TCP:
Write 32-bit integer values (including negative) to holding registers via RTU:
Read coils 1 to 8 from slave 5, poll only once:
Read multiple slaves at once:
Read a range of non-contiguous registers:
Report slave ID of device at address 1:
EXIT STATUS¶
- 0
- Success. All frames were received without errors.
- 1
- Failure. One or more communication errors occurred.
DEPENDENCIES¶
mbpoll requires libmodbus(3) version 3.1.7 or later.
BUGS¶
Report bugs at https://github.com/epsilonrt/mbpoll/issues.
AUTHOR¶
Pascal JEAN https://github.com/epsilonrt/mbpoll
COPYRIGHT¶
Copyright © 2015-2026 Pascal JEAN.
License GPLv3+: GNU GPL version 3 or later
https://www.gnu.org/licenses/gpl.html.
This is free software: you are free to change and redistribute it. There is NO
WARRANTY, to the extent permitted by law.
SEE ALSO¶
modbus_new_rtu(3), modbus_new_tcp_pi(3), libmodbus(7)
| February 2026 | mbpoll |