Witte Software® https://www.modbustools.com
2023-08-01
1.Modbus Poll
Modbus Poll is an easy-to-use Modbus master simulator developed for various purposes. Among them:
- Modbus slave device designers can quickly and easily test protocol interfaces
- Automation engineers who need to test Modbus devices or networks on-site
- Service engineers who want to read and/or change specific service data from the device
- Change Modbus registers in the slave device
- Log data from Modbus devices
- Troubleshooting and compliance testing
1.1. System requirements for Modbus polling
Hardware requirements
Processor; Recommended 1 GHz or faster
1 GB RAM
5 MB free hard disk space
1024 x 768 display resolution Operating system requirements
Supports all Windows versions from Windows 7 to Windows 11.
Modbus Poll version 7 runs on Windows XP.
1.1.1. Silent installation
Silent installation requires no user intervention and has no user interface. Users will not see any dialog boxes or be asked any questions.
Use the command line /S switch.
1.2. Termination of User License Agreement
Before using Modbus Poll, you should carefully read the following terms and conditions. Unless you have a different license agreement signed by Witte Software, your use of this software indicates your acceptance of this license agreement and warranty. If you do not accept these terms, you must immediately stop using the software.
Copyright.
Modbus Poll ("Software") Copyright 2002-2023, Witte Software. All rights reserved.
Evaluation and Registration.
This is not freeware. You are hereby licensed to use this software for evaluation purposes free of charge for a period of 30 days.
If you use this software after the 30-day evaluation period, you will need to pay a registration fee.
Using this software without registration after the 30-day evaluation period will violate U.S. and international copyright laws.
One registered copy of this software may be used by one person for personal use on one or multiple computers, or installed on one computer used by multiple people, but not on both types of computers simultaneously.
For information regarding orders and pricing, please visithttps://www.modbustools.com/order.html
Modbus Poll licenses are perpetual. Once you have purchased a license for a specific major version and as long as you comply with the license agreement, you may use that version permanently without additional fees.
Distribution.
If you do not include your license key, you are authorized to make exact copies of this software; provide exact copies of the original to anyone; and distribute the unmodified software electronically. You are specifically prohibited from charging for any such copies.
Limited Warranty.
THIS SOFTWARE IS PROVIDED "AS IS" AND ALL EXPRESS OR IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED BY WITTE SOFTWARE.
LIMITATION OF DAMAGES.
NEITHER WITTE SOFTWARE NOR ANY PERSON 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 THIS 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, REGARDLESS OF THE FORM OF CLAIM, EXCEED THE PRICE PAID FOR THE LICENSE TO USE THIS SOFTWARE. THE PERSON USING THIS SOFTWARE ASSUMES ALL RISKS RELATED TO THE QUALITY AND PERFORMANCE OF THIS SOFTWARE.
2. Modbus Polling Function
2.1. Connection
Modbus Poll uses the following methods to read/write data from/to devices:
- Modbus RTU or ASCII over RS232 or RS485 networks. (USB/RS232/485 converter)
- Modbus TCP/IP
- Modbus over TCP/IP. (Modbus RTU/ASCII encapsulated in TCP packets)
- Protocol UDP/IP
- Modbus over UDP/IP. (Modbus RTU/ASCII encapsulated in UDP packets)
2.2. Supported Modbus Functions
- 01 (0x01) Read Coil
- 02 (0x02) Read Discrete Input
- 03 (0x03) Read Hold Register
- 04 (0x04) Read Input Register
- 05 (0x05) Write Single Coil
- 06 (0x06) Write Single Register
- 08 (0x08) Diagnostics (Serial Line Only)
- 11 (0x0B) Get Communication Event Counter (Serial Line Only)
- 15 (0x0F) Write Multiple Coils
- 16 (0x10) Write Multiple Registers
- 17 (0x11) Report Server ID (Serial Line Only)
- 22 (0x16) Mask Write Register
- 23 (0x17) Read/Write Multiple Registers
- 43 / 14 (0x2B / 0x0E) Read device identification
2.3. Data recording
- Record data to a text file
- Record data directly to Excel
2.4. Display format
Each cell can be formatted individually.
- Signed 16-bit register
- Unsigned 16-bit register
- Hexadecimal
- Binary
- 32-bit signed integer with arbitrary word/byte order
- 32-bit unsigned integer with arbitrary word/byte order
- 64-bit signed integer with arbitrary word/byte order
- 64-bit unsigned integer with arbitrary word/byte order
- 32-bit floating-point number with arbitrary word/byte order
- 64-bit double floating-point with arbitrary word/byte order
2.5. Other functions
- OLE/automation for connecting with Excel VBA, Python, etc.
- Data traffic monitoring
- Print and print preview
- Font selection
- Conditional color
- Zoom
- Real-time chart
- Save/Open Workspace
- Address Scan
3. Overview
Modbus Poll uses a multi-document interface. This means that multiple windows can be opened, each with different data content from different slaves.

This photo shows two open windows. One reads 10 hold registers from slave id 1, and the other reads 10 hold registers from slave id 2.
3.1. Help Anytime, Anywhere
Press F1to get context-sensitive help on the topic related to the currently selected item.
SHIFT + F1invokes a special "Help Mode", where the cursor becomes a help cursor (arrow + question mark). Users can then select visible objects in the user interface, such as menu items, toolbar buttons, or windows. This will open help on the topic describing the selected item.
3.2. Naming Cells
You can type any text here to specify a value cell. You can also copy/paste text from Excel cells.
3.3. Value Cell
Displays the data value of the Modbus register. If you double-click the value cell, a dialog box will appear, allowing you to write new values to the slave device. Typing a number in the value cell will also display this dialog box. You can select the Modbus function used for writing values.
The "Close dialog box when response is successful" checkbox is used to automatically close the dialog box when values are successfully sent. This is convenient when changing a large number of values. This way, you can quickly select a new cell and then type in the new value again.

3.4. Change Font
To change the font, you have 2 options:
- Select the cell you want to change and right-click.
- Select the cell you want to change, then go to Menu → Display → Font.

3.5. Conditional Colors
Conditional colors help you visually display values within a specific range. There are 3 color options:
- Default color: If no conditional color calculation results in true, this color is used.
- Rule 1: If the expression calculation results in true, this color selection is used. Rule 1 takes precedence over Rule 2.
- Rule 2: If the expression calculation results in true, this color selection is used.
7 Comparison operators
- Not used
- Equal to
- Better than...
- Less than
- Greater than or equal to
- Less than or equal to
- And
When the data type is float or 32-bit long, the 'and' operator cannot be used. If 'and' is selected, the condition value will be entered in hexadecimal format. If any bit in the cell and the condition value is 1, the calculation result will be true.
3.5.1. Color examples
If the cell value is between 398 and 402, it is green

3.6. Scaling
Scaling helps you convert the original value to a human-readable value. Scaling is only applicable to signed and unsigned 16/32-bit integers.

(X1,Y1) and (X2,Y2)
A straight line passing through two points (X1,Y1) and (X2,Y2)
Slope=m=Y2−Y1X2−X1
Equation of the line
Y=m⋅(X−X1)+Y1
The number of decimal places to be precise. To enable
Scaling of values from Modbus server/slave must be enabled. If a format other than 16/32-bit integer display format is selected, scaling is automatically disabled.
3.7. Real-time Chart
This chart can draw up to 12 series in real-time, with each series containing up to 100,000 points.
3.8. Address Scan
Scans the address range to obtain a list of all valid addresses in the device.
3.9. Open a new window
To open another window, you have 3 options:
- Press CTRL+N
- Select "New" from the "File" menu
- Press
On the toolbar
on the toolbar. 4. Connection Dialog
To open the connection dialog, you have 2 options:
- Press F3
- Select "Connect" from the "Connection" menu

