Modbus Poll User Manual
Modbus Poll User Manual
https://www.modbustools.com/mbpoll-user-manual.html 1/65
28/09/2022 04:48 Modbus Poll user manual
7. Display formats
7.1. Native Modbus registers
7.2. 32-bit signed integer
7.3. 32-bit unsigned integer
7.4. 64-bit signed integer
7.5. 64-bit unsigned integer
7.6. 32-bit floating
7.7. 64-bit double
8. Save/Open Workspace
9. Export to csv
10. Export to Modbus Slave
11. Test center
11.1. ASCII Example
11.2. TCP/IP Example
11.3. Test center string file
11.4. Copy
12. Modbus Data logging
12.1. Text file
12.2. Microsoft Excel
13. Communication traffic
14. OLE/Automation
14.1. Excel example
14.2. Python example
14.3. Connection Functions/Properties
14.4. Read Functions
14.5. Automation Write Functions
14.6. Various Functions
14.7. Automation data properties
14.8. Write Functions (Create a data window)
15. Exception and error messages
15.1. Modbus Exception Codes
15.2. Modbus Poll error messages
2022-02-07
https://www.modbustools.com/mbpoll-user-manual.html 2/65
28/09/2022 04:48 Modbus Poll user manual
1. Modbus Poll
Modbus Poll is an easy to use Modbus master simulator developed for many purposes. Among others:
Designers of Modbus slave devices for quick and easy testing of protocol interface
Service engineers that want to read out and/or change specific service data from a device
OS requirements
All Windows versions from Windows 7 to Windows 11 are supported.
Modbus Poll version 7 runs on Windows XP.
Copyright.
Modbus Poll ("The Software") is copyright 2002-2022 by Witte Software, all rights reserved.
If you use the Software after the 30 day evaluation period a registration fee is required.
Unregistered use of the Software after the 30-day evaluation period is in violation of U.S. and international copyright laws.
One registered copy of the Software may either be used by a single person who uses the software personally on one or
more computers, or installed on a single computer used by multiple people, but not both.
Modbus Poll licenses are perpetual. Once you buy a license to a specific major version, and as long as you abide by the
license agreement, you can use that version forever with no additional cost.
https://www.modbustools.com/mbpoll-user-manual.html 3/65
28/09/2022 04:48 Modbus Poll user manual
Distribution.
Provided that you do not include your License Key you are hereby licensed to make copies of the Software; give exact
copies of the original to anyone; and distribute the Software in its unmodified form via electronic means. You are
specifically prohibited from charging for any such copies.
LIMITED WARRANTY.
THE SOFTWARE IS PROVIDED AS IS AND WITTE SOFTWARE DISCLAIMS ALL WARRANTIES RELATING TO THIS
SOFTWARE, WHETHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
LIMITATION ON DAMAGES.
NEITHER WITTE SOFTWARE NOR ANYONE INVOLVED IN THE CREATION, PRODUCTION, OR DELIVERY OF THIS
SOFTWARE SHALL BE LIABLE FOR ANY INDIRECT, CONSEQUENTIAL, OR INCIDENTAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE SUCH SOFTWARE EVEN IF WITTE SOFTWARE HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES OR CLAIMS. IN NO EVENT SHALL WITTE SOFTWARE’S LIABILITY FOR ANY DAMAGES EXCEED THE
PRICE PAID FOR THE LICENSE TO USE THE SOFTWARE, REGARDLESS OF THE FORM OF CLAIM. THE PERSON USING THE
SOFTWARE BEARS ALL RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE.
https://www.modbustools.com/mbpoll-user-manual.html 4/65
28/09/2022 04:48 Modbus Poll user manual
Modbus TCP/IP
Modbus UDP/IP
Hex
Binary
https://www.modbustools.com/mbpoll-user-manual.html 5/65
28/09/2022 04:48 Modbus Poll user manual
Font selection
Conditional colors
Scaling
https://www.modbustools.com/mbpoll-user-manual.html 6/65
28/09/2022 04:48 Modbus Poll user manual
3. Overview
Modbus Poll uses a multiple document interface. That means several windows can be opened. Each one with different data
contents from different slave devices at the same time.
This picture shows two open windows. One reading 10 Holding registers from slave id 1 and another reading 10 Holding
registers from slave id 2.
SHIFT + F1 invokes a special "help mode" in which the cursor turns into a help cursor (arrow + question mark). The user
can then select a visible object in the user interface, such as a menu item, toolbar button, or window. This opens help on a
topic that describes the selected item.
https://www.modbustools.com/mbpoll-user-manual.html 7/65
28/09/2022 04:48 Modbus Poll user manual
The check box "Close dialog on Response ok" is used to automatically close the dialog box when a value is successfully sent.
This is convenient when a lot of values are to be changed. In that way it is fast to select a new cell and then type a new
value again.
https://www.modbustools.com/mbpoll-user-manual.html 8/65
28/09/2022 04:48 Modbus Poll user manual
3 color options
Default color: This color is used if none of the conditional colors evaluates to true.
Rule 2: This color selection is used if the expression evaluates to true. Rule 2 has precedence over rule 1.
7 Comparison operators
not used
equal to
greater than
less than
and
The "and" operator cannot be used when the data type is of float or 32 bit long type. The condition value is entered as a hex
number if "and" is selected. It evaluates to true if any of the bits in both the cell and the condition value is 1.
https://www.modbustools.com/mbpoll-user-manual.html 9/65
28/09/2022 04:48 Modbus Poll user manual
3.6. Scaling
Scaling helps you scale raw values to human readable values. Scaling works only for signed and unsigned 16/32 bit
integers.
Line equation
\$Y = m * (X - X1) + Y1\$
Precision
Number of digits after the decimal point.
Enable
https://www.modbustools.com/mbpoll-user-manual.html 10/65
28/09/2022 04:48 Modbus Poll user manual
Must be enabled to scale the value from the Modbus server/slave. Scaling is automatically disabled if other than a 16/32
bit integer display format is selected.
Press CTRL+N
https://www.modbustools.com/mbpoll-user-manual.html 11/65
28/09/2022 04:48 Modbus Poll user manual
4. Connection dialog
To open the connection dialog you have 2 options:
Press F3
4.1. Connection
There are 5 different connection types:
1. Serial:
Modbus over serial line. RS232 or RS485. A USB serial converter can be used.
2. Modbus TCP/IP:
Select TCP/IP if you want to communicate with a MODBUS TCP/IP network. In this case, slave ID is the same as the Unit
ID used in MODBUS TCP/IP.
The port number is default 502.
If the connection fails then try if you can ping your device at the command prompt. If the ping command fails then
Modbus Poll fails too.
3. Modbus UDP/IP:
Select UDP/IP if you want to communicate with a MODBUS UDP/IP network. This is the same as Modbus TCP/IP but the
connection less UDP protocol is used instead.
https://www.modbustools.com/mbpoll-user-manual.html 12/65
28/09/2022 04:48 Modbus Poll user manual
Connection type 3-5 is not standard Modbus as specified by www.modbus.org (http://www.modbus.org) but
they are added for convenience.
Mode
Use this option to select RTU or ASCII mode. Default RTU.
Response timeout
Specifies the length of time that Modbus Poll should wait for a response from a slave device before giving up. Default is
1000ms.
If you set this value lower than 20ms the 3.5 char time gap between response and a new request can’t
be guaranteed. This is because the Windows scheduler switches tasks every 10 - 20ms.
If you Poll several slaves in a serial RS485 network you should NOT set the value lower than 20ms.
This is to ensure the 3.5 char time gap.
Serial connection to only one slave device less than 20ms is ok.
IP Address
Servers IP address. Default is localhost 127.0.0.1
Port
Server port number. Default 502
Connect Timeout
Max time to use to establish a connection. Default 1000
https://www.modbustools.com/mbpoll-user-manual.html 13/65
28/09/2022 04:48 Modbus Poll user manual
The use of RTS controlled RS232/RS485 converters should be avoided if possible. It is difficult to
determine the exact time when to switch off the transmitter with non real-time operating systems like
Windows and Linux. If it is switched off too early characters might still sit in the FIFO or the transmit
register of the UART and these characters will be lost. Hence the slave will not recognize the message. On
the other hand if it is switched off too late then the slave’s message is corrupted and the master will not
recognize the message.
DSR
DSR specifies whether the DSR (data-set-ready) signal is monitored for output flow control. If this member is TRUE and
DSR is turned off, output is suspended until DSR is sent again.
CTS
CTS specifies whether the CTS (clear-to-send) signal is monitored for output flow control. If this checkbox is enabled and
CTS is turned off, output is suspended until CTS is sent again.
DTR
DTR specifies whether the DTR will be enabled or disabled whenever the port is opened.
Remove Echo
If your device or RS232/RS485 converter echoes the chars just sent.
https://www.modbustools.com/mbpoll-user-manual.html 14/65
28/09/2022 04:48 Modbus Poll user manual
5. Read/Write definition
Use this command to define the data to be monitored for the active window.
Press F8
5.1. Slave ID
Range 1 to 255. (MODBUS protocol specifications say 247). The value 0 is also accepted to communicate directly to a
MODBUS/TCP or MODBUS/UDP device.
https://www.modbustools.com/mbpoll-user-manual.html 15/65
28/09/2022 04:48 Modbus Poll user manual
5.3. Address
Addresses in the Modbus protocol are confusing! Some protocol specifications use the protocol/message address and others
use device addressing.
This is not a problem with Modbus Poll. 410001 become 10000. The "4" is thrown away and the rest 10001 is decremented
by 1 as we count from 0 instead of 1.
https://www.modbustools.com/mbpoll-user-manual.html 16/65
28/09/2022 04:48 Modbus Poll user manual
Slave ID = 2
Quantity = 20
Scanrate = 1000
Slave ID = 5
Quantity = 1000
Scanrate = 500
5.4. Scanrate
The scan rate can be set from 0 to 3600000ms. Note that setting the scan rate lower than the transaction time does not make
sense. If a serial connection at 9600baud is used and 125 registers are requested the transaction time is roughly 8 + 2 + 250
+ 2 = 262ms + the gap (>3.5 char time) between the request and the response. In this case setting the scan rate at e.g. 100ms
does not make sense as the transaction time is at least 262ms + delay in the slave (gap) + min time between polls. (Set in the
connection dialog F3).
If "Read/Write" is disabled you can make single requests with the "Read/Write once" button or press F6.
If enabled, the address is also shown in the value cell like: 2000 = 00000
4x5001 to 4x5999 are assumed 32-bit long integers (4-bytes per register).
4x7001 to 4x7999 are assumed 32-bit floating points (4-bytes per register).
Dealing with 32-bit values in Modbus is NOT unique to Enron-MB. However, Enron-MB takes the debatable step of
returning 4-bytes per register instead of the 2-bytes implied by the term "holding register" in the Modbus specification. This
means a poll of registers 4x5001 and 4x5002 in Enron-Modbus returns 8-bytes or two 32-bit integers, whereas Standard
Modbus would only return 4-bytes or one 32-bit integer treated as two 16-bit integers. In addition, polling register 4x5010
in Enron-MB returns the tenth 32-bit long integer, whereas Standard Modbus would consider this 1/2 of the fifth 32-bit long
integer in this range.
5.10. Rows
Specify the number of rows in the grid you prefer.
https://www.modbustools.com/mbpoll-user-manual.html 18/65
28/09/2022 04:48 Modbus Poll user manual
Press Alt + R
The X-Axis displays the number of seconds since the chart was started.
When the points reach the end of the chart there are 3 options:
https://www.modbustools.com/mbpoll-user-manual.html 19/65
28/09/2022 04:48 Modbus Poll user manual
Continue: It continues until it reaches the max number of points or stop is pressed.
6.1. Settings
By default all 12 series are linked to the left Y-Axis. Check the "Right Y-Axis" check box if you want to link a series to the
right Y-Axis.
Specify
Colors
Right Y-Axis
Title
Offset
Show
File name
Address
The offset is useful to align data points on the same Y-Axis. For example, data points that are either 0 or 1 can be offset so
they are not drawn on top of each other.
https://www.modbustools.com/mbpoll-user-manual.html 20/65
28/09/2022 04:48 Modbus Poll user manual
Zooming in on the chart can be useful if you want to see more details. The zoom is controlled with the left mouse button. To
zoom a specific part of the chart, simply left-click on the chart (this will be the upper-left corner of the zoomed rectangle)
and drag to the bottom-right. A rectangle will appear. As soon as you release the mouse button, the axes will automatically
adjust themselves to the region you have selected.
If you left-click on the chart (like for starting a zoom) but if you move to the top-left corner instead, all the modifications
done with the zoom and pan features will be canceled (the chart will be in the state it was before the manipulations with
the pan and zoom).
Delimiters: Select the character that separates values in your text file. Use tab for Excel.
https://www.modbustools.com/mbpoll-user-manual.html 21/65
28/09/2022 04:48 Modbus Poll user manual
https://www.modbustools.com/mbpoll-user-manual.html 22/65
28/09/2022 04:48 Modbus Poll user manual
7. Display formats
Mark the cells to be formatted. Select one of the 28 display formats from the display menu.
Signed
Unsigned
Hex
Binary
Example
Byte Order: AB CD (Big-endian)
The decimal number 123456789 or in hexadecimal 07 5B CD 15
Order as they come over the wire in a Modbus message: 07 5B CD 15
Example
Byte Order: AB CD (Big-endian)
The decimal number 123456789 or in hexadecimal 07 5B CD 15
Order as they come over the wire in a Modbus message: 07 5B CD 15
https://www.modbustools.com/mbpoll-user-manual.html 23/65
28/09/2022 04:48 Modbus Poll user manual
Example
Byte Order: AB CD EF GH (Big-endian)
The decimal number -1,234,567,890,123,456,789 or in hexadecimal EE DD EF 0B 82 16 7E EB
Order as they come over the wire in a Modbus message: EE DD EF 0B 82 16 7E EB
Example
Byte Order: AB CD EF GH (Big-endian)
The decimal number 1,234,567,890,123,456,789 or in hexadecimal 11 22 10 F4 7D E9 81 15
Order as they come over the wire in a Modbus message: 11 22 10 F4 7D E9 81 15
Float Big-endian
Float Little-endian
Example
Byte Order: AB CD (Big-endian)
The floating point number 123456.00 or in hexadecimal 47 F1 20 00
Order as they come over the wire in a Modbus message: 47 F1 20 00
Double Big-endian
Double Little-endian
Example
https://www.modbustools.com/mbpoll-user-manual.html 24/65
28/09/2022 04:48 Modbus Poll user manual
https://www.modbustools.com/mbpoll-user-manual.html 25/65
28/09/2022 04:48 Modbus Poll user manual
8. Save/Open Workspace
If you open many related Modbus windows it is convenient to save a snapshot of the current layout of all open and
arranged Modbus Windows in one workspace.
A workspace (*mbw) is a file that contains display information and file names of all open windows. Not the actual contents.
To do this, go to File→ Save Workspace.
When you open a workspace file, Modbus Poll opens all Modbus Windows and displays them in the layout that you saved.
https://www.modbustools.com/mbpoll-user-manual.html 26/65
28/09/2022 04:48 Modbus Poll user manual
9. Export to csv
Export names and values to a Comma, Semicolon or Tab Separated Values File.
https://www.modbustools.com/mbpoll-user-manual.html 27/65
28/09/2022 04:48 Modbus Poll user manual
https://www.modbustools.com/mbpoll-user-manual.html 28/65
28/09/2022 04:48 Modbus Poll user manual
Open list
Rest test strings from a file.
Save list
Store the test strings to a file.
Clear
Clear the test list.
Add to list
Add the current test string to the list.
Add Check
Add a CRC or LRC to the end of the input string.
When using the test center you may want to disable communication from other windows. Check the "Read/Write disable"
check box in "Read/Write Definition" dialog. Setup→Read/Write Definition.
3A 30 31 30 33 30 30 30 30 30 30 30 41
3A 30 31 30 33 30 30 30 30 30 30 30 41 46 32 0D 0A
00 00 00 00 00 06 01 03 00 00 00 0A
https://www.modbustools.com/mbpoll-user-manual.html 29/65
28/09/2022 04:48 Modbus Poll user manual
11.4. Copy
Use the Copy button to copy selected Tx/Rx strings to the clipboard.
The SHIFT and CTRL keys can be used together with the mouse to select and deselect strings, select groups of strings, and
select non-adjacent strings.
https://www.modbustools.com/mbpoll-user-manual.html 30/65
28/09/2022 04:48 Modbus Poll user manual
When you want to stop the data logging then select the logging off command on the setup menu.
Select
Specify the log rate in seconds. Independent of scan rate.
https://www.modbustools.com/mbpoll-user-manual.html 31/65
28/09/2022 04:48 Modbus Poll user manual
If the scan rate is e.g. 10000ms it makes no sense to set a 1 sec log rate as data is logged only when new
data is ready.
12.1.2. Delimiters
As delimiter you can use one of following options:
Fixed width
Means that the values are organized in columns.
Comma
Values separated by a comma.
Tab
Values separated by a tab.
12.1.7. Log ms
Specify that milliseconds are added to the log time.
12.1.12. Append
Specify that logs are appended to the selected file. Otherwise a new file is created.
https://www.modbustools.com/mbpoll-user-manual.html 32/65
28/09/2022 04:48 Modbus Poll user manual
Close the current log file and start a new file at midnight. A time stamp is added to your filename.
Select Excel Log from the setup menu or use shortcut keys: Alt+X
Do not touch the Excel sheet while logging as this will interrupt the logging.
https://www.modbustools.com/mbpoll-user-manual.html 33/65
28/09/2022 04:48 Modbus Poll user manual
Select: Specify the log rate in seconds. Log is independent of scan rate.
Remark: If the scan rate is e.g. 10000ms it makes no sense to set a 1 sec log rate as data is logged only when new data is
ready.
Stop after: Specify the number of log lines. Note that Excel 2003 is limited to 65,536 rows and Excel 2007 1,048,576
rows.
https://www.modbustools.com/mbpoll-user-manual.html 34/65
28/09/2022 04:48 Modbus Poll user manual
Use the copy button to copy the selected line to the clipboard.
This window shows only data sent and received by Modbus Poll. You can’t use it as a data sniffer.
https://www.modbustools.com/mbpoll-user-manual.html 35/65
28/09/2022 04:48 Modbus Poll user manual
14. OLE/Automation
Automation (formerly known as OLE Automation) makes it possible for one application to manipulate objects
implemented in another application.
An Automation client is an application that can manipulate exposed objects belonging to another application. This is also
called an Automation controller.
An Automation server is an application that exposes programmable objects to other applications. Modbus Poll is an
automation server.
That means you can use any program that supports VBA (Visual Basic for Applications) such as Visual Basic, Excel etc. to
interpret and show the modbus data according to your specific requirements.
1. Click the Microsoft office button and then click Excel options.
2. Click popular and then select the show Developers tab in the ribbon check box.
Note the ribbon is part of the Microsoft fluent user interface.
4. On the right pane, under Main Tabs, check the Developer check box.
5. Click OK. The Developer tab should now show in the ribbon (right most tab).
https://www.modbustools.com/mbpoll-user-manual.html 36/65
28/09/2022 04:48 Modbus Poll user manual
VB
Public doc1 As Object
Public doc2 As Object
Public app As Object
Dim res As Integer
Dim n As Integer
For n = 0 To 9
Cells(5 + n, 2) = doc1.SRegisters(n)
Next n
For n = 0 To 9
Cells(18 + n, 2) = doc2.Coils(n)
Next n
End Sub
Python Example
https://www.modbustools.com/mbpoll-user-manual.html 37/65
28/09/2022 04:48 Modbus Poll user manual
PYTHON
import win32com.client as win32
SIGNED = 0
UNSIGNED = 1
HEX = 2
BINARY = 3
FLOAT_LE_BS = 4
FLOAT_BE = 5
DOUBLE_LE_BS = 6
DOUBLE_BE = 7
S32_LE_BS = 8
S32_BE = 9
FLOAT_LE = 10
FLOAT_BE_BS = 11
DOUBLE_LE = 12
DOUBLE_BE_BS = 13
S32_LE = 14
S32_BE_BS = 15
U32_BE = 17
U32_LE_BS = 18
U32_BE_BS = 19
U32_LE = 20
S64_BE = 21
S64_LE_BS = 22
S64_BE_BS = 23
S64_LE = 24
U64_BE = 25
U64_LE_BS = 26
U64_BE_BS = 27
U64_LE = 28
#Endianness
BE = 0
LE = 3
BE_BS = 2
LE_BS = 1
App = win32.Dispatch('Mbpoll.Application')
App.Connection = 1
App.IPAddress = "127.0.0.1"
App.ServerPort = 502
App.OpenConnection
# Read 100 holding registers from slave ID 1, address 0 (40001) every 1000ms
Win1.ReadHoldingRegisters(1, 0, 100, 1000)
# Show the Modbus window
Win1.ShowWindow()
# Show 20 rows
Win1.Rows(1)
https://www.modbustools.com/mbpoll-user-manual.html 38/65
28/09/2022 04:48 Modbus Poll user manual
Win1.SetFormat(0, SIGNED)
Win1.SetFormat(1, UNSIGNED)
Win1.SetFormat(2, HEX)
Win1.SetFormat(3, BINARY)
Win1.SetFormat(4, S32_BE)
Win1.SetFormat(6, S32_LE)
Win1.SetFormat(8, S32_BE_BS)
Win1.SetFormat(10, S32_LE_BS)
Win1.SetFormat(12, U32_BE)
Win1.SetFormat(14, U32_LE)
Win1.SetFormat(16, U32_BE_BS)
Win1.SetFormat(18, U32_LE_BS)
Win1.SetFormat(20, S64_BE)
Win1.SetFormat(24, S64_LE)
Win1.SetFormat(28, S64_BE_BS)
Win1.SetFormat(32, S64_LE_BS)
Win1.SetFormat(40, U64_BE)
Win1.SetFormat(44, U64_LE)
Win1.SetFormat(48, U64_BE_BS)
Win1.SetFormat(52, U64_LE_BS)
Win1.SetFormat(60, FLOAT_BE)
Win1.SetFormat(62, FLOAT_LE)
Win1.SetFormat(64, FLOAT_BE_BS)
Win1.SetFormat(66, FLOAT_LE_BS)
Win1.SetFormat(80, DOUBLE_BE)
Win1.SetFormat(84, DOUBLE_LE)
Win1.SetFormat(88, DOUBLE_BE_BS)
Win1.SetFormat(92, DOUBLE_LE_BS)
Win1.SetName(4, "S32_BE")
Win1.SetName(6, "S32_LE")
Win1.SetName(8, "S32_BE_BS")
Win1.SetName(10, "S32_LE_BS")
Win1.SetName(12, "U32_BE")
Win1.SetName(14, "U32_LE")
Win1.SetName(16, "U32_BE_BS")
Win1.SetName(18, "U32_LE_BS")
Win1.SetName(20, "S64_BE")
Win1.SetName(24, "S64_LE")
Win1.SetName(28, "S64_BE_BS")
Win1.SetName(32, "S64_LE_BS")
Win1.SetName(40, "U64_BE")
Win1.SetName(44, "U64_LE")
Win1.SetName(48, "U64_BE_BS")
Win1.SetName(52, "U64_LE_BS")
Win1.SetName(60, "FLOAT_BE")
Win1.SetName(62, "FLOAT_LE")
https://www.modbustools.com/mbpoll-user-manual.html 39/65
28/09/2022 04:48 Modbus Poll user manual
Win1.SetName(64, "FLOAT_BE_BS")
Win1.SetName(66, "FLOAT_LE_BS")
Win1.SetName(80, "DOUBLE_BE")
Win1.SetName(84, "DOUBLE_LE")
Win1.SetName(88, "DOUBLE_BE_BS")
Win1.SetName(92, "DOUBLE_LE_BS")
# Refresh
Win1.EnableRefresh = True
Win1.ResizeAllColumns ()
Win1.ResizeWindow()
print (Win1.GetName(1))
14.3.1. Connection
Connection selects the desired connection. A serial port or one of the Ethernet connections can be selected.
Valid values
0 = Serial port
1 = Modbus TCP/IP
2 = Modbus UDP/IP
3 = Modbus ASCII/RTU over TCP/IP
4 = Modbus ASCII/RTU over UDP/IP
Example
VB
Connection = 0
14.3.2. BaudRate
Applicable only for Connection = 0
Valid values
300
600
1200
2400
4800
9600 (Default)
14400
19200
https://www.modbustools.com/mbpoll-user-manual.html 40/65
28/09/2022 04:48 Modbus Poll user manual
38400
56000
57600
115200
128000
153600
230400
256000
460800
921600
Example
VB
BaudRate = 9600
14.3.3. DataBits
Applicable only for Connection = 0
Valid values
7
8 (Default)
Example
VB
DataBits = 8
14.3.4. Parity
Applicable only for Connection = 0
Valid values
0 = None
1 = Odd
2 = Even (Default)
Example
VB
Parity = 2
14.3.5. StopBits
Applicable only for Connection = 0
Valid values
https://www.modbustools.com/mbpoll-user-manual.html 41/65
28/09/2022 04:48 Modbus Poll user manual
1 (Default)
2
Example
VB
StopBits = 1
14.3.6. SerialPort
Applicable only for Connection = 0
Valid values
1…255
Default value = 1
Example
VB
SerialPort = 1
14.3.7. Mode
Applicable only for Connection = 0
Valid values
0 = RTU Mode
1 = ASCII Mode
Example
VB
Mode = 1
14.3.8. RemoveEcho
Applicable only for Connection = 0
If your device or RS232/RS485 converter echoes the chars just sent.
Valid values
0 (Default)
1 (Remove echoes)
Example
VB
RemoveEcho = 1
14.3.9. ResponseTimeout
https://www.modbustools.com/mbpoll-user-manual.html 42/65
28/09/2022 04:48 Modbus Poll user manual
The ResponseTimeout specifies the length of time in ms that Modbus Poll should wait for a response from a slave device
before giving up.
Valid values
50…100000
Example
VB
ResponseTimeout = 1000
14.3.10. DelayBetweenPolls
Property DelayBetweenPolls as Integer
Valid values
0…1000
Default value = 20
Example
VB
DelayBetweenPolls = 20
14.3.11. ServerPort
Applicable only for Connection = 1…4
Valid values
0…65535
Example
VB
ServerPort = 502
14.3.12. ConnectTimeout
The ConnectTimeout specifies the length of time that Modbus Poll should wait for a TCP/IP connection to succeed.
Valid values
100…30000ms
https://www.modbustools.com/mbpoll-user-manual.html 43/65
28/09/2022 04:48 Modbus Poll user manual
Example
VB
ConnectTimeout = 1000
14.3.13. IPVersion
Applicable only for Connection = 1…4
Valid values
4 = IP Version 4 (Default)
6 = IP Version 6
Example
VB
IPVersion = 4
14.3.14. OpenConnection
Opens the connection selected with the Connection property.
Parameters
This function has no parameters.
Return value
For error 3-5: Please check if you have the latest serial port driver.
Error Description
0 SUCCESS
3 Serial port. Not possible to get current settings from the port driver.
4 Serial port. Serial port driver did not accept port settings.
5 Serial port. Serial port driver did not accept timeout settings.
https://www.modbustools.com/mbpoll-user-manual.html 44/65
28/09/2022 04:48 Modbus Poll user manual
Error Description
https://www.modbustools.com/mbpoll-user-manual.html 45/65
28/09/2022 04:48 Modbus Poll user manual
PYTHON
import win32com.client as win32
App = win32.Dispatch('Mbpoll.Application')
Win1.ResizeAllColumns ()
Win1.ResizeWindow()
14.3.15. CloseConnection
Function CloseConnection() As Integer
Parameters
This function has no parameters.
Return value
Zero if success. Nonzero value if failed.
14.3.16. ShowCommunicationTraffic
Shows the communication traffic window.
Function ShowCommunicationTraffic()
Parameters
This function has no parameters.
Return value
https://www.modbustools.com/mbpoll-user-manual.html 46/65
28/09/2022 04:48 Modbus Poll user manual
None
14.3.17. CloseCommunicationTraffic
Closes the communication traffic window if shown.
Function CloseCommunicationTraffic()
Parameters
This function has no parameters.
Return value
None
Example
VB
' First a Modbus Poll document is needed.
Public doc As Object
You must create a Read before you can use properties to get data.
14.4.1. ReadCoils
Modbus function code 01
Function ReadCoils(SlaveID As Integer, Address As Long, Quantity As Integer, ScanRate As Long) As Integer
Parameters
SlaveID: The slave address 1 to 255
Address: The data address (Base 0)
Quantity: The number of data. 1 to 2000
ScanRate: 0 to 3600000ms
Return value
True if success. False if not success
14.4.2. ReadDiscreteInputs
Modbus function code 02
Function ReadDiscreteInputs(SlaveID As Integer, Address As Long, Quantity As Integer, ScanRate As Long) As Integer
Parameters
https://www.modbustools.com/mbpoll-user-manual.html 47/65
28/09/2022 04:48 Modbus Poll user manual
Return value
True if success. False if not success
14.4.3. ReadHoldingRegisters
Modbus function code 03
Function ReadHoldingRegisters(SlaveID As Integer, Address As Long, Quantity As Integer, ScanRate As Long) As Integer
Parameters
SlaveID: The slave address 1 to 255
Address: The data address (Base 0)
Quantity: The number of data. 1 to 125
ScanRate: 0 to 3600000ms
Return value
True if success. False if not success
14.4.4. ReadInputRegisters
Modbus function code 04
Function ReadInputRegisters(SlaveID As Integer, Address As Long, Quantity As Integer, ScanRate As Long) As Integer
Parameters
SlaveID: The slave address 1 to 255
Address: The data address (Base 0)
Quantity: The number of data. 1 to 125
ScanRate: 0 to 3600000ms
Return value
True if success. False if not success
14.5.1. WriteSingleCoil
Modbus function code 05.
Writes the first coil stored in the write array.
Parameters
https://www.modbustools.com/mbpoll-user-manual.html 48/65
28/09/2022 04:48 Modbus Poll user manual
Return value
True if the write array is ready and the data is sent. False if the array is empty or error in the parameters.
The controlling application is responsible for verifying the write operation by reading back the value written.
14.5.2. WriteSingleRegister
Modbus function code 06.
Writes the first register stored in the write array.
Parameters
SlaveID: The slave address 0 to 255
Address: The data address (Base 0)
Return value
True if the write array is ready and the data is sent. False if the array is empty or error in the parameters.
The controlling application is responsible for verifying the write operation by reading back the value written.
14.5.3. WriteMultipleCoils
Modbus function code 15.
Write the coils stored in the write array.
Return value
True if the write array is ready and the data is sent. False if the array is empty or error in the parameters.
The controlling application is responsible for verifying the write operation by reading back the values written.
Parameters
SlaveID: The slave address 0 to 255
Address: The data address (Base 0)
Quantity The number of data. 1 to 1968
14.5.4. WriteMultipleRegisters
Modbus function code 16.
Write the registers stored in the write array.
Parameters
SlaveID: The slave address 0 to 255
Address: The data address (Base 0)
Quantity: The number of data. 1 to 123
Return value
https://www.modbustools.com/mbpoll-user-manual.html 49/65
28/09/2022 04:48 Modbus Poll user manual
True if the write array is ready and the data is sent. False if the array is empty or error in the parameters.
The controlling application is responsible for verifying the write operation by reading back the value written.
Python example
https://www.modbustools.com/mbpoll-user-manual.html 50/65
28/09/2022 04:48 Modbus Poll user manual
PYTHON
import sys
import time
import win32com.client as win32
App = win32.Dispatch('Mbpoll.Application')
App.ServerPort = 502
result = App.OpenConnection
if result != 0:
print("Connection failed. Error: ", result)
sys.exit()
Various functions are associated with a Modbus Poll document. (The window with data)
14.6.1. ShowWindow
As default Modbus document windows are hidden. The ShowWindow function makes Modbus Poll visible and shows the
document with data content.
Function ShowWindow()
Parameters
This function has no parameters.
Return value
None
14.6.2. GetTxCount
Retreives the number of requests.
Parameters
This function has no parameters.
Return value
The number of requests.
14.6.3. GetRxCount
Retreives the number of response.
Parameters
This function has no parameters.
Return value
The number of response.
14.6.4. GetName
Retreives the name of a value.
Parameters
Index: Index 0 corresponds to the first Modbus address.
Return value
The name.
14.6.5. SetName
https://www.modbustools.com/mbpoll-user-manual.html 52/65
28/09/2022 04:48 Modbus Poll user manual
Parameters
Index: Index 0 corresponds to the first Modbus address.
Name: The name of the value cell.
Return value
None
14.6.6. FormatAll
Format all value cells with the selected format.
Parameters
Format: The format of the value cell.
Return value
None
14.6.7. GetFormat
Retreives the display format of the Modbus value.
Parameters
Index: Index 0 corresponds to the first Modbus address.
Return value
ID Format
0 Signed
1 Unsigned
2 Hex
3 Binary
5 Float big-endian
7 Double big-endian
https://www.modbustools.com/mbpoll-user-manual.html 53/65
28/09/2022 04:48 Modbus Poll user manual
ID Format
10 Float little-endian
12 Double little-endian
This setting is only for display. You still need to use byteOrder to get the correct endianness when using
Get/Set value functions.
14.6.8. SetFormat
Change the display format of the Modbus values. See Format values above.
Parameters
Index: Index 0 corresponds to the first Modbus address.
Format: The format of the value cell.
https://www.modbustools.com/mbpoll-user-manual.html 54/65
28/09/2022 04:48 Modbus Poll user manual
Return value
None
14.6.9. ResizeWindow
Resize an opened window to fit the grid.
Function ResizeWindow()
Parameters
This function has no parameters.
Return value
None
14.6.10. ResizeAllColumns
Resize all columns to fit the values inside the cells.
Function ResizeAllColumns()
Parameters
This function has no parameters.
Return value
None
14.6.11. Rows
Specify the number of rows in the grid.
Function Rows(NumberRows)
Parameters
NumberRows: Number of rows in the grid.
ID Description
0 10 Rows (Default)
1 20 Rows
2 50 Rows
3 100 Rows
4 Fit to quantity
Return value
None
https://www.modbustools.com/mbpoll-user-manual.html 55/65
28/09/2022 04:48 Modbus Poll user manual
14.6.12. ReadResult
Use this property to check if communication established with Read is running successful.
Parameters
This function has no parameters.
Return value
Error Description
0 SUCCESS
1 TIMEOUT ERROR
2 CRC ERROR
3 RESPONSE ERROR (The response was not the expected slave id, function or address)
4 WRITE ERROR
5 READ ERROR
10 DATA UNINITIALIZED
19 TRANSACTION ID ERROR
85h ACKNOWLEDGE
https://www.modbustools.com/mbpoll-user-manual.html 56/65
28/09/2022 04:48 Modbus Poll user manual
14.6.13. WriteResult
Use this function to check if a write was successful.
The value is DATA_UNINITIALIZED until the result from the slave is available. See ReadResult for a list of possible values.
Return value
Return a write result as an integer.
One with no postfix such as SRegisters which is used to set or get a value from the internal write/read array.
One with Win as postfix such as SRegistersWin which is used to set or get a value direct from the data window. This is
used when the data window is used for a Write function e.g. WriteMultipleRegistersWin.
Example 1:
VB
' doc is assumed created first. See Excel example.
' Writes 1 to index 0 in the data array used for the Write function later
doc.SRegisters(0) = 1
doc.SRegisters(1) = 10
doc.SRegisters(2) = 1234
' Write 3 registers stored in Modbus Poll internal array
' to Modbus address 100 (40101)
' A window is not created
res = doc.WriteMultipleRegisters(1, 100, 3)
' The above example do not create a data window but just make a single Modbus write.
VB
' doc is assumed created first. See Excel example.
doc.Floats(0) = 1.3
doc.Floats(2) = 10.5
doc.Floats(4) = 1234.12
' Write the 6 register stored in Modbus Poll
res = doc. WriteMultipleRegisters(1, 0, 6)
' 6 Registers are written as a floating point value is 32 bit wide.
Example 3:
Create a window that writes 3 registers.
https://www.modbustools.com/mbpoll-user-manual.html 57/65
28/09/2022 04:48 Modbus Poll user manual
VB
' doc is assumed created first. See Excel example.
' A window is created that writes the content every 1000ms
res = doc.WriteMultipleRegistersWin(1, 100, 3, 1000)
' Writes 1 to the first cell in the data window
doc.SRegistersWin(0) = 1
doc.SRegistersWin(1) = 10
doc.SRegistersWin(2) = 1234
' Now the 3 registers are written to slave id 1 address 100 every 1000ms
Description
Sets a coil in the write array structure or return a coil from the read array.
Syntax
Coils(Index) [=newvalue]
Description
Sets a register in the write array structure or return a register from the read array.
Syntax
SRegisters(Index) [=newvalue]
Description
Sets a register in the write array structure or return a register from the read array.
Syntax
URegisters(Index) [=newvalue]
Description
Sets a 32-bit integer in the write array structure or return an integer from the read array.
Syntax
Ints_32(Index) [=newvalue]
https://www.modbustools.com/mbpoll-user-manual.html 58/65
28/09/2022 04:48 Modbus Poll user manual
Description
Sets a 32-bit unsigned integer in the write array structure or return an unsigned integer from the read array.
Syntax
UInts_32(Index) [=newvalue]
Description
Sets a 64-bit integer in the write array structure or return an integer from the read array.
Syntax
Ints_64(Index) [=newvalue]
Description
Sets a 64-bit unsigned integer in the write array structure or return an unsigned integer from the read array.
Syntax
UInts_64(Index) [=newvalue]
Description
Sets a float in the write array structure or returns a float from the read array.
Syntax
Floats(Index) [=newvalue]
Description
Sets a double in the write array structure or return a double from the read array.
Syntax
Doubles(Index) [=newvalue]
14.7.10. ByteOrder
Property ByteOrder As Integer
Description
https://www.modbustools.com/mbpoll-user-manual.html 59/65
28/09/2022 04:48 Modbus Poll user manual
Sets the byte order used by Ints_32, UInts_32, Ints_64, UInts_64, Floats and Doubles properties.
The Win versions do not use this Property ByteOrder.
ID Endianness
0 Big-endian (Default)
3 Little-endian
Syntax
ByteOrder [=newvalue]
14.8.1. WriteSingleCoilWin
Modbus function code 05.
Parameters
SlaveID: The slave address 1 to 255
Address: The data address (Base 0)
ScanRate: 0 to 3600000ms
Return value
True if success. False if not success
14.8.2. WriteSingleRegisterWin
Modbus function code 06.
Parameters
SlaveID: The slave address 1 to 255
Address: The data address (Base 0)
ScanRate: 0 to 3600000ms
https://www.modbustools.com/mbpoll-user-manual.html 60/65
28/09/2022 04:48 Modbus Poll user manual
Return value
True if success. False if not success
Python Example how to open a window and write a single register every 1000 ms
PYTHON
import win32com.client as win32
SIGNED = 0
App = win32.Dispatch('Mbpoll.Application')
App.Connection = 1
App.IPAddress = "127.0.0.1"
App.ServerPort = 502
App.OpenConnection
Win1.ResizeAllColumns ()
Win1.ResizeWindow()
14.8.3. WriteMultipleCoilsWin
Modbus function code 15.
Function WriteMultipleCoilsWin(SlaveID As Integer, Address As Long, Quantity As Integer, ScanRate As Long) As Integer
Parameters
SlaveID: The slave address 1 to 255
Address: The data address (Base 0)
Quantity: The number of data. 1 to 1968
ScanRate: 0 to 3600000ms
https://www.modbustools.com/mbpoll-user-manual.html 61/65
28/09/2022 04:48 Modbus Poll user manual
Return value
True if success. False if not success
14.8.4. WriteMultipleRegistersWin
Modbus function code 16.
Parameters
SlaveID: The slave address 1 to 255
Address: The data address (Base 0)
Quantity: The number of data. 1 to 123
ScanRate: 0 to 3600000ms
Return value
True if success. False if not success
https://www.modbustools.com/mbpoll-user-manual.html 62/65
28/09/2022 04:48 Modbus Poll user manual
01 Illegal Function The function code received in the query is not an allowable action for the
server (or slave). This may be because the function code is only applicable
to newer devices, and was not implemented in the unit selected. It could
also indicate that the server (or slave) is in the wrong state to process a
request of this type, for example because it is not configured and is being
asked to return register values.
02 Illegal Data Address The data address received in the query is not an allowable address for the
server. More specifically, the combination of reference number and
transfer length is invalid. For a controller with 100 registers, the PDU
addresses the first register as 0, and the last one as 99. If a request is
submitted with a starting register address of 96 and a quantity of registers
of 4, then this request will successfully operate (address-wise at least) on
registers 96, 97, 98, 99. If a request is submitted with a starting register
address of 96 and a quantity of registers of 5, then this request will fail with
Exception Code 0x02 “Illegal Data Address” since it attempts to operate on
registers 96, 97, 98, 99 and 100, and there is no register with address 100.
03 Illegal Data Value A value contained in the query data field is not an allowable value for the
server (or slave). This indicates a fault in the structure of the remainder of
a complex request, such as that the implied length is incorrect. It
specifically does NOT mean that a data item submitted for storage in a
register has a value outside the expectation of the application program,
since the MODBUS protocol is unaware of the significance of any particular
value of any particular register.
04 Server Device Failure An unrecoverable error occurred while the server (or slave) was
attempting to perform the requested action.
https://www.modbustools.com/mbpoll-user-manual.html 63/65
28/09/2022 04:48 Modbus Poll user manual
0A Gateway Path Unavailable Specialized use in conjunction with gateways, indicates that the gateway
was unable to allocate an internal communication path from the input port
to the output port for processing the request. Usually means that the
gateway is misconfigured or overloaded.
0B Gateway Target Device Failed Specialized use in conjunction with gateways, indicates that no response
to Respond was obtained from the target device. Usually means that the device is not
present on the network.
Timeout Error The response is not received within the expected time. Check the following:
Serial Connection
Serial settings such as Baud rate, parity, Data bits, Stop bits etc.
Slave ID
Response timeout
TCP/IP Connection
Response timeout
Check that Host and Port are consistent with the slave
Response Error The response is not the expected one. Different slave ID.
CRC Error The CRC value of the received response is not correct.
https://www.modbustools.com/mbpoll-user-manual.html 64/65
28/09/2022 04:48 Modbus Poll user manual
Write Error This is an error reported by the serial driver. This could happen if a USB/RS232/485
converter is used and the USB cable is unplugged. There are 4 types:
Break condition
I/O error
Read Error This is an error reported by the serial driver. There are 6 types:
Framing error
Parity error
I/O error
Break condition
Byte count error The byte count in the response is not correct. Compared to the expected.
Transaction ID error It is used for transaction pairing, the MODBUS server copies in the response the
transaction identifier of the request.
https://www.modbustools.com/mbpoll-user-manual.html 65/65