Modbus Software – Mbpoll / Modpoll (Windows)
Mbpoll / Modpoll
Informatie (ENG)
mbpoll is a command line utility to communicate with ModBus slave (RTU or TCP). It uses libmodbus.
This is a multiplatform project, the compilation was tested on GNU Linux x86 and x86_64, Microsoft Windows 7 x86 and GNU Linux ARM 6 (Raspbian).
Although the syntax of these options is very close modpoll proconX program, it is a completely independent project.
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 registers may be in decimal, hexadecimal or floating single precision.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
Usage: modpoll [options] serialport|host Arguments: serialport Serial port when using Modbus ASCII or 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 General options: -m ascii Modbus ASCII protocol -m rtu Modbus RTU protocol (default) -m tcp MODBUS/TCP protocol -m enc Encapsulated Modbus RTU over TCP -a # Slave address (1-255, 1 is default) -r # Start reference (1-65536, 100 is default) -c # Number of values to poll (1-100, 1 is default) -t 0 Discrete output (coil) data type -t 1 Discrete input data type -t 3 16-bit input register data type -t 3:hex 16-bit input register data type with hex display -t 3:int 32-bit integer data type in input register table -t 3:mod 32-bit module 10000 data type in input register table -t 3:float 32-bit float data type in input register table -t 4 16-bit output (holding) register data type (default) -t 4:hex 16-bit output (holding) register data type with hex display -t 4:int 32-bit integer data type in output (holding) register table -t 4:mod 32-bit module 10000 type in output (holding) register table -t 4:float 32-bit float data type in output (holding) register table -i Slave operates on big-endian 32-bit integers -f Slave operates on big-endian 32-bit floats -1 Poll only once, otherwise poll every second -e Use Daniel/Enron single register 32-bit mode -0 First reference is 0 (PDU addressing) instead 1 Options for MODBUS/TCP: -p # TCP port number (502 is default) Options for Modbus ASCII and Modbus RTU: -b # Baudrate (e.g. 9600, 19200, ...) (9600 is default) -d # Databits (7 or 8 for ASCII protocol, 8 for RTU) -s # Stopbits (1 or 2, 1 is default) -p none No parity -p even Even parity (default) -p odd Odd parity -4 # RS-485 mode, RTS on while transmitting and another # ms after -o # Time-out in seconds (0.01 - 10.0, 1.0 s is default) |
Usage Examples
To get help on usage run the following command:
1 |
modpoll -h |
To retrieve continuously 10 Modbus holding registers starting from reference 500 of slave ID number 5 with Modbus RTU at 19200 baud, no parity on COM1 run:
1 |
modpoll -b 19200 -p none -m rtu -a 3 -r 500 -c 10 COM1 |
To retrieve once 5 floating point values starting from reference 100 with Modbus/TCP from slave device with IP 10.0.0.100:
1 |
modpoll -m tcp -t4:float -r 100 -c 5 -1 10.0.0.100 |
The following command is used to read the input registers 1 and 2 of the slave at address 33 connected through RTU /dev/ttyUSB2 (38400 Bd)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
mbpoll -a 33 -b 38400 -t 3 -r 1 -c 2 /dev/ttyUSB2 mbpoll 0.1-10 - FieldTalk(tm) Modbus(R) Master Simulator Copyright (c) 2015 epsilonRT, All rights reserved. This software is governed by the CeCILL license <http://www.cecill.info> Protocol configuration: Modbus RTU Slave configuration...: address = [33] start reference = 1, count = 2 Communication.........: /dev/ttyUSB2, 38400-8E1 t/o 1.00 s, poll rate 1000 ms Data type.............: 16-bit register, input register table -- Polling slave 33... Ctrl-C to stop) [1]: 9997 [2]: 10034 -- Polling slave 33... Ctrl-C to stop) [1]: 10007 [2]: 10034 -- Polling slave 33... Ctrl-C to stop) [1]: 10007 [2]: 10034 -- Polling slave 33... Ctrl-C to stop) [1]: 10007 [2]: 10034 ^C--- /dev/ttyUSB2 poll statistics --- 4 frames transmitted, 4 received, 0 errors, 0.0% frame loss |
Download modpoll source @ Github
Download modpoll binairy @ modbusdriver.com
[#/software/modpoll” ]