4.1. Contact
There are 5 different connection types:
- Serial:
Modbus over serial line. RS232 or RS485. USB serial converters can be used. - Modbus TCP/IP:
If you want to communicate with a MODBUS TCP/IP network, select TCP/IP. In this case, the Slave ID is the same as the Unit ID used in MODBUS TCP/IP.
The port number defaults to 502.
If the connection fails, try pinging your device from the command prompt. If the ping command fails, then Modbus polling will also fail. - Modbus UDP/IP:
If you want to communicate with a MODBUS UDP/IP network, select UDP/IP. This is the same as Modbus TCP/IP, but uses the connectionless UDP protocol. - Modbus RTU/ASCII over TCP/IP:
This is an RTU or ASCII message sent over a TCP/IP network instead of a serial line. - Modbus RTU/ASCII over UDP/IP:
This is an RTU or ASCII message sent over a UDP/IP network instead of a serial line.
| Connection types 3-5 are not specified by www.modbus.orgas standard Modbus, but they are added for convenience. |
Depending on your selection, some other settings will be grayed out.
4.2. Serial Port Settings
Use these parameters to set the serial port settings. They are only available when the connection type is "Serial Port". Mode
Use this option to select theRTUOrASCIImode. Default is RTU. Response Timeout
Specify the length of time Modbus polling should wait for a response from the slave device before giving up. The default value is 1000 milliseconds. Minimum Delay between Polls
This setting ensures a minimum delay before transmitting the next request, regardless of the scanning rate. The resolution of this setting is approximately 15ms. On some computers, better resolution can be achieved, but not all.
| If you set this value to less than 20 milliseconds, there is no guarantee that the time interval between a response and a new request will be 3.5 characters. This is because the Windows scheduler switches tasks every 10-20 milliseconds. If you are polling multiple slaves in a serial RS485 network, you should not set this value to less than 20ms. This is to ensure a 3.5-character time gap. In TCP/IP networks, less than 20 milliseconds is sufficient. For serial connections with only one slave device, a time of less than 20ms is acceptable. |
User Baud Rate
If the default baud rates are not useful, specify a custom baud rate.
4.3. Remote Server
Remote server settings are only available when using an Ethernet connection. IP Address
Server IP address. The default is the local host 127.0.0.1 Port
Server port number. The default is 502 Connection Timeout
Maximum time used to establish a connection. The default is 1000
4.4. Advanced Settings
Real-Time Strategy Switching
RTS Switching specifies that if bytes are available for transmission, the RTS line will be high. After all buffered bytes are sent, the RTS line will be low.
If your 232/485 converter does not have an automatic direction switch, you can use it to switch directions.
| If possible, avoid using RTS-controlled RS232/RS485 converters. For non-real-time operating systems such as Windows and Linux, it is difficult to determine the exact time when the transmitter is turned off. If it is turned off too early, characters may still be in the FIFO or UART transmit register, and these characters will be lost. Therefore, the slave device will not be able to recognize the message. On the other hand, if it is turned off too late, the message from the slave device will be corrupted, and the master device will not be able to recognize the message. |
Digital SR
DSR specifies whether to monitor the DSR (Data Set Ready) signal for output flow control. If this member is TRUE and DSR is turned off, output will be paused until DSR is sent again. CTS
CTS specifies whether to monitor the CTS (Clear to Send) signal for output flow control. If this checkbox is enabled and CTS is turned off, output will pause until CTS is sent again.
DTR specifies whether to enable or disable DTR whenever the port is opened.
Echo cancellation
If your device or RS232/RS485 converter echoes the characters just sent.
Use this command to define the data to be monitored by the active window.
To open the read/write definition dialog, you have 3 options:
- Press F8
- Select "Read/Write Definition" from the settings menu
- Press
On the toolbar

on the toolbar.
5.1. Slave ID
Range: 1 to 255. (Specified as 247 in the MODBUS protocol specification). A value of 0 can also be used to communicate directly with MODBUS/TCP or MODBUS/UDP devices.
You can select one from the 8 function codes.
5.2.1. Read Function
The data returned by the read function is displayed on the grid window.
- 01: Read Coil (0x)
- 02: Read Discrete Input (1x)
- 03: Read Holding Register (4x)
- 04: Read Input Register (3x)
5.2.2. Write Function
The write function writes the data displayed on the grid window.
- 05: Write Single Coil (Write Coil State)
- 06: Write Single Register (Write Holding Register)
- 15: Write Multiple Coils (Writes to Coils)
- 16: Writes to Holding Registers
5.3. Addresses
Addresses in the Modbus protocol are quite confusing! Some protocol specifications use protocol/message addresses, while others use device addressing.
5.3.1. Protocol/Message Addresses
Some protocol specifications use protocol/message addresses that count from 0 to 65535, along with function codes. This is also what the new Modbus specification uses. This is the address in the message sent over the line.
Modbus Poll uses protocol/message addresses that count from 0 to 65535.
5.3.2. Device Addresses
Some protocol specifications use device address/register pairs. Registers start counting from 1. The first digit describes the function to be used. This means that the device address 40101 is identified by the address 100. "4" indicates a holding register and 4x registers start counting from 1. What's even more confusing is that 4x indicates function code 03, and 3x indicates function code 04!
5.3.3. 5-Bit and 6-Bit Addressing
The address format 4x counts from 40001 to 49999. The next address is not50000.In the past, 9999 addresses were sufficient. In some cases, 9999 is not enough. Then a zero is added. 40101 becomes 400101, and so on. This is called 6-bit addressing or extended addressing.
This is not a Modbus polling issue. 410001 becomes 10000. The "4" is discarded, and the remaining 10001 is decremented by 1 because we start counting from 0 instead of 1.
5.3.4. Address Examples
These examples show how to set up Modbus polling if the specification uses device addresses.
Read Holding Registers
You want to read 20 registers in device address 40011 from Slave ID 2 every 1000ms. From the "4" we know this is function 03 "Read Holding Registers".
- Slave ID = 2
- Function = "03 Read Holding Registers (4x)"
- Address = 10 (11 minus 1)
- Quantity = 20
- Scan Rate = 1000
Read Discrete Inputs
You want to read 1000 coils at address 110201 from Slave ID 5 every 500ms. From the "1" we know this is function 02 "Read Discrete Inputs"
- Slave ID = 5
- Function = "02 Read Discrete Input (1x)"
- Address = 10200 (10201 - 1)
- Quantity = 1000
- Scan Rate = 500
5.4. Scan Rate
The scan rate can be set from 0 to 3600000ms. Please note that setting the scan rate below the transaction time is meaningless. If using a serial connection with a baud rate of 9600 and requesting 125 registers, the transaction time is approximately 8 + 2 + 250 + 2 = 262ms + the gap between request and response (>3.5 character times). In this case, setting the scan rate to 100ms is meaningless because the transaction time is at least 262ms + slave delay (gap) + the shortest time between polls. (Set in the connection dialog F3).
5.5. Read/Write Disable
The "Read/Write Disable" checkbox can be used to temporarily enable or disable communication for this window. Then, the text (Disabled) will be displayed along with Tx and error counters.

