<< Click to Display Table of Contents >>
Modbus Tab |
The Modbus tab allows configuring parameters for this Driver and for the protocol, as shown on the next figure.
Modbus tab on this Driver's configuration window
The next sections describe all configuration options available on this tab.
This group of options gathers options referring to variations on protocol's standards, according to the next table.
Available protocol options on the Modbus tab
Option |
Description |
---|---|
Modbus Mode |
On this option, users can select a protocol mode to use. Protocol modes are variations defined by the standard for a better adaptation to different physical layers, such as Serial, Ethernet TCP/IP, or RAS, among others. The available options are the following: •RTU mode: Default mode for use in serial communications. Includes a 16-bit CRC •ASCII mode: Also used in serial communications, it is used in simpler devices, which do not support RTU mode requirements. It uses ASCII characters for transmission, where each byte contains two ASCII characters, one per nibble, thus it is less efficient than RTU mode, and rarely found on the market. Uses LRC (Longitudinal Redundancy Checking) for error checking •ModbusTCP mode: Used for communication in TCP/IP mode. Includes a field for transaction check and does not have an error check system. The transaction field allows discarding delayed responses, thus avoiding that this Driver assumes as a valid response for the current command the response frames from previous commands. This situation may occur if previous modes are encapsulated in TCP/IP |
Customize Max. PDU Size |
If enabled, this option allows defining a maximum custom size for PDU (Protocol Data Unit). A PDU is a part of the protocol that does not vary between modes ModbusTCP, ASCII, and RTU and contains a data area. The number of data bytes supported in each communication is given by this value minus the header bytes, which depend on the Modbus function used. If disabled, the maximum considered size is the default value defined by the Modbus protocol version 1.1b, with 253 bytes. This is the recommended option for most devices |
Use Gateway Modbus/TCP |
In Ethernet mode, via Modbus TCP, this option indicates the presence of a Modbus Gateway to access a Serial RS-485 network, reserving the Slave ID with a value of 0 (zero) for Broadcast mode. If users want to directly communicate with a device in Ethernet mode, disable this option to use a Slave ID with value 0 (zero) |
Enable CMS Addressing |
This option must be only used in devices that support the TeleBUS protocol. If enabled, this Driver accepts a 16-bit Word as its slave address, that is, users can define values above 255 and below 65535 as a slave address. In this case, a slave address is then defined in the protocol by three bytes. In addition, the Default Slave Address option stops working |
This option enables or disables the default protocol's data offset, by one unit. Available options are: •Data is addressed from 1 (default): The address provided (address of the Item field in String configuration or the N4/B4 parameter in numerical configuration) is decremented by 1 (one) before sending it to a device. This offset is part of protocol's specification, therefore this is the default option •Data is addressed from 0: The user-provided address is used in protocol requests, without changes As a general rule, select the first option if device's register mapping starts at 1 (one) and the second option if it starts at 0 (zero). Also check if the manufacturer uses additional offsets from the old Modbus Convention. For more information, please check the next section. |
TIP |
Avoid using protocol's RTU mode encapsulated in Ethernet TCP/IP layer. If there is a need to encapsulate serial communication for devices using Modbus RTU in TCP/IP, there are gateways available on the market that not only encapsulate serial communication in Ethernet TCP/IP, but also convert Modbus RTU to Modbus TCP. As a last option, if using Modbus RTU in an Ethernet TCP/IP layer is inevitable, remember to enable the Reconnect after Timeout option, described on the next table. |
This configuration option, described on the previous table, is a source of frequent doubts when addressing I/O Tags, because there are many variations in how it is implemented by manufacturers. Next there is more information about this addressing.
In protocol's standard data model, four data blocks are defined, or address spaces: Discrete Inputs, Coils, Input Registers, and Holding Registers. In each one of these blocks, data elements are addressed starting at 1 (one). On the other hand, the communication frame's specification defines a PDU with addresses that range from 0 (zero) to 65535. The relationship between the address provided by the PDU and the address of data elements, therefore, has an offset of 1 (one), that is, if in a request's PDU there is an address 0 (zero), the data element to access is the address 1 (one).
With this option on the Modbus tab, users can select whether this Driver sets that value automatically, thus allowing the use of data element's address on Tags, the default option, or the value sent in the PDU is the same provided on Tag configuration, the N4/B4 parameter in numerical configuration. There are devices that comply with Modbus standard in their address maps, starting at one, and other devices that map their values without a default offset, directly using the value of the address on communication's frame, starting at 0 (zero).
In addition to this single offset, there are still devices that use the old offset standard used by Modicon, the company that created the protocol, which is known as Modbus Convention, detailed on topic Addressing Tips (Modbus Convention). Please check device's manual for information on the register map used. When in doubt, please check manufacturer's technical support.
NOTE |
The Data Address Model Offset option used to be named Use Older Address on versions earlier than version 2.03, where the Data is addressed from 1 option is equivalent to the old Use Older Address option enabled, and the Data is addressed from 0 option is equivalent to the Use Older Address option disabled. |
The next table describes all other options on this tab, referring to this Driver's behavior.
Other available options on the Modbus tab
Option |
Description |
---|---|
Default Slave Address |
This feature allows configuring a default address for slaves, so that it is not necessary to configure them in each Tag. To use this feature, configure the Slave Id, the N1/B1 parameter on numerical configuration or the Device field on String configuration, as 1000, that is, all Tags with their Slave Id equal to 1000 have this value replaced by the value configured in the Default Slave Address option. Users can also force using a default address in all Tags, regardless of the value configured in Slave Id, by selecting the Use Default Address option |
Wait Silence on error |
If this option is enabled, after every communication error this Driver remains in loop, receiving data until a time-out occurs. This clears the reception channel and prevents problems in future communications due to the reception of delayed bytes still in transit at the time of the error, and which may be confused with a response to a new command |
Reconnect after Timeout (Ethernet only) |
With this option enabled, after any time-out error in device's frame reception, this Driver performs a disconnection and a reconnection to the physical layer, clearing the connection from possible delayed frames still in transit, which may affect future requests. This option must be always enabled if using Modbus RTU in an Ethernet TCP/IP layer is inevitable in legacy systems, as the RTU mode does not have a transaction control, therefore it is not always possible to distinguish a correct response frame from a delayed one resulting from a previous reading, possibly from another address, which failed by a time-out. For new projects, it is strongly recommended NOT using Modbus RTU or Modbus ASC modes in an Ethernet TCP/IP layer. Notice that users must keep the Retry failed connection every option enabled on IOKit's Setup tab, so that this Driver reconnects after a time-out. Otherwise, this time-out only generates a disconnection and the application is responsible for managing this new connection |
NOTE |
The old Swap Address Delay option was removed from the configuration window in version 2.08. This Driver still supports it in pre-existing applications and allows enabling it by script. For more information, please check topic Offline Mode Configuration. For new applications, it is recommended to use the Inter-frame Delay option on IOKit's Serial tab, which replaces this old option with benefits. |