Modbus Poll User's Manual
Modbus Poll User's Manual
September 2012
Modbus Poll version 5.5
Copyright: Witte Software, 2002 -2012
http://www.modbustools.com
Table of content
1
2
7
8
http://www.modbustools.com
8.1
ASCII Example .................................................................................................................................. 18
8.2
TCP/IP Example................................................................................................................................ 18
8.3
Test center string file ....................................................................................................................... 18
8.3.1
Content of a string list ............................................................................................................. 18
8.4
Copy ................................................................................................................................................. 18
9 Modbus Data logging............................................................................................................................... 19
9.1
Text file ............................................................................................................................................ 19
9.1.1
Log Rate ................................................................................................................................... 19
9.1.2
Delimiters ................................................................................................................................ 19
9.1.3
Log if data changed only .......................................................................................................... 19
9.1.4
Log Errors ................................................................................................................................. 19
9.1.5
Log Date ................................................................................................................................... 20
9.1.6
Start Log when ok is pressed ................................................................................................... 20
9.1.7
Start Log when *mbp is opened .............................................................................................. 20
9.1.8
Flush to file immediately ......................................................................................................... 20
9.1.9
Append .................................................................................................................................... 20
9.2
Microsoft Excel ................................................................................................................................ 21
9.2.1
Log Rate ................................................................................................................................... 21
9.2.2
Header information ................................................................................................................. 21
10 Communication traffic ............................................................................................................................. 23
11 OLE/Automation ...................................................................................................................................... 24
11.1 Excel example .................................................................................................................................. 24
11.1.1 Excel sample code.................................................................................................................... 24
11.2 Setup Functions ............................................................................................................................... 26
11.2.1 CreateRequest ......................................................................................................................... 26
11.2.2 ShowWindow........................................................................................................................... 26
11.2.3 DisplayFormat .......................................................................................................................... 26
11.2.4 ReadResult ............................................................................................................................... 27
11.2.5 WriteResult .............................................................................................................................. 27
12 Exception and error messages ................................................................................................................ 28
12.1 Modbus Exceptions ......................................................................................................................... 28
12.2 Modbus Poll error messages ........................................................................................................... 29
http://www.modbustools.com
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.
Automation engineers that need to test Modbus devices or networks on site.
Service engineers that want to read out and/or change specific service data from a device.
Change Modbus registers in a slave device.
Log data from Modbus devices.
http://www.modbustools.com
http://www.modbustools.com
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 address 4000 (44001) and
another reading 10 Holding registers from address 2000 (42001).
http://www.modbustools.com
http://www.modbustools.com
Press
http://www.modbustools.com
4 Connection dialog
To open the connection dialog you have 2 options:
Press F3
Select connect from the connection menu
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.
4. Modbus RTU/ASCII over TCP/IP:
This is a RTU or ASCII message send over a TCP/IP network instead of serial lines.
5. Modbus RTU/ASCII over UDP/IP:
This is a RTU or ASCII message send over a UDP/IP network instead of serial lines.
http://www.modbustools.com
Note: Connection type 3-5 is not standard Modbus as specified by www.modbus.org but they are
added for convenience.
Depending on your selection some other settings will be grayed.
4.3 Mode
Use this option to select RTU or ASCII mode. Default RTU.
4.7.2 DSR
DSR specify 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. Enable DTR handshaking
http://www.modbustools.com
10
4.7.3 CTS
CTS specify 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.
The DTR will be enabled whenever the port is opened and disabled when the port is closed.
http://www.modbustools.com
11
5 Read/Write definition
Use this command to define the data to be monitored for the active window.
To open the Read/Write Definition dialog you have 2 options:
Press F8
Select Read/Write Definition from the Setup menu
Press
5.1 Slave ID
Range 1 to 255. (MODBUS protocol specifications say 247 but some devices may use extended range 248 to
255). The value 0 is also accepted to communicate directly to a MODBUS/TCP or MODBUS/UDP device.
http://www.modbustools.com
12
(3x)
5.3 Address
Addresses in the Modbus protocol are confusing! Some protocol specifications use the protocol/message
address and other use device addressing.
http://www.modbustools.com
13
If 'Read/Write' is disabled you can make single requests with the Read/Write Once button or press F6.
http://www.modbustools.com
14
5.10 Rows
Specify the number of rows in the grid you prefer.
http://www.modbustools.com
15
6 Display formats
Select one of the 16 display formats from the display menu.
Example:
Byte Order: AB CD
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
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
Example:
Byte Order: AB CD EF GH
The floating point number 123456789.00 or in hexadecimal 41 9D 6F 34 54 00 00 00
Order as they come over the wire in a Modbus message: 41 9D 6F 34 54 00 00 00
http://www.modbustools.com
16
7 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 just 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.
http://www.modbustools.com
17
8 Test center
The purpose of this test dialog is to help MODBUS slave device developers to test the device with any string
of their own composition.
The list box displays the transmitted data as well as the received data.
You can have several test strings in the pull down list box. When you have entered a string then press the
"Add to List" button then the string is added to the list.
The selected string is send when the "Send" button is pressed.
With the "Save list" button you can store the strings in a text file.
Check the "Add Check check box if you want to 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.
8.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.
http://www.modbustools.com
18
Each read: Write a log line for all Modbus requests. Log frequency as scan rate.
Select: Specify the log rate in seconds. 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 are logged
only when new data are ready.
9.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.
http://www.modbustools.com
19
9.1.9 Append
Specify that logs are appended to selected file. Otherwise a new file is created.
Example of a text file with fixed width:
22:28:13
22:28:14
22:28:15
22:28:16
<40001>
<40001>
<40001>
<40001>
17395
17396
17394
13350
0
1
1
1
0
0
0
0
0
0
0
0
0
0
2
4
0
0
55
0
0
0
0
0
0
0
0
0
0
0
0
0
http://www.modbustools.com
20
Each read: Write a log line for all Modbus requests. Log frequency as scan rate.
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 are logged
only when new data are ready.
Stop after: Specify the number of log lines
Insert header: Information is inserted in the top most 3 lines in the Excel sheet.
o Alias cells in top row: Insert alias names in row 3.
o Poll definition: Insert ID, Function etc. in row 2.
o Name: Insert a log name in row 1.
http://www.modbustools.com
21
http://www.modbustools.com
22
10 Communication traffic
Select the menu Display->Communication to show the traffic on the serial line or Ethernet cable. Use the
stop button to temporary stop the update for inspection.
Use the copy button to copy selected line to the clipboard.
Note:
This window show only data sent and received by Modbus Poll. You cant use it as a data sniffer.
Hint:
Leave this window open while doing other commands.
http://www.modbustools.com
23
11 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 Automation such as Visual Basic, Excel etc. to interpret
and show the MODBUS data according to your specific requirements.
Hint:
You should enable the auto connection in the connection menu in order to establish a connection when
Modbus Poll is started by a client.
11.1.1
Excel 2007
11.1.2
1.
2.
3.
4.
5.
Excel 2010
11.1.3
http://www.modbustools.com
24
Check = True
WriteValues.Enabled = True 'Enable the buttons
WriteCoils.Enabled = True
End Sub
Private Sub Read_Click()
If Check Then
Cells(5, 7) = m_svr1.ReadResult 'Show results for the requests
Cells(6, 7) = m_svr2.ReadResult
For n = 0 To 9
Cells(5 + n, 2) = m_svr1.Register(n)
Next n
For n = 0 To 9
Cells(18 + n, 2) = m_svr2.Coil(n)
Next n
Cells(7, 7) = m_svr1.WriteResult
End If
End Sub
Private Sub WriteCoils_Click()
For n = 0 To 9
m_svr2.Coil(n) = Cells(18 + n, 3)
Next n
status = m_svr2.ForceMultipleCoils(1, 9, 10)
End Sub
Private Sub WriteValues_Click()
For n = 0 To 9
m_svr1.Register(n) = Cells(5 + n, 3)
Next n
status = m_svr1.PresetMultipleRegisters(1, 0, 10)
End Sub
http://www.modbustools.com
25
CreateRequest
11.2.2
ShowWindow
Sub ShowWindow()
Call this function if you want the window to be shown in Modbus Poll. If ShowWindow is not
called the Modbus Poll window is not visible.
11.2.3
DisplayFormat
Specify the display format. Same formats as you find in the Display menu.
DisplayFormat As Long
Values
0 = DISPLAY SIGNED
1 = DISPLAY UNSIGNED
2 = DISPLAY HEX
3 = DISPLAY BINARY
4 = DISPLAY FLOAT CD AB
5 = DISPLAY FLOAT AB CD
6 = DISPLAY DOUBLE GH EF CD AB
7 = DISPLAY DOUBLE AB CD EF GH
8 = DISPLAY INT CD AB
9 = DISPLAY INT AB CD
10 = DISPLAY FLOAT DC BA
11 = DISPLAY FLOAT BA DC
12 = DISPLAY DOUBLE HG FE DC BA
13 = DISPLAY DOUBLE BA DC FE HG
http://www.modbustools.com
26
14 = DISPLAY INT DC BA
15 = DISPLAY INT BA DC
11.2.4
ReadResult
Use this property to check if communication established with CreateRequest is running successful.
11.2.5
WriteResult
http://www.modbustools.com
27
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.
The data address received in the query is not an allowable address for the
server (or slave). More specifically, the combination of reference number and
transfer length is invalid. For a controller with 100 registers, a request with
offset 96 and length 4 would succeeds, a request with offset 96 and length 5 will
generate exception 02.
A value contained in the query data field is not an allowable value for 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.
An unrecoverable error occurred while the server (or slave) was attempting to
perform the requested action.
Specialized use in conjunction with programming commands. The server (or
slave) has accepted the request and is processing it, but a long duration of time
will be required to do so. This response is returned to prevent a timeout error
from occurring in the client (or master). The client (or master) can next issue a
Poll Program Complete message to determine if processing is completed.
Specialized use in conjunction with programming commands. The server (or
slave) is engaged in processing a longduration program command. The client
(or master) should retransmit the message later when the server (or slave) is
free.
http://www.modbustools.com
28
Response Error
CRC Error
Write Error
Read Error
Insufficient bytes
received
Byte count error
http://www.modbustools.com
29