If "Read/Write" is disabled, you can use the "Read/Write Once" button or press F6 to issue a single request.

"Read/Write Once" button
5.5.1. Disable on Error
Disable read/write when an error occurs.
5.6. Hide Name Column
Hide all name columns. This can conveniently free up more space if they are not used.
5.7. Address in Cell
If enabled, the address will also be displayed in the value cell, for example: 2000 = 00000

5.8. PLC Address (Base Address 1)
This option displays the address as a device address.

5.9. Enron/Daniel Modbus
Enron or Enron/Daniels Modbus is a standard Modbus with some "vendor extensions". The exact impact of these extensions depends on the context, but the most common Modbus commands work as expected. There are some vendor-defined custom functions available - but few users expect or use them. The biggest impact is related to the read/write method of 32-bit data values.
Enron-Modbus defines two special 4x hold register ranges:
- Assume that 4x5001 to 4x5999 are 32-bit long integers (4 bytes per register).
- Assume that 4x7001 to 4x7999 are 32-bit floating points (4 bytes per register).
Handling 32-bit values in Modbus is not unique to Enron-MB. However, Enron-MB takes a controversial step by returning 4 bytes per register, instead of the 2 bytes implied by the term "hold register" in the Modbus specification. This means that polling registers 4x5001 and 4x5002 in Enron-Modbus returns 8 bytes, or two 32-bit integers, while standard Modbus only returns 4 bytes, or one 32-bit integer (considered as two 16-bit integers). Additionally, polling register 4x5010 in Enron-MB returns the tenth 32-bit long integer, while standard Modbus considers the 1/2 of the fifth 32-bit long integer in this range.
5.10. Number of rows
Specify the number of rows in your preferred grid.
6. Real-time chart
Use this command to plot up to 12 data series in real-time in the chart.
Real-time charts are fast and capable of drawing new lines as soon as new data is received.
| All chart settings are stored along with the workspace.Save/open workspace |
To open the real-time chart dialog, you have 2 options:
- Press Alt + R
- Select "Real-time chart" from the display menu

The X-axis displays the seconds since the chart was started.
When the point reaches the end of the chart, there are 3 options:
- Stop at End:The chart stops.
- Restart at End:The chart restarts.
- Continue: Continue,until the maximum number of points is reached or the stop button is pressed.
6.1. Settings
By default, all 12 series are linked to the left Y axis. If you want to link a series to the right Y axis, select the "Right Y Axis" checkbox. Specify
- Color
- for the right Y axis
- Title. If the title is empty, the name in the reading window is used for initialization
- Offset
Display
- File Name
- Address
Offset is useful for aligning data points on the same Y-axis. For example, data points at 0 or 1 can be offset so that they do not plot on top of each other.

6.2. Zoom Function
If you want to view more detailed information, zooming in on the chart can be useful. Zooming is controlled by the left mouse button. To zoom in on a specific part of the chart, simply left-click on the chart (this will be the upper left corner of the zoom rectangle) and drag to the lower right corner. A rectangle will appear. Once you release the mouse button, the axes will automatically adjust to the area you selected.
If you left-click on the chart (for example, to start zooming), but then move to the upper left corner, all modifications made using the zoom and pan functions will be canceled (the chart will be in its original state) before performing the pan and zoom operations.
6.3. Pan Function
To pan the control, right-click somewhere on the control and move the mouse. The point under the mouse will follow the movement of the mouse.
6.4. Link Data to Chart Series
Unless you link Modbus data units to one of the 12 series, the chart does not know which data to use. To do this, select a value cell and then choose "Link to Chart" from Menu → Display.

6.5. Export Series
Save the series data to disk or copy it to the clipboard. Paste the data directly into Excel for further processing.
Despite using a non-comma field separator, the file still has a .csv extension.
Separator:Select the character that separates values in a text file. Use a tab separator when copying/pasting into Excel. Additional information is also provided.
- Points
- Maximum Score
- Minimum Score
- Average Score

