You should carefully read the following terms and conditions before using Modbus Poll. 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 cease using this software immediately. Show
Copyright. Evaluation and Registration. 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. For information on order and pricing, please visit https://www.modbustools.com/order.html 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. Distribution. LIMITED WARRANTY. LIMITATION ON DAMAGES. 2. Modbus Poll Features2.1. ConnectionsModbus Poll read/write data from devices using:
2.2. Supported Modbus Functions
2.3. Data logging
2.4. Display formatsEach cell can be individual formatted.
2.5. Miscellaneous features
3. OverviewModbus 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. 3.1. Help from anywherePress F1 and get context sensitive help on a topic associated with the current selected item. 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. 3.2. Name cellsHere you can type any text for designation of the value cells. You can also copy/paste text from Excel cells. 3.3. Value cellsShow the data values of the Modbus registers. If you double click a value cell a dialog box lets you write a new value to the slave device. Typing a number in a value cell shows the dialog as well. It is possible to select the used Modbus function used to write the value. 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. 3.4. Change fontTo change the font you have 2 options
3.5. Conditional colorsConditional colors help you visually show values in specific ranges. 3 color options
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. 3.5.1. Color exampleGreen color if the cell value is between 398 and 402 3.6. ScalingScaling helps you scale raw values to human readable values. Scaling works only for signed and unsigned 16/32 bit integers. (X1,Y1) and (X2,Y2) A line passing through the two points (X1,Y1) and (X2,Y2) \$Slope = m = (Y2 - Y1) / (X2 - X1)\$ Line equation \$Y = m * (X - X1) + Y1\$ PrecisionNumber of digits after the decimal point. EnableMust 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. 3.7. Real time chartingThe chart can plot 12 series in real time with up to 100000 points in each series. 3.8. Address ScanScan an address range for a list of all valid addresses in a device. 3.9. Open a new windowTo open another window you have 3 options:
4. Connection dialogTo open the connection dialog you have 2 options:
4.1. ConnectionThere are 5 different connection types:
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.2. Serial SettingsUse these parameters to set serial port settings. They are only available if the connection type is "Serial Port". Mode Use this option to select RTU or ASCII mode. Default RTU. Response timeoutSpecifies the length of time that Modbus Poll should wait for a response from a slave device before giving up. Default is 1000ms. Min delay between pollsThis setting ensures a minimum delay until the next request is transmitted no matter the scan rate. The resolution of this setting is approximately 15ms. It’s possible on some computers to obtain better resolution but not all.
4.3. Remote ServerRemote server settings are only available when using an Ethernet connection. IP Address Servers IP address. Default is localhost 127.0.0.1 PortServer port number. Default 502 Connect TimeoutMax time to use to establish a connection. Default 1000 4.4. Advanced settingsRTS Toggle RTS Toggle specifies that the RTS line will be high if bytes are available for transmission. After all buffered bytes have been sent, the RTS line will be low. 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. CTSCTS 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. DTRDTR specifies whether the DTR will be enabled or disabled whenever the port is opened. Remove EchoIf your device or RS232/RS485 converter echoes the chars just sent. 5. Read/Write definitionUse this command to define the data to be monitored for the active window. To open the Read/Write Definition dialog you have 3 options:
5.1. Slave IDRange 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. 5.2. Function codeYou can select 1 of 8 function codes. 5.2.1. Read functionsThe data returned by the read functions are displayed on the grid window.
5.2.2. Write functionsThe write functions write the data displayed on the grid window.
5.3. AddressAddresses in the Modbus protocol are confusing! Some protocol specifications use the protocol/message address and others use device addressing. 5.3.1. Protocol/message addressSome protocol specifications use the protocol/message address counting from 0 to 65535 along with a function code. This is also what the new Modbus specifications use. This is the address inside the message sent on the wire. Modbus Poll use protocol/message address counting from 0 to 65535. 5.3.2. Device addressSome protocol specifications use device address/registers. Registers counts from 1. The first digit describes the function to be used. That means the device address 40101 is identified by address 100. The "4" means Holding registers and 4x registers counts from 1. And even more confusing: 4x means function code 03 and 3x means function code 04! 5.3.3. 5 digits vs. 6 digits addressingThe address format 4x counts from 40001 to 49999. The next address is not 50000. In the old days 9999 addresses was enough. There are cases where 9999 is not enough. Then a zero is added. 40101 becomes 400101 and so on. This is called 6 digits addressing or extended 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. 5.3.4. Address examplesThese examples show how to set up Modbus Poll if a specification uses device addresses. Read Holding RegistersYou want to read 20 registers from device address 40011 from slave ID 2 every 1000ms. From the "4" we know this is function 03 "Read Holding Registers".
Read Discrete InputsYou want to read 1000 coils from address 110201 from slave ID 5 every 500ms. From the "1" we know this is function 02 "Read Discrete Inputs"
5.4. ScanrateThe 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). 5.5. Read/Write DisabledThe "Read/Write Disabled" checkbox can be used to temporary enable or disable the communication for this window. A text (Disabled) is then shown along with the Tx and Error counters.
5.5.1. Disable on errorDisable Read/Write in case of error. 5.6. Hide name columnsHide all name columns. This is convenient to make more space if they are not used. 5.7. Address in cellIf enabled, the address is also shown in the value cell like: 2000 = 00000 5.8. PLC Addresses (Base 1)This option will show the addresses as device addresses. 5.9. Enron/Daniel ModeEnron or Enron/Daniels Modbus is Standard Modbus with a few "Vendor Extensions". The exact impact of these extensions is context dependent, but most common Modbus commands work as expected. There are some custom vendor-defined functions available - but few users expect or use them. The largest impact has to do with how 32-bit data values are read/written. Enron-Modbus defines two special 4x holding register ranges:
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. RowsSpecify the number of rows in the grid you prefer. 6. Real time ChartingUse this command to plot up to 12 data series in a chart in real time. All chart settings are stored with workspace. To open the Real time charting dialog you have 2 options:
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:
6.1. SettingsBy 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
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. 6.2. Zoom functionZooming 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). 6.3. Pan functionTo 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 the chart seriesThe chart doesn’t know which data to use unless you link a Modbus data cell to one of the 12 series. To do so select a value cell and from Menu→Display select "Link to Chart". 6.5. Export seriesSave series data to disk or copy to clipboard. Paste the data direct in Excel for further processing. Delimiters: Select the character that separates values in your text file. Use tab delimiter when copy/paste to Excel. Furthermore some additional information is given.
7. Address ScanScan an address range for a list of all valid addresses in a device. Addresses are read one by one and the read result is shown in a list. Scanning all 65535 addresses takes some time depending on connection type, server device etc. 7.1. Export Address ScanSave Address Scan data to disk or copy to clipboard. Paste the data direct in Excel for further processing. Delimiters: Select the character that separates values in your text file. Use tab delimiter when copy/paste to Excel. 8. Display formatsMark the cells to be formatted. Select one of the 28 display formats from the display menu. 8.1. Native Modbus registersThe 16-bit Modbus registers can be displayed in 4 different modes.
8.2. 32-bit signed integerThis combines 2 16-bit Modbus registers. It can be displayed in 4 different word/byte orders.
8.3. 32-bit unsigned integerThis combines 2 16-bit Modbus registers. It can be displayed in 4 different word/byte orders.
8.4. 64-bit signed integerThis combines 4 16-bit Modbus registers. It can be displayed in 4 different word/byte orders.
8.5. 64-bit unsigned integerThis combines 4 16-bit Modbus registers. It can be displayed in 4 different word/byte orders.
8.6. 32-bit floatingThis combines 2 16-bit Modbus registers. It can be displayed in 4 different word/byte orders.
8.7. 64-bit doubleThis combines 4 16-bit Modbus registers. It can be displayed in 4 different word/byte orders.
9. Save/Open WorkspaceIf 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. 10. Export to csvExport names and values to a Comma, Semicolon or Tab Separated Values File. Select from the file dialog
Depending on your system, comma or period is used to separate decimals. 11. Export to Modbus SlaveExport names, values and formatting to a Modbus Slave file. *.mbs Modbus Slave version 7.4.0 or newer is required to open the file. 12. Test centerThe purpose of this test dialog is to help MODBUS slave device developers to test the device with any string of their own composition. Open list Rest test strings from a file. Save listStore the test strings to a file. ClearClear the test list. Add to listAdd the current test string to the list. Add CheckAdd 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. 12.1. ASCII ExampleString in the combo box: 3A 30 31 30 33 30 30 30 30 30 30 30 41 The transmitted string if LRC is added 3A 30 31 30 33 30 30 30 30 30 30 30 41 46 32 0D 0A A CR LF pair is also added. 12.2. TCP/IP ExampleRead 10 holding 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 fileWith a text editor such as notepad or similar you can prepare strings to be used in the test. 12.3.1. Content of a string listTestCenter 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. CopyUse the Copy button to copy selected Tx/Rx strings to the clipboard. Leave this window open while doing other commands. 13. Modbus Data loggingYou can log data to either a text file or direct to Microsoft Excel. 13.1. Text fileSelect Log from the setup menu or use shortcut keys: Alt+L Each Modbus Window logs to its individual text file. When you want to stop the data logging then select the logging off command on the setup menu. 13.1.1. Log RateEach read Write a logline for all Modbus requests. Log frequency as scan rate. SelectSpecify the log rate in seconds. Independent of scan rate. 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. 13.1.2. DelimitersAs delimiter you can use one of following options: Fixed width Means that the values are organized in columns. CommaValues separated by a comma. TabValues separated by a tab. 13.1.3. Log if data changed onlySpecify that a new log line is written only if any data is changed since last log. 13.1.4. Log ErrorsSpecify that errors such a timeout etc. are logged. 13.1.5. Log DateSpecify that the current date is added to the log time. 13.1.6. Use "T" as delimiterSpecify that the time and date is delimited by the letter "T" as specified in ISO 8601. 13.1.7. Log msSpecify that milliseconds are added to the log time. 13.1.8. Log addressSpecify that the Modbus Address is added to the log. 13.1.9. Start Log when ok is pressedSpecify that logging is started when the ok button is pressed. Otherwise the log setup is just stored when *mbp file is saved. 13.1.10. Start Log when *mbp is openedSpecify that logging is automatically started when a *.mbp file is opened. 13.1.11. Flush to file immediatelyThis ensures that log lines are not cashed in the file system but physically written immediately. 13.1.12. AppendSpecify that logs are appended to the selected file. Otherwise a new file is created. 13.1.13. New log file at midnightClose the current log file and start a new file at midnight. A time stamp is added to your filename. 13.1.14. Header information
Example of a text file with fixed width: 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 the data in an Excel spreadsheet. 13.2. Microsoft ExcelThis feature requires that Microsoft Excel is installed. Excel 2003 log is limited to 65535 logs as this is the max number of rows in an Excel sheet. Excel 2007 or newer is limited to 1,048,576 rows. Each Modbus Window logs to its individual Excel sheet. 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. 13.2.1. Log Rate
13.2.2. Header information
Excel log with header information. 14. Communication trafficSelect 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 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. Leave this window open while doing other commands. 15. OLE/AutomationAutomation (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. 15.1. Excel exampleYou should display the Developer tab or run in developer mode when you want to write macros. 15.1.1. Excel 2007
15.1.2. Excel 2010, 2016
15.1.3. Excel sample codeThis example opens two windows. One reading registers and another reading Coils. An example is also included with the Modbus Poll installation. Excel VBA Example
15.2. Python exampleThis Python example opens a window and set all possible data formats. Python Example
15.3. Connection Functions/PropertiesThe following properties and functions do the same as you setup in the connection dialog (F3). 15.3.1. ConnectionConnection selects the desired connection. A serial port or one of the Ethernet connections can be selected. Property Connection as Integer Valid values 0 = Serial port Example
15.3.2. BaudRateApplicable only for Connection = 0 Property BaudRate as Long Valid values 300 Example
15.3.3. DataBitsApplicable only for Connection = 0 Property DataBits as Integer Valid values 7 Example
15.3.4. ParityApplicable only for Connection = 0 Property Parity as Integer Valid values 0 = None Example 3A 30 31 30 33 30 30 30 30 30 30 30 41 46 32 0D 0A0 15.3.5. StopBitsApplicable only for Connection = 0 Property StopBits as Integer Valid values 1 (Default) Example 3A 30 31 30 33 30 30 30 30 30 30 30 41 46 32 0D 0A1 15.3.6. SerialPortApplicable only for Connection = 0 Property SerialPort as Integer Valid values 1…255 Default value = 1 Example 3A 30 31 30 33 30 30 30 30 30 30 30 41 46 32 0D 0A2 15.3.7. ModeApplicable only for Connection = 0 Property Mode as Integer Valid values 0 = RTU Mode Example 3A 30 31 30 33 30 30 30 30 30 30 30 41 46 32 0D 0A3 15.3.8. RemoveEchoApplicable only for Connection = 0 Property RemoveEcho as Integer Valid values 0 (Default) Example 3A 30 31 30 33 30 30 30 30 30 30 30 41 46 32 0D 0A4 15.3.9. ResponseTimeoutThe ResponseTimeout specifies the length of time in ms that Modbus Poll should wait for a response from a slave device before giving up. Property ResponseTimeout as Integer Valid values 50…100000 Default value = 1000 Example 3A 30 31 30 33 30 30 30 30 30 30 30 41 46 32 0D 0A5 15.3.10. DelayBetweenPollsProperty DelayBetweenPolls as Integer Valid values 0…1000 Default value = 20 Example 3A 30 31 30 33 30 30 30 30 30 30 30 41 46 32 0D 0A6 15.3.11. ServerPortApplicable only for Connection = 1…4 Property ServerPort as Long Valid values 0…65535 Default value = 502 Example 3A 30 31 30 33 30 30 30 30 30 30 30 41 46 32 0D 0A7 15.3.12. ConnectTimeoutThe ConnectTimeout specifies the length of time that Modbus Poll should wait for a TCP/IP connection to succeed. Applicable only for Connection = 1…4 Property ConnectTimeout as Integer Valid values 100…30000ms Default value = 1000ms Example 3A 30 31 30 33 30 30 30 30 30 30 30 41 46 32 0D 0A8 15.3.13. IPVersionApplicable only for Connection = 1…4 Property IPVersion as Integer Valid values 4 = IP Version 4 (Default) Example 3A 30 31 30 33 30 30 30 30 30 30 30 41 46 32 0D 0A9 15.3.14. OpenConnectionOpens the connection selected with the Connection property. Function OpenConnection() As Integer Parameters This function has no parameters. Return valueFor error 3-5: Please check if you have the latest serial port driver. ErrorDescription0 SUCCESS 1 Serial Port not available 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. 12 TCP/UDP Connection failed. WSA start up 13 TCP/UDP Connection failed. Connect error 14 TCP/UDP Connection failed. Timeout 15 TCP/UDP Connection failed. IOCTL 17 TCP/UDP Connection failed. Socket error 21 TCP/UDP Connection failed. Address information 255 Connection already open Excel example how to open a Modbus TCP/IP connection 00 00 00 00 00 06 01 03 00 00 00 0A0 Python example how to setup a serial connection 00 00 00 00 00 06 01 03 00 00 00 0A1 15.3.15. CloseConnectionFunction CloseConnection() As Integer Parameters This function has no parameters. Return valueZero if success. Nonzero value if failed. 15.3.16. ShowCommunicationTrafficShows the communication traffic window. Function ShowCommunicationTraffic() Parameters This function has no parameters. Return valueNone 15.3.17. CloseCommunicationTrafficCloses the communication traffic window if shown. Function CloseCommunicationTraffic() Parameters This function has no parameters. Return valueNone 15.4. Read FunctionsThe following functions do the same as you setup in the read/write definition dialog (F8). Read functions are associated with a Modbus Poll document. (The window with data) Example 00 00 00 00 00 06 01 03 00 00 00 0A2 You must create a Read before you can use properties to get data. 15.4.1. ReadCoilsModbus 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 True if success. False if not success 15.4.2. ReadDiscreteInputsModbus function code 02 Function ReadDiscreteInputs(SlaveID As Integer, Address As Long, Quantity As Integer, ScanRate As Long) As Integer Parameters SlaveID: The slave address 1 to 255 True if success. False if not success 15.4.3. ReadHoldingRegistersModbus 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 True if success. False if not success 15.4.4. ReadInputRegistersModbus 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 True if success. False if not success 15.5. Automation Write FunctionsThe write functions write the values stored in the array filled by the properties. The below Write function do not create a data window. To create a data window use the Win functions e.g. . 15.5.1. WriteSingleCoilModbus function code 05. Function WriteSingleCoil(SlaveID As Integer, Address As Long) As Integer Parameters SlaveID: The slave address 0 to 255 True if the write array is ready and the data is sent. False if the array is empty or error in the parameters. 15.5.2. WriteSingleRegisterModbus function code 06. Function WriteSingleRegister (SlaveID As Integer, Address As Long) As Integer Parameters SlaveID: The slave address 0 to 255 True if the write array is ready and the data is sent. False if the array is empty or error in the parameters. 15.5.3. WriteMultipleCoilsModbus function code 15. Function WriteMultipleCoils(SlaveID As Integer, Address As Long, Quantity As Integer) As Integer 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. SlaveID: The slave address 0 to 255 15.5.4. WriteMultipleRegistersModbus function code 16. Function WriteMultipleRegisters(SlaveID As Integer, Address As Long, Quantity As Integer) As Integer Parameters SlaveID: The slave address 0 to 255 True if the write array is ready and the data is sent. False if the array is empty or error in the parameters. 15.5.5. Python examplePython example how to create a window that read 10 registers from address 0 (40001) and then write 5 registers. Python example 00 00 00 00 00 06 01 03 00 00 00 0A3 15.6. Various FunctionsVarious functions are associated with a Modbus Poll document. (The window with data) 15.6.1. ShowWindowAs 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 valueNone 15.6.2. GetTxCountRetreives the number of requests. Function GetTxCount() As Long Parameters This function has no parameters. Return valueThe number of requests. 15.6.3. GetRxCountRetreives the number of response. Function GetRxCount() As Long Parameters This function has no parameters. Return valueThe number of response. 15.6.4. GetNameRetreives the name of a value. Function GetName(Index As Integer) As String Parameters Index: Index 0 corresponds to the first Modbus address. Return valueThe name. 15.6.5. SetNameChanges the name of a value. Function SetName(Index As Integer, Name As String) Parameters Index: Index 0 corresponds to the first Modbus address. None 15.6.6. FormatAllFormat all value cells with the selected format. Function FormatAll(Format As Integer) Parameters Format: The format of the value cell. Return valueNone 15.6.7. GetFormatRetreives the display format of the Modbus value. Function GetFormat(Index As Integer) As Integer Parameters Index: Index 0 corresponds to the first Modbus address. 0 Signed 1 Unsigned 2 Hex 3 Binary 4 Float little-endian byte swap 5 Float big-endian 6 Double little-endian byte swap 7 Double big-endian 8 32-bit Signed little-endian byte swap 9 32-bit Signed big-endian 10 Float little-endian 11 Float big-endian byte swap 12 Double little-endian 13 Double big-endian byte swap 14 32-bit Signed little-endian 15 32-bit Signed big-endian byte swap 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. You still need to use byteOrder to get the correct endianness when using Get/Set value functions. 15.6.8. SetFormatChange the display format of the Modbus values. See Format values above. Function SetFormat(Index As Integer, Format As Integer) Parameters Index: Index 0 corresponds to the first Modbus address. None 15.6.9. ResizeWindowResize an opened window to fit the grid. Function ResizeWindow() Parameters This function has no parameters. Return valueNone 15.6.10. ResizeAllColumnsResize all columns to fit the values inside the cells. Function ResizeAllColumns() Parameters This function has no parameters. Return valueNone 15.6.11. RowsSpecify the number of rows in the grid. Function Rows(NumberRows) Parameters NumberRows: Number of rows in the grid. IDDescription0 10 Rows (Default) 1 20 Rows 2 50 Rows 3 100 Rows 4 Fit to quantity Return value None 15.6.12. ReadResultUse this property to check if communication established with Read is running successful. Property ReadResult As Integer Parameters This function has no parameters. Return valueErrorDescription0 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 6 PORT NOT OPEN ERROR 10 DATA UNINITIALIZED 11 INSUFFICIENT BYTES RECEIVED 16 BYTE COUNT ERROR 19 TRANSACTION ID ERROR 81h ILLEGAL FUNCTION 82h ILLEGAL DATA ADDRESS 83h ILLEGAL DATA VALUE 84h SERVER DEVICE FAILURE 85h ACKNOWLEDGE 86h SERVER DEVICE BUSY 87h NAK-NEGATIVE ACKNOWLEDGMENT 8Ah GATEWAY PATH UNAVAILABLE 8Bh GATEWAY TARGET DEVICE FAILED TO RESPOND 15.6.13. WriteResultUse this function to check if a write was successful. Property WriteResult As Integer Return value Return a write result as an integer. 15.7. Automation data propertiesThe below properties are used to set or get values in the internal write/read arrays in Modbus Poll. The Index used is not a Modbus Address. The Index always counts from 0 no matter of the address used. The data properties are associated with a Modbus Poll document. (The window with data) There are 2 version of each data properties:
Example 1: 00 00 00 00 00 06 01 03 00 00 00 0A4 Example 2 with floating point values: 00 00 00 00 00 06 01 03 00 00 00 0A5 Example 3: 00 00 00 00 00 06 01 03 00 00 00 0A6 15.7.1. Coils, CoilsWinProperty Coils(Index As Integer) As Integer Description Sets a coil in the write array structure or return a coil from the read array. SyntaxCoils(Index) [=newvalue] 15.7.2. SRegisters, SRegistersWinProperty SRegisters(Index As Integer) As Integer Description Sets a register in the write array structure or return a register from the read array. SyntaxSRegisters(Index) [=newvalue] 15.7.3. URegisters, URegistersWinProperty URegisters(Index As Integer) As Long Description Sets a register in the write array structure or return a register from the read array. SyntaxURegisters(Index) [=newvalue] 15.7.4. Ints_32, Ints_32WinProperty Ints_32(Index As Integer) As Double Description Sets a 32-bit integer in the write array structure or return an integer from the read array. SyntaxInts_32(Index) [=newvalue] 15.7.5. UInts_32, UInts_32WinProperty UInts_32(Index As Integer) As Double Description Sets a 32-bit unsigned integer in the write array structure or return an unsigned integer from the read array. SyntaxUInts_32(Index) [=newvalue] 15.7.6. Ints_64, Ints_64WinProperty Ints_64(Index As Integer) As Double Description Sets a 64-bit integer in the write array structure or return an integer from the read array. SyntaxInts_64(Index) [=newvalue] 15.7.7. UInts_64, UInts_64WinProperty UInts_64(Index As Integer) As Double Description Sets a 64-bit unsigned integer in the write array structure or return an unsigned integer from the read array. SyntaxUInts_64(Index) [=newvalue] 15.7.8. Floats, FloatsWinProperty Floats(Index As Integer) As Single Description Sets a float in the write array structure or returns a float from the read array. SyntaxFloats(Index) [=newvalue] 15.7.9. Doubles, DoublesWinProperty Doubles(Index As Integer) As Double Description Sets a double in the write array structure or return a double from the read array. SyntaxDoubles(Index) [=newvalue] 15.7.10. ByteOrderProperty ByteOrder As Integer Description Sets the byte order used by Ints_32, UInts_32, Ints_64, UInts_64, Floats and Doubles properties. 0 Big-endian (Default) 1 Little-endian byte swap 2 Big-endian byte swap 3 Little-endian Example for Ints_32: Syntax ByteOrder [=newvalue] 15.8. Write Functions (Create a data window)The following functions do the same as you set up in the read/write definition dialog (F8). 15.8.1. WriteSingleCoilWinModbus function code 05. Function WriteSingleCoilWin(SlaveID As Integer, Address As Long, ScanRate As Long) As Integer Parameters SlaveID: The slave address 1 to 255 True if success. False if not success 15.8.2. WriteSingleRegisterWinModbus function code 06. Function WriteSingleRegisterWin(SlaveID As Integer, Address As Long, ScanRate As Long) As Integer Parameters SlaveID: The slave address 1 to 255 True if success. False if not success Python Example how to open a window and write a single register every 1000 ms 00 00 00 00 00 06 01 03 00 00 00 0A7 15.8.3. WriteMultipleCoilsWinModbus 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 True if success. False if not success 15.8.4. WriteMultipleRegistersWinModbus function code 16. Function WriteMultipleRegistersWin(SlaveID As Integer, Address As Long, Quantity As Integer, ScanRate As Long) As Integer Parameters SlaveID: The slave address 1 to 255 True if success. False if not success 16. Exception and error messagesModbus Exceptions and error messages are displayed in red text in the 2nd line in each window. 16.1. Modbus Exception CodesModbus exceptions are errors returned from the slave device. CodeNameMeaning01 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. 05 Acknowledge Specialized use in conjunction with programming commands. 06 Server Device Busy Specialized use in conjunction with programming commands. 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 to Respond Specialized use in conjunction with gateways, indicates that no response was obtained from the target device. Usually means that the device is not present on the network. 16.2. Modbus Poll error messagesError messageMeaningTimeout Error The response is not received within the expected time. Check the following:
Response Error The response is not the expected one. Different slave ID. CRC Error The CRC value of the received response is not correct. 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:
Write error using TCP/IP connection is normally caused by lost connection. Read Error This is an error reported by the serial driver. There are 6 types:
Read error using TCP/IP connection is normally caused by lost connection. Insufficient bytes received The response is not the expected length. 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. |