7. Address Scan
Scan the address range to obtain a list of all valid addresses in the device. The addresses are read one by one, and the results are displayed in a list format.
| Scanning all 65535 addresses takes some time, depending on the connection type, server device, etc. |
7.1. Export Address Scan
Save address scan data to disk or copy to clipboard. Paste the data directly into Excel for further processing.
Despite using a non-comma field separator, the file still has a .csv extension.
Separator:Select the character that separates values in a text file. Use a tab separator when copying/pasting into Excel.
8. Display Format
Mark the cells to be formatted. Select one of 28 display formats from the display menu.
8.1. Native Modbus Registers
16-bit Modbus registers can be displayed in 4 different modes.
- Sign
- Unsigned
- Hexadecimal
- ASCII - Hexadecimal
- Binary
8.2. 32-bit signed integer
It combines 2 16-bit Modbus registers. It can be displayed in 4 different word/byte orders.
- Signed integer big-endian
- Signed integer little-endian
- Signed integer big-endian byte swap
- Signed integer little-endian byte swap Example byte order:AB CD (big-endian)
Decimal number 123456789 or hexadecimal number07 5B CD 15
The order transmitted over the line in a Modbus message:07 5B CD 15
8.3. 32-bit unsigned integer
It combines 2 16-bit Modbus registers. It can be displayed in 4 different word/byte orders.
- Unsigned integer Big-endian byte swap
- Unsigned integer Little-endian byte swap
- Unsigned integer Big-endian byte swap example byte order:
- Example of little-endian byte-swapping for unsigned integers:AB CD (big-endian)
Decimal number 123456789 or hexadecimal number07 5B CD 15
Order transmitted over the line in Modbus messages:07 5B CD 15
8.4. 64-bit signed integer
It combines four 16-bit Modbus registers. It can be displayed in four different word/byte orders.
- Signed integer big-endian
- Signed integer little-endian
- Signed integer big-endian byte swap
- Signed integer little-endian byte swap Example byte order:AB CD EF GH (big-endian)
Decimal number -1,234,567,890,123,456,789 or hexadecimal numberEE DD EF 0B 82 16 7E EB
Line order in Modbus messages:EE DD EF 0B 82 16 7E EB
8.5. 64-bit unsigned integer
It combines four 16-bit Modbus registers. It can be displayed in four different word/byte orders.
- Unsigned integer Big-endian
- Unsigned integer Little-endian
- Unsigned integer Big-endian Byte Swap
- Unsigned integer Little-endian Byte Swap Example byte order:AB CD EF GH (Big-endian)
Decimal number 1,234,567,890,123,456,789 or hexadecimal number11 22 10 F4
7D E9 81 15 Line sequence in Modbus message:11 22 10 F4 7D E9 81 15
8.6. 32-bit floating point
It combines 2 16-bit Modbus registers. It can be displayed in 4 different word/byte orders.
- Floating-point big-endian
- Floating-point small mantissa
- Floating-point big-endian byte swap
- Floating-point little-endian byte swap Example byte order:AB CD (big-endian)
Floating-point number 123456.00 or hexadecimal47 F1 20 00
Line sequence in Modbus message:47 F1 20 00
8.7. 64-bit double
It combines 4 16-bit Modbus registers. It can be displayed in 4 different word/byte orders.
- Double big mantissa
- Double little-endian
- Double big-endian byte swap
- Double little-endian byte swap Example byte order:AB CD EF GH (big-endian)
Floating-point number 123456789.00 or hexadecimal41 9D 6F 34 54 00 00 00
Line sequence in Modbus messages:41 9D 6F 34 54 00 00 00
9. Save/Open Workspace
If you have many related Modbus windows open, you can easily save a snapshot of the current layout of all open and arranged Modbus windows in a workspace.
The workspace (*mbw) is a file containing the display information and filenames of all open windows. It does not contain the actual content. To do this, go to "File" → "Save Workspace".
Connection and chart settings are stored in the workspace file.
When you open a workspace file, Modbus polling opens all Modbus windows and displays them in the layout you saved.
10. Export to csv
Export the name and value to a comma, semicolon, or tab-delimited value file. Select from the file dialog
- Comma Delimited Value File (*.csv)
"Temperature", "19.7" - Semicolon Delimited Value File (*.csv)
"Temperature"; "19.7" - Tab Delimited Value File (*.txt)
Temperature 19.7
Depending on your system, use commas or periods to separate decimal values.
11. Export to Modbus Slave
Export the name, value, and format to a Modbus Slave file. *.mbs
Requires Modbus Slave version 7.4.0 or higher to open the file.
12. Test Center
The purpose of this test dialog box is to assist MODBUS slave device developers in testing their devices using any string they compose.
The list box displays the data sent and the data received.
Multiple test strings can be added to the drop-down list box. After entering a string, press the "Add to List" button to add it to the list.
When the "Send" button is pressed, the selected string will be sent. Open List
Restore test strings from a file. Save List
Store test strings to a file. Clear
Clear the test list. Add to List
Add the current test string to the list. Add Check
Add CRC or LRC to the end of the input string.
When using the Test Center, you may wish to disable communication from other windows. Select the "Read/Write Disable" checkbox in the "Read/Write Definition" dialog box. Settings → Read/Write Definition.
12.1. ASCII Example
Strings in the combo box: 3A 30 31 30 33 30 30 30 30 30 30 30 41
Strings transmitted when adding LRC: 3A 30 31 30 33 30 30 30 30 30 30 30 41 46 32 0D 0A
CR LF pairs have also been added.
12.2. TCP/IP Example
Read 10 hold registers. 00 00 00 00 00 06 01 03 00 00 00 0A
The first 6 bytes are the TCP/IP header.
12.3. Test Center String File
Using Notepad or a similar text editor, you can prepare the strings to be used in testing.
The first line in the file must be the string "TestCenter". This is how Modbus Poll knows the file format is correct. Press "Open List" to open the prepared text file.
12.3.1. Contents of the String List
Test Center 3A 30 31 30 33 30 30 30 30 30 30 30 41 3A 30 32 30 33 30 30 30 30 30 30 30 41 3A 30 33 30 33 30 30 30 30 30 30 30 41
12.4.
Use the copy button to copy the selected Tx/Rx string to the clipboard.
The SHIFT and CTRL keys can be used in conjunction with the mouse to select and deselect strings, select groups of strings, and select non-contiguous strings.
| Keep this window open while executing other commands. |
13. Modbus Data Logging
You can log data to a text file or directly to Microsoft Excel.
13.1. Text File
Select "Log" from the settings menu or use the shortcut key: Alt+L
Each Modbus window logs to its own separate text file.
When you want to stop data logging, select the logout command on the settings menu.

13.1.1. Logging Rate
Write a log line for every Modbus request per read
. Record the frequency as the scanning rate.
Specify the logging rate (in seconds). It is independent of the scanning rate.
| For example, if the scanning rate is 10000 milliseconds, setting a logging rate of 1 second is meaningless because data will only be logged when it is ready. |
13.1.2. Delimiter
As a delimiter, you can use one of the following options: Fixed width
means that values are organized by column. Comma
values are separated by commas. Tab
values are separated by tabs.
13.1.3. Log only when data changes
Specify to write a new log line only if there is any data change since the last log.
13.1.4. Log errors
Specify to log errors such as timeouts.
13.1.5.
Specify to add the current date to the log time.
13.1.6. Use 'T' as a separator
Specify that the time and date are separated by the letter 'T' as specified in ISO 8601.
13.1.7. Record milliseconds
Specify to add milliseconds to the log time.
13.1.8. Log address
Specify to add the Modbus address to the log.
13.1.9. Start recording when 'OK' is pressed
Specify to start recording when the OK button is pressed. Otherwise, log settings are only stored when the *.mbp file is saved.
13.1.10. Start log when *.mbp is opened
Specify to automatically start logging when a *.mbp file is opened.
13.1.11. Flush to archive immediately
This ensures that log lines are not cached in the file system, but are written physically and immediately.
13.1.12. Append
specifies that the log should be appended to the selected file. Otherwise, a new file will be created.
13.1.13. Midnight New Log File
Closes the current log file and starts a new one at midnight. A timestamp will be added to your file name.
13.1.14. Header Information
- Insert Title:Information is inserted at the top of the log file.
- Name Cell in Top Row:Insert Name.
- Voting Definition:Insert ID, function, etc.
- Name:Name of the inserted log.
Example of a fixed-width text file:22:28:13 <40001> 17395 0 0 0 0 0 0 0 0 22:28:14 <40001> 17396 1 0 0 0 0 0 0 0 22:28:15 <40001> 17394 1 0 0 2 55 0 0 0 22:28:16 <40001> 13350 1 0 0 4 0 0 0 0
You can import data from an Excel spreadsheet.
13.2. Microsoft Excel
This feature requires the installation of Microsoft Excel. Excel 2003 is limited to 65535 logs, as this is the maximum number of rows in an Excel worksheet. Excel 2007 or later versions are limited to 1,048,576 rows. Each Modbus window is logged to its separate Excel worksheet.
Select Excel Log from the Settings menu or use the shortcut key: Alt+X
Do not touch the Excel worksheet while logging, as this will interrupt the logging process.

13.2.1. Logging Rate
- Each read:Write a log line for all Modbus requests. Record the frequency as the scanning rate.
- Selection:Specify the logging rate (in seconds). The logging rate is independent of the scanning rate.
Note:If the scanning rate is 10000ms, setting a logging rate of 1 second is meaningless because data is only logged when it is ready. - Stop Time:Specify the number of log rows. Note that Excel 2003 is limited to 65,536 rows, and Excel 2007 is limited to 1,048,576 rows.
13.2.2. Header Information
- Insert Title:Information is inserted into the top 3 rows of the Excel worksheet.
- Cell Names in Top Row:Insert names in the third row.
- Voting Definition:Insert ID, function, etc. in row 2.
- Name:Insert log name in row 1.

Excel log with header information.
14. Communication Traffic
Select the menu "Display" → "Communication" to display the traffic on the serial line or Ethernet cable. Use the stop button to temporarily stop updating for inspection.
Use the copy button to copy the selected rows to the clipboard.
| This window only displays data sent and received through Modbus Poll. You cannot use it as a data sniffer. |
| Keep this window open while executing other commands. |
15. OLE/Automation
Automation (formerly known as OLE Automation) enables one application to manipulate objects implemented in another application.
An automation client is an application that can manipulate public objects belonging to another application. This is also known as an automation controller.
An automation server is an application that exposes programmable objects to other applications.Modbus Pollis an automation server.
This means that you can use any program that supports VBA (Visual Basic for Applications), such as Visual Basic, Excel, etc., to interpret and display modbus data according to your specific requirements.
15.1. Excel Example
When you want to write a macro, you should display the "Developer" tab or run in developer mode.
15.1.1. Excel 2007

- Click the Microsoft Office Button, and then click "Excel Options".
- Click "Popular", and then select the "Show Developer Tab in the Ribbon" check box.
Note that the ribbon is part of the Microsoft Fluent user interface.
15.1.2. Excel 2010, 2016
- Click the "File" tab.
- Click "Options". The Excel Options window will open.
- Click "Customize Ribbon" in the left pane.
- In the right pane, under "Main Tabs", select the "Developer" checkbox.
- Click "OK". The "Developer" tab should now appear in the ribbon (the rightmost tab).
15.1.3. Excel Sample Code
This example opens two windows. One reads registers, and the other reads coils.
Modbus polling is hidden, but you can display it by uncommenting the "ShowWindow" line. This will show one of the windows.
There is also a sample included in the Modbus polling installation.
Start → All Programs → Modbus Polling → Excel Sample Excel VBA Sample
Public doc1 As Object
Public doc2 As Object
Public app As Object
Dim res As Integer
Dim n As Integer
Private Sub StartModbusPoll_Click()
Set app = CreateObject("Mbpoll.Application")
Set doc1 = CreateObject("Mbpoll.Document")
Set doc2 = CreateObject("Mbpoll.Document")
' Read 10 Holding Registers every 1000ms
res = doc1.ReadHoldingRegisters(1, 0, 10, 1000)
' Read 10 Coil Status every 1000ms
res = doc2.ReadCoils(1, 0, 10, 1000)
' doc1.ShowWindow()
app.Connection = 1 ' Modbus TCP/IP
app.IPAddress = "127.0.0.1" ' local host
app.ServerPort = 502
app.ConnectTimeout = 1000
res = app.OpenConnection()
End Sub
Private Sub Read_Click()
Cells(5, 7) = doc1.ReadResult() 'Show results for the requests
Cells(6, 7) = doc2.ReadResult()
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 Sub15.2. Python Sample
This Python example opens a window and sets all possible data formats. Python Example
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
#Create a Modbus display window called Win1
Win1 = win32.Dispatch("Mbpoll.Document")
# 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)
# Disable refresh for speed
Win1.EnableRefresh = False
# Set all different formats
# This sets how the value is displayed
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)
# Set all Names to used format
Win1.SetName(0, "SIGNED")
Win1.SetName(1, "UNSIGNED")
Win1.SetName(2, "HEX")
Win1.SetName(3, "BINARY")
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")
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()
result = Win1.Save("C:UsersUserNameDesktoptestfile.mbp")
print (result)
print (Win1.GetName(1))
_ = input("Press ENTER to quit:")15.3. Connection Features/Properties
The following properties and features are the same as the settings you have in the Connection Dialog Box (F3).
15.3.1. Contact
to select the required connection. You can choose one of the serial port or Ethernet connections.
PropertyConnectionis valid for integer 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
Connection = 0
15.3.2. Baud Rate
Only applicable to connection = 0
attributeBaudRateas Long valid values
300
600
1200
2400
4800
9600 (default)
14400
19200
38400
56000
57600
115200
128000
153600
230400
256000
460800
921600 example
BaudRate = 9600
15.3.3. Data bits
only applicable to connection = 0
attributeDataBitsvalid values as integer
7
8 (default)
example
DataBits = 8
15.3.4.
Only applicable when connection = 0
PropertyParityValid values as integer
0 = None
1 = Odd
2 = Even (default)
Example
Parity = 2
15.3.5. Stop bits
Only applicable when connection = 0
PropertyStopBitsValid values as integer
1 (Default)
2
Example
StopBits = 1
15.3.6. Serial Port
is only applicable when Connection = 0
PropertySerialPortMode is valid as an integer value
1...255
Default Value = 1 Example
SerialPort = 1
15.3.7. Mode
is only applicable when Connection = 0
PropertyModeis a valid integer value
0 = RTU mode
1 = ASCII mode
Example
Mode = 1
15.3.8. Echo cancellation
is only applicable when Connection = 0
If your device or RS232/RS485 converter echoes the characters just sent.
PropertyRemoveEchoas Integer valid values
0 (default)
1 (echo cancellation)
Example
RemoveEcho = 1
15.3.9. Response Timeout
ResponseTimeout specifies the length of time (in milliseconds) that Modbus polling should wait for a response from a slave device before giving up.
PropertyResponseTimeoutvalid values as an integer
50…100000
Default value = 1000 Example
ResponseTimeout = 1000
15.3.10. Delay between polls
PropertyDelayBetweenPollsvalid values as an Integer
0…1000
Default value = 20 Example
DelayBetweenPolls = 20
15.3.11. Server port
Applicable only to connections = 1…4
The attributeServerPortis valid for Long values
0…65535
Default value = 502 Example
ServerPort = 502
15.3.12. Connection timeout
ConnectTimeout specifies the length of time Modbus polling should wait for a successful TCP/IP connection.
Applicable only to connections = 1…4
The attributeConnectTimeoutis valid for Integer values
100…30000 milliseconds
Default value = 1000 milliseconds Example
ConnectTimeout = 1000
15.3.13. IP version
is only applicable to connections = 1…4
. The attributeIPVersionis valid as an integer value
4 = IP version 4 (default)
6 = IP version 6
. Example
IPVersion = 4
15.3.14. Open connection
opens the connection selected using the 'connection' attribute.
FunctionOpenConnection() takes an integer parameter
. This function has no parameters.
For errors 3-5: Please check if you have installed the latest serial port driver.
| Error | Description |
|---|---|
| 0 | Success |
| 1 | Serial port is not available |
| 3 | Serial port. Unable to obtain current settings from the port driver. |
| 4 | Serial port. The serial port driver does not accept port settings. |
| 5 | Serial port. The serial port driver does not accept timeout settings. |
| 12 | TCP/UDP connection failed. WSA startup |
| 13 | TCP/UDP connection failed. Connection error |
| 14 | TCP/UDP connection failed. Pause |
| 15 | TCP/UDP connection failed. IOCTL |
| TCP/UDP connection failed on port 17. Socket error | TCP/UDP connection failed. Socket error |
| 21 | TCP/UDP connection failed. Address information |
| 255 | Connection is open |
How to open a Modbus TCP/IP connection in Excel example
Public app As Object
Dim res As Integer
' Create an object to Modbus Poll
Set app = CreateObject("Mbpoll.Application")
app.Connection = 1 ' Select Modbus TCP/IP
app.IPVersion = 4
app.IPAddress = "192.168.1.27"
app.ServerPort = 502
app.ConnectTimeout = 1000
app.ResponseTimeout = 1000
res = app.OpenConnection()Python example How to set up a serial connection
import win32com.client as win32
App = win32.Dispatch('Mbpoll.Application')
App.Connection = 0 # Serial connection
App.SerialPort = 3 # Com port 3
App.BaudRate = 9600 # 9600 baud
App.Parity = 0 # None parity
App.Mode = 0 # RTU mode
App.ResponseTimeout = 1000 # Wait 1000ms until give up
App.DelayBetweenPolls = 20 # Ensure minimum 20 ms gap until next request
App.OpenConnection
#Create a Modbus display window called Win1
Win1 = win32.Dispatch("Mbpoll.Document")
# Read 10 holding registers from slave ID 1, address 0 (40001) every 1000ms
Win1.ReadHoldingRegisters(1, 0, 10, 1000)
# Show the Modbus window
Win1.ShowWindow()
# Show 10 rows
Win1.Rows(0)
# Disable refresh for speed
Win1.EnableRefresh = False
# Set the name of the registers
Win1.SetName(0, "Register 0")
# Set the value to write
Win1.EnableRefresh = True
Win1.ResizeAllColumns ()
Win1.ResizeWindow()
_ = input("Press ENTER to quit:")15.3.15. Close connection
FunctionCloseConnection() As Integer parameter
This function has no parameters. Return value
If successful, it returns zero. If failed, it returns a non-zero value.
15.3.16. Display communication traffic
Display the communication traffic window.
FunctionShowCommunicationTraffic() parameter
This function has no parameters. Return value
without any
15.3.17. Close communication traffic
Close the communication traffic window (if displayed).
FunctionCloseCommunicationTraffic() parameter
This function has no parameters. Return value
without any
15.4. Read function
The following functions are the same as those set in the Read/Write Definition dialog box (F8). The read function is associated with the Modbus polling document. (Window with data) Example
' First a Modbus Poll document is needed.
Public doc As Object
Set doc = CreateObject("Mbpoll.Document")
res = doc.ReadCoils(1, 0, 100, 1000) ' Read 100 coils every 1000ms| You must first create a read before you can use the property to obtain data. |
15.4.1. Read Coil
Modbus function code 01
FunctionReadCoils(SlaveID As Integer, Address As Long, Quantity As Integer, ScanRate As Long) As Integer Parameters
SlaveID:Slave address 1 to 255
Address:Data address (base address 0)
Quantity:Number of data. 1 to 2000
Scan Rate:0 to 3600000ms Return value
True if successful. False if unsuccessful
15.4.2. Read Discrete Input
Modbus Function Code 02
FunctionReadDiscreteInputs(SlaveID As Integer, Address As Long, Quantity As Integer, ScanRate As Long) As Integer Parameters
SlaveID:Slave address 1 to 255
Address:Data address (base address 0)
Quantity:Data quantity. 1 to 2000
Scan rate:0 to 3600000ms Return value
True if successful. False if unsuccessful
15.4.3. Read holding register
Modbus function code 03
FunctionReadHoldingRegisters(SlaveID As Integer, Address As Long, Quantity As Integer, ScanRate As Long) As Integer Parameters
SlaveID:Slave address 1 to 255
Address:Data address (base address 0)
Quantity:Number of data. 1 to 125
Scan Rate:0 to 3600000ms Return value
True if successful. False if unsuccessful
15.4.4. Read Input Register
Modbus Function Code 04
FunctionReadInputRegisters(SlaveID As Integer, Address As Long, Quantity As Integer, ScanRate As Long) As Integer Parameters
SlaveID:Slave address 1 to 255
Address:Data address (base address 0)
Quantity:Number of data. 1 to 125
Scan rate:0 to 3600000ms Return value
True if successful. False if unsuccessful
15.5. Automatic write function
The write function writes the values stored in the array filled by the property. The following Write function does not create a data window. To create a data window, use a Win function, such asWriteMultipleRegistersWin.
15.5.1. Write single coil
Modbus function code 05.
Write to the first coil stored in the write array.
FunctionWriteSingleCoil(SlaveID As Integer, Address As Long) As Integer Parameter
SlaveID:Slave Address 0 to 255
Address:Data Address (Base Address 0) Return Value
True if the write array is ready and the data has been sent. False if the array is empty or the parameters are incorrect.
The controlling application is responsible for verifying the write operation by reading back the written value.
15.5.2. Write Single Register
Modbus Function Code 06.
Writes the first register stored in the write array.
FunctionWriteSingleRegister(SlaveID As Integer, Address As Long) As Integer Parameter
SlaveID:Slave address 0 to 255
Address:Data address (base address 0) Return value
True if the write array is ready and the data has been sent. False if the array is empty or the parameters are incorrect.
The controlling application is responsible for verifying the write operation by reading back the written value.
15.5.3. Writing to multiple coils
Modbus function code 15.
Writes the coils stored in the write array.
FunctionWriteMultipleCoils(SlaveID As Integer, Address As Long, Quantity As Integer) As Integer Return value
True if the write array is ready and the data has been sent. False if the array is empty or the parameters are incorrect.
The control application is responsible for verifying write operations by reading back the written values. Parameter
SlaveID:Slave address 0 to 255
Address:Number of data addresses (base address 0) Number of data
. 1 to 1968 years
15.5.4. Writing to multiple registers
Modbus function code 16.
Writes to registers stored in the write array.
FunctionWriteMultipleRegisters(SlaveID As Integer, Address As Long, Quantity As Integer) As Integer Parameter
SlaveID:Slave address 0 to 255
Address:Data address (base address 0)
Quantity:Number of data. 1 to 123 return value
True if the write array is ready and the data has been sent. False if the array is empty or if the parameters are incorrect.
The controlling application is responsible for verifying the write operation by reading back the written values.
15.5.5. Python example
How to create a window that reads 10 registers from address 0 (40001) and then writes 5 registers. Python example
import sys
import time
import win32com.client as win32
App = win32.Dispatch('Mbpoll.Application')
App.Connection = 1 # TCP/IP connection
App.IPAddress = "127.0.0.1"
App.ResponseTimeout = 1000 # Wait 1000ms until give up
App.DelayBetweenPolls = 20 # Ensure minimum 20 ms gap until next request
App.ConnectTimeout = 500 # Wait 500ms until give up
App.ServerPort = 502
result = App.OpenConnection
if result != 0:
print("Connection failed. Error: ", result)
sys.exit()
#Create a Modbus display window called Win1
Win1 = win32.Dispatch("Mbpoll.Document")
# Read 10 holding registers from slave ID 1, address 0 (40001) every 1000ms
Win1.ReadHoldingRegisters(1, 0, 10, 1000)
# Show the Modbus window
Win1.ShowWindow()
# Show 10 rows
Win1.Rows(0)
# Resize the window to fit to the grid
Win1.ResizeWindow()
time.sleep(1.0) # Wait until read is done
if Win1.ReadResult == 0: # Check read result
print("Modbus register 0 (40001) = ", Win1.SRegisters(0))
else:
print("Read failed error: = ", Win1.ReadResult)
print ("Tx count = %d, Rx count = %d" % (Win1.GetTxCount, Win1.GetRxCount))
# Prepare the internal array in Modbus Poll with data to write
Win1.SRegisters(0, 1) # Note that parameter 1 is not a
Win1.SRegisters(1, 10) # Modbus address but an index to the array
Win1.SRegisters(2, 100)
Win1.SRegisters(3, 1000)
Win1.SRegisters(4, 10000)
# Write the registers. This function do not create a window in Modbus Poll
# Use the function <<WriteMultipleRegistersWin>> to create a data window
Win1.WriteMultipleRegisters (1, 0, 5)
_ = input("Wait for write Press ENTER:")
if Win1.WriteResult == 0: # Check write result
print("Modbus write success")
else:
print("Write failed error: = ", WriteResult)
_ = input("Press ENTER to quit:")15.6. Multiple functions
Various functions are associated with the Modbus polling documentation. (Window with data)
15.6.1.
By default, the Modbus document window is hidden. The ShowWindow function makes Modbus Poll visible and displays the document with data content.
FunctionDisplayWindow() Parameters
This function has no parameters. Return Value
None
15.6.2. Get Send Count
Get Request Count.
FunctionGetTxCount() As long as the parameter
This function has no parameters. Return Value
The number of requests.
15.6.3. Get Receive Count
Get Response Count.
FunctionGetRxCount() with parameter
This function has no parameters. Return value
Response Count.
15.6.4. Get Name
Get the name of the value.
FunctionGetName(index is an integer) as string parameter
Index:Index 0 corresponds to the first Modbus address.
Name.
15.6.5. Set Name
Change the name of the value. FunctionSetName(Index is an integer, Name is a string) Parameter
Index:Index 0 corresponds to the first Modbus address.
Name:Name of the value cell. Return value
without any
15.6.6. Fully format
Use the selected format to format all value cells.
FunctionFormatAll(Formatted as Integer) Parameter
Format:The format of the value cell. The return value
does not have any
15.6.7. GetFormat
Gets the display format of the Modbus value.
FunctionGetFormat(Index is Integer) as Integer Parameter
Index:Index 0 corresponds to the first Modbus address.
Return Value
| ID | Format |
|---|---|
| 0 | Sign |
| 1 | Unsigned |
| 2 | Hexadecimal |
| 3 | Binary |
| 4 | Floating-point little-endian byte swap |
| 5 | Floating-point big-endian mantissa |
| 6 | Double little-endian byte swap |
| 7 | Double big-endian |
| 8 | 32-bit signed little-endian byte swap |
| 9 | 32-bit signed big-endian mantissa |
| 10 | Floating-point mantissa |
| 11 | Floating-point big-endian byte swap |
| 12 | Double little-endian mantissa |
| 13 | Double big-endian byte swap |
| 14 | 32-bit signed little-endian |
| 15 | 32-bit signed big-endian byte swap |
| Number 17 | 32-bit unsigned big-endian |
| 18 | 32-bit unsigned little-endian byte swap |
| 19 | 32-bit unsigned big-endian byte swap |
| 20 | 32-bit unsigned little-endian |
| 21 | 64-bit signed big-endian |
| 22 | 64-bit signed little-endian byte swap |
| 23 | 64-bit signed big-endian byte swap |
| 24 | 64-bit signed little-endian |
| 25 | 64-bit unsigned big-endian |
| 26 | 64-bit unsigned little-endian byte swap |
| 27 | 64-bit unsigned big-endian byte swap |
| 28 | 64-bit unsigned little-endian |
| This setting is only for display purposes. When using the Get/Set value functions, you still need to use byteOrder to obtain the correct byte order. |
15.6.8. Set format
Change the display format of Modbus values. Please refer to the format values above.
FunctionSetFormat(index is an integer, format is an integer) parameter
Index:Index 0 corresponds to the first Modbus address.
Format:Format of value cells. The return value
does not have any
15.6.9. Resize window
Resize the opened window to fit the grid.
FunctionResize window() Parameters
This function has no parameters. Return value
does not have any
15.6.10. Resize all columns
Resize all columns to fit the values within the cells.
FunctionAdjust the size of all columns() Parameters
This function has no parameters. Return value
None
15.6.11. Number of rows
Specify the number of rows in the grid.
Functionthat 's ok(NumberRows) Parameters
NumberRows:The number of rows in the grid.
| ID | Description |
|---|---|
| 0 | 10 rows (default) |
| 1 | 20 rows |
| 2 | 50 rows |
| 3 | 100 rows |
| 4 | Suitable quantity |
Return value
No
15.6.12. Reading result
This attribute allows you to check whether the communication established through Read has been successful.
The attribute reads the resultreadas an integer parameter
. This function has no parameters.
| Error | Description |
|---|---|
| 0 | Success |
| 1 | Timeout Error |
| 2 | CRC Error |
| 3 | Response Error (The response is not the expected slave ID, function, or address) |
| 4 | Write Error |
| 5 | Read Error |
| 6 | Port Not Open Error |
| 10 | Data Not Initialized |
| 11 | Insufficient Bytes Received |
| 16 | Byte Count Error |
| 19 | Transaction ID error |
| 81 hours | Illegal function |
| 82 hours | Illegal data address |
| 83 hours | Illegal data value |
| 84 hours | Server equipment failure |
| 85 hours | Acknowledgment |
| 86 hours | Server device is busy |
| 87 hours | NAK - Negative Acknowledgement |
| 8 ampere-hours | Gateway path is unavailable |
| 8Bh | Gateway target device is not responding |
15.6.13. Write result
Use this function to check whether the write was successful.
This value remains DATA_UNINITIALIZED until the result from the slave is available. Refer toReadResultfor a list of possible values.
PropertyWriteResultAs Integer Return Value
Returns the write result as an integer.
15.6.14. Save
Saves the current window. FunctionSave(PathName As String) As Boolean Parameters
PathName:The fully qualified path where the file should be saved. Return Value
Boolean Example
' First a Modbus Poll document is needed.
Public doc As Object
Set doc = CreateObject("Mbpoll.Document")
res = doc.ReadCoils(1, 0, 100, 1000) ' Read 100 coils every 1000ms
res = doc.Save("C:UsersUserNameDesktoptestfile.mbp")15.7. Automation Data Properties
The following properties are used to set or get values in the internal write/read array in Modbus Poll. The index used is not a Modbus address. The index always starts counting from 0, regardless of the address used. The data properties are associated with the Modbus polling document. (Window with data)
Each data property has 2 versions:
- One without a suffix, for exampleSRegistersis used for setting or getting values from internal write/read arrays.
- is a type with "Win" as a suffix, such asSRegistersWin, used for directly setting or getting values from the data window. This function is used when the data window is used for writing functions (such asWriteMultipleRegistersWin).
Example 1:
' 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.
Example 2 using floating-point values:
Write 3 floating-point values.
' 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 for writing 3 registers.
' 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
15.7.1. Coil, CoilWin
PropertyCoil(Index is an integer) describes an integer.
sets a coil in the write array structure or returns a coil from the read array. Syntax
coil(Index) [=New Value]
15.7.2. SRegisters, SRegistersWin
attributeSRegisters(Index is an integer) describes an integer.
sets a register in the write array structure or returns a register from the read array. Syntax
SRegisters(Index) [=New Value]
15.7.3. URegisters, URegistersWin
attributeURegisters(Index is an integer) simply describes
Set a register in the write array structure or return a register from the read array. Syntax
URegisters(Index) [= New Value]
15.7.4. Ints_32, Ints_32Win
attributeInts_32(index is an integer) is described as Double
Set a 32-bit integer in the write array structure or return an integer from the read array. Syntax
Ints_32(Index) [= New Value]
15.7.5. UInts_32, UInts_32Win
attributeUInts_32(Index is an integer) is a Double description
to set a 32-bit unsigned integer in the write array structure, or return an unsigned integer from the read array. Syntax
UInts_32(Index) [= New Value]
15.7.6. Ints_64, Ints_64Win
attributeInts_64(Index is an integer) is a Double description
to set a 64-bit integer in the write array structure, or return an integer from the read array. Syntax
Ints_64(Index) [= New Value]
15.7.7. UInts_64, UInts_64Win
AttributeUInts_64(Index is Integer) is a Double description
to set a 64-bit unsigned integer in the write array structure, or return an unsigned integer from the read array. Syntax
UInts_64(Index) [=New Value]
15.7.8. Carriage, carriage wins
AttributeFloat(Index is Integer) is a single description
to set a floating-point number in the write array structure or return a floating-point number from the read array. Syntax
Floating-point Number(Index) [=New Value]
15.7.9. Double, Double Win
AttributeDouble Precision(Index is Integer) describes the double precision value. Syntax
Set double precision values in the write array structure or return double precision values from the read array.
Double(Index) [=New Value]
15.7.10. Byte Order
AttributeByteOrderdescribes the byte order used by the Ints_32, UInts_32, Ints_64, UInts_64, Floats, and Doubles attributes as an integer.
Set the byte order used by the Ints_32, UInts_32, Ints_64, UInts_64, Floats, and Doubles properties.
This attribute is not used in the Win versionByteOrder.
| ID | Byte order |
|---|---|
| 0 | Big-endian (default) |
| 1 | Little-endian byte swap |
| 2 | Big-endian byte swap |
| 3 | Little-endian method |
Ints_32 Example:
Byte order: Big-endian
Decimal number 123456789 or hexadecimal number 07 5B CD 15
Order transmitted over the line in Modbus messages: 07 5B CD 15 Syntax
Byte order[=New value]
15.8. Write Function (Create Data Window)
The following functions are the same as those set in the Read/Write Definition Dialog Box (F8).
This function creates a data window and writes data content into it according to the scan rate.
15.8.1. Write Single Coil Win
Modbus function code 05.
FunctionWriteSingleCoilWin(SlaveID As Integer, Address As Long, ScanRate As Long) As Integer Parameters
SlaveID:Slave address 1 to 255
Address:Data address (Base 0)
Scan rate:0 to 3600000ms return value
True if successful. False if not successful
15.8.2. Write single register Win
Modbus function code 06.
FunctionWriteSingleRegisterWin(SlaveID As Integer, Address As Long, ScanRate As Long) As Integer Parameters
SlaveID:Slave address 1 to 255
Address:Data address (Base 0)
Scan rate:0 to 3600000ms return value
If successful, it is true. If not successful, it is false. Python example: How to open a window and write to a register every 1000 milliseconds
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
#Create a Modbus display window called Win1
Win1 = win32.Dispatch("Mbpoll.Document")
# Write 1 holding registers to slave ID 1, address 0 (40001) every 1000 ms
Win1.WriteSingleRegisterWin(1, 0, 1000)
# Show the Modbus window
Win1.ShowWindow()
# Fit rows to quantity
Win1.Rows(4)
# Disable refresh for speed
Win1.EnableRefresh = False
# This sets how the value is displayed
Win1.SetFormat(0, SIGNED)
# Set the Name of the register
Win1.SetName(0, "Setting")
# Set the value to write
Win1.SRegistersWin(0, 100)
Win1.EnableRefresh = True
Win1.ResizeAllColumns ()
Win1.ResizeWindow()
_ = input("Press ENTER to quit:")15.8.3. Write to multiple coils with Win
Modbus function code 15.
FunctionWriteMultipleCoilsWin(SlaveID As Integer, Address As Long, Quantity As Integer, ScanRate As Long) As Integer Parameters
SlaveID:Slave address from 1 to 255
Address:Data address (base address 0)
Quantity:Number of data. 1 to 1968
Scan rate:0 to 3600000ms return value
True if successful. False if not successful
15.8.4. Write multiple registers Win
Modbus function code 16.
FunctionWriteMultipleRegistersWin(SlaveID As Integer, Address As Long, Quantity As Integer, ScanRate As Long) As Integer Parameters
SlaveID:Slave address 1 to 255
Address:Data address (base address 0)
Quantity:Number of data. 1 to 123
Scan Rate:0 to 3600000ms Return Value
True if successful. False if unsuccessful
16. Exceptions and Error Messages
Modbus exceptions and error messages are displayed in red text on the second line of each window.

16.1. Modbus Exception Codes
Modbus exceptions are errors returned from the slave device.
| Code | Name | Meaning |
|---|---|---|
| 01 | Illegal Function | The function code received in the query is not an operation allowed by the server (or slave). This may be because the function code is only applicable to newer devices and is not implemented in the selected device. It may also indicate that the server (or slave device) is in an error state when processing such requests, for example, because it is not configured and is being asked to return register values. |
| 02 | Illegal Data Address | The data address received during the query is not permitted by the server. More specifically, the combination of the reference number and transmission length is invalid. For a controller with 100 registers, the PDU addresses the first register as 0 and the last register as 99. If the submitted request starts with a register address of 96 and has a register count of 4, the request will successfully operate (at least by address) on registers 96, 97, 98, and 99. If the submitted request starts with a register address of 96 and has a register count of 5, the request will fail with an exception code 0x02 "Illegal Data Address" because it attempts to operate on registers 96, 97, 98, 99, and 100, but there is no register with an address of 100. |
| 03 | Illegal Data Value | The value contained in the query data field is not permitted by the server (or slave). This indicates an error in the structure of the remaining part of the complex request, such as an incorrect implied length. Specifically, this does not mean that the data item submitted to be stored in the register has a value other than what the application expected, because the MODBUS protocol does not know the significance of any specific value for any specific register. |
| 04 | Server Device Failure | An unrecoverable error occurred when the server (or slave) attempted to perform the requested operation. |
| 05 | Acknowledged | Specifically used in conjunction with programming commands. The server (or slave) has accepted the request and is processing it, but it will take a long time to complete. This response is returned to prevent timeout errors on the client (or host). The client (or host) can then issue a poll program completion message to determine whether processing is complete. |
| 06 | Server Device Busy | Specifically used in conjunction with programming commands. The server (or slave) is processing a long-running program command. |
| 0A | Gateway path unavailable | Specifically used in conjunction with the gateway, indicating that the gateway cannot allocate an internal communication path from the input port to the output port to process the request. Usually means that the gateway is misconfigured or overloaded. |
| 0B | Gateway target device response failure | Specifically used in conjunction with the gateway, indicating that no response was received from the target device. Usually means that the device does not exist on the network. |
16.2. Modbus polling error messages
| Error message | Meaning |
|---|---|
| Timeout error | No reply received within the expected time. Check the following: Serial connection settings, such as baud rate, parity, data bits, stop bits, etc. Modbus mode, RTU or ASCII Slave ID response timeout TCP/IP connection response timeout Check if Host and Port are consistent with the slave |
| Response error | The response is not as expected. Different slave ID. |
| CRC error | The CRC value of the received response is incorrect. |
| Write error | This is an error reported by the serial driver. This may occur if a USB/RS232/485 converter is used and the USB cable is unplugged. There are 4 types: Interrupt condition Input/output error Serial connection error Output buffer overflow Write error using TCP/IP connection is usually caused by a lost connection. |
| Read error | This is an error reported by the serial driver. There are 6 types: Framing error Character buffer overflow Parity error Input buffer overflow Input/output error Interrupt condition Read error using TCP/IP connection is usually caused by a lost connection. |
| Insufficient bytes received | The length of the response is not as expected. |
| Byte count error | The byte count in the response is incorrect compared to expectations. |
| Transaction ID error | It is used for transaction pairing, where the MODBUS server replicates the transaction identifier of the request in the response. |
好
11
1