Kepware Modbus Ascii
Kepware Modbus Ascii
Driver Help
2013 Kepware Technologies
2 Modbus ASCII Serial Driver Help
Table of Contents
Table of Contents 2
Modbus ASCII Serial Driver Help 4
Overview 4
Channel Setup 5
Device Setup 6
Cable Diagram 6
Modem Setup 7
Settings 7
Block Sizes 9
Variable Import Settings 10
Error Handling 10
Automatic Tag Database Generation 12
Exporting Variables from Concept 12
Exporting Variables from ProWORX 14
Data Types Description 16
Address Descriptions 17
Modbus ASCII Addressing 17
Function Codes Description 19
Flow Computer Addressing 19
Flow Automation Addressing 19
Error Descriptions 20
Address Validation 20
Missing address 20
Device address '<address>' contains a syntax error 21
Address '<address>' is out of range for the specified device or register 21
Device address '<address>' is not supported by model '<model name>' 21
Data Type '<type>' is not valid for device address '<address>' 21
Device address '<address>' is Read Only 21
Array size is out of range for address '<address>' 22
Array support is not available for the specified address: '<address>' 22
Serial Communications 22
COMn does not exist 22
Error opening COMn 22
COMn is in use by another application 22
Unable to set comm parameters on COMn 23
Communications error on '<channel name>' [<error mask>] 23
Device Status Messages 23
Device '<device name>' is not responding 23
Unable to write to '<address>' on device '<device name>' 24
Unable to write to address '<address>' on device '<device>': Device responded with exception code
'<code>' 24
Device Specific Messages 24
www. kepware.com
Modbus ASCII Serial Driver Help 3
Bad address in block [<start address> to <end address>] on device '<device name>' 24
Bad array spanning ['<address>' to '<address>'] on device '<device name>' 24
Automatic Tag Database Generation Messages 24
Tag import failed due to low memory resources 25
File exception encountered during tag import 25
Error parsing import file record number <record>, field <field> 25
Description truncated for import file record number <record> 25
Imported tag name '<tag name>' is invalid. Name changed to '<tag name>' 25
Tag '<tag name>' could not be imported because data type '<data type>' is not supported 26
Modbus Exception Codes 26
Index 27
www. kepware.com
4 Modbus ASCII Serial Driver Help
CONTENTS
Overview
What is the Modbus ASCII Serial Driver?
Channel Setup
How do I configure channels for use with this driver?
Device Setup
How do I configure a device for use with this driver?
Address Descriptions
How do I address a data location on a Modbus device?
Error Descriptions
What error messages does the Modbus ASCII Serial driver produce?
Overview
The Modbus ASCII Serial Driver provides an easy and reliable way to connect Modbus ASCII Serial devices to OPC
Client applications, including HMI, SCADA, Historian, MES, ERP and countless custom applications. It is intended
for use with serial devices that support the Modbus ASCII protocol. The driver's special features provide control
over the following: the amount of data requested from a device in a single request, the word ordering of 32 bit
double register values, the byte ordering of 32 bit and 16 bit register values and address base adjustment. The
driver can also control the RTS line operation for use with radio modems that require specific RTS timing.
www. kepware.com
Modbus ASCII Serial Driver Help 5
Channel Setup
Communication Serialization
The Modbus ASCII Serial Driver supports Communication Serialization, which specifies whether data trans-
missions should be limited to one channel at a time. For more information, refer to "Channel Properties -
Advanced" in the server help file.
www. kepware.com
6 Modbus ASCII Serial Driver Help
Device Setup
Supported Devices
Modbus ASCII compatible devices
Flow Computers using the Daniels/Omni/Elliot register addressing
Communication Protocol
Modbus ASCII Protocol.
Ethernet Encapsulation
This driver supports Ethernet Encapsulation, which allows the driver to communicate with serial devices
attached to an Ethernet network using a terminal server. It may be invoked through the COM ID dialog in Channel
Properties. For more information, refer to the OPC server's help file.
Flow Control
When using an RS232/RS485 converter, the type of flow control that is required depends on the needs of the con-
verter. Some converters do not require any flow control whereas others require RTS flow. Consult the converter's
documentation in order to determine its flow requirements. An RS485 converter that provides automatic flow con-
trol is recommended.
Note 1: When using the manufacturer's supplied communications cable, it is sometimes necessary to choose a
flow control setting of RTS or RTS Always under the Channel Properties.
Note 2: The Modbus ASCII Serial driver supports the RTS Manual flow control option. This selection is used to
configure the driver for operation with radio modems that require special RTS timing characteristics. For more
information on RTS Manual flow control, refer to the OPC server help file.
Cable Diagram
Cable Connections (Modbus Controller)
www. kepware.com
Modbus ASCII Serial Driver Help 7
Modem Setup
This driver supports modem functionality. For more information, please refer to the topic "Modem Support" in the
OPC Server Help documentation.
Settings
<address>.<bit>
where <bit> represents the bit number within the Word. Zero Based Bit Addressing within registers provides
two ways of addressing a bit within a given Word; Zero Based and One Based. Zero Based Bit addressing within
registers simply means the first bit begins at 0. One Based addressing within registers means that the first bit
begins at 1.
www. kepware.com
8 Modbus ASCII Serial Driver Help
imal 22). If the device does not support this feature, the driver will need to perform a Read/Modify/Write oper-
ation to ensure that only the single bit is changed.
Check this box if the device supports holding register bit access. The default setting is unchecked. If this setting
is selected, then the driver will use function code 0x16 regardless of the setting for "Use Modbus function 06 for
single register writes." If this setting is not selected, then the driver will use either function code 0x06 or 0x10
depending on the selection for "Use Modbus function 06 for single register writes."
Note: When Modbus byte order is not selected, the byte order of the masks sent in the command will be Intel
byte order.
Use Modbus function 06 can be used to force the driver to use only Modbus function 16 if needed. This selec-
tion is checked by default. It allows the driver to switch between 06 and 16 as needed. If the device requires all
writes to be done using only Modbus function 16, uncheck this selection.
Note: For bit within word writes, the Holding Register Bit Mask Writes property takes precedence over this
property (Use Modbus Function 06). If Holding Register Bit Mask Writes is selected, then function code 0x16 is
used no matter what the selection for this property. However, if Holding Register Bit Mask Writes is not selected,
then depending upon the selection of this property either function code 0x06 or 0x10 will be used for bit within
word writes.
Use Modbus function 05 can be used to force the driver to use only Modbus function 15 if needed. This selec-
tion is checked by default. It allows the driver to switch between 05 and 15 as needed. If a device requires all
writes to be done using only Modbus function 15, uncheck this selection.
www. kepware.com
Modbus ASCII Serial Driver Help 9
Note: For the following example, the 1st through 16th bit signifies either 0-15 bits or 1-16 bits depending on if
the driver is set at Zero Based or One Based Bit Addressing within registers.
MSB LSB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
MSB LSB
16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
l Use default Modbus byte order option sets the data encoding of each register/16 bit value.
l First word low in 32 bit data types option sets the data encoding of each 32 bit value and each double
word of a 64 bit value.
l First DWord low in 64 bit data types option sets the data encoding of each 64 bit value.
Data Types Use default Modbus byte First word low in 32 bit data First DWord low in 64 bit data
order Applicable types Applicable types Applicable
Word, Short, Yes No No
BCD
Float, DWord, Yes Yes No
Long, LBCD
Double Yes Yes Yes
If needed, use the following information and the particular device's documentation to determine the correct set-
tings of the Data Encoding options.
Note: The default settings are correct for the majority of Modbus devices.
Block Sizes
Coil Block Sizes
Coils can be read from 8 to 2000 points (bits) at a time. A higher block size means more points will be read from
the device in a single request. Block size can be reduced if data needs to be read from non-contiguous locations
within the device.
www. kepware.com
10 Modbus ASCII Serial Driver Help
Caution: If the Register Block Sizes value is set above 120 and a 32 or 64 bit data type is used for any tag, then
a "Bad address in block" error could occur. To prevent the error from occurring, decrease the block size value to
120.
l Variable import file: This parameter specifies the exact location of the Concept or ProWORX variable
import file that the driver will use when Automatic Tag Database Generation is enabled.
l Include descriptions: When checked, imported tag descriptions will be used if present in file. The
default setting is checked.
Note: For more information on configuring the Automatic Tag Database Generation feature and creating a var-
iable import file, refer to Automatic Tag Database Generation.
Error Handling
www. kepware.com
Modbus ASCII Serial Driver Help 11
l Deactivate tags on illegal address exception: When checked, the driver will stop polling for a block
of data when the device returns Modbus exception code 2 (illegal address) or 3 (illegal data, such as
number of points) in response to a read of that block. When unchecked, the driver will continue to poll
that data block. Users will not need to restart the server in order to activate a deactivated block. The
default setting is checked.
www. kepware.com
12 Modbus ASCII Serial Driver Help
This driver requires specialized settings in addition to the basic settings that are common to all drivers that sup-
port automatic tag database generation. These specialized settings include the name and location of the variable
import file. This information can be specified during the Variable Import Settings step of the Device Wizard or
later by selecting the Device Properties | Variable Import Settings. For more information, refer to Variable
Import Settings.
Operation
Depending on the configuration, tag generation may start automatically when the OPC Server project starts or be
initiated manually at some other time. The OPC Server's event log will show when the tag generation process
started, any errors that occurred while processing the variable import file and when the process completed.
Note: Though Concept can be used to define variable names that begin with an underscore, such names are not
allowed by the OPC server. The driver will modify invalid imported tag names as needed and will inform the user
of any such name changes in the servers event log.
www. kepware.com
Modbus ASCII Serial Driver Help 13
User defined data types are not currently supported by this driver. Records in the export file containing ref-
erences to such types will be ignored. The following simple data types are supported:
Note 1: Unlocated variables, which do not correspond to a physical address in the device, will be ignored by the
driver.
Note 2: Comments are allowed. Users can choose whether or not to include these as the generated tag descrip-
tions. For more information, refer to Variable Import Settings.
1. Click File | Export and select the Variables: Text delimited format.
2. Click OK. Next, specify the Filter Setting and Separator Setting.
www. kepware.com
14 Modbus ASCII Serial Driver Help
Note: Although any filter settings may be chosen, this driver will only be able to read the exported data if
the default semicolon separator is used.
As the ladder program is created, symbolic names can be defined for the various data points referenced using
the Document Editor.
Note 1: Although ProWORX does not place many restrictions on variable names, the OPC Server requires that tag
names consist of alphanumeric characters and underscores, and that the first character not be an underscore.
The driver will modify invalid imported tag names as needed, and inform of any such name changes in the
servers event log.
Note 2: ProWORX will assign a data type of either BOOL or INT to the exported variables. The driver will create
tags of type Boolean and Short respectively. To generate tags with other data types, users should manually edit
the exported file and use any of the supported Concept data types. For a list of supported types, refer to Export-
ing Variables from Concept.
www. kepware.com
Modbus ASCII Serial Driver Help 15
3. Note: Descriptors are allowed and can be included as the generated tag descriptions or not. For more
information, refer to Variable Import Settings.
www. kepware.com
16 Modbus ASCII Serial Driver Help
*The descriptions above assume the default settings; that is, first DWord low data handling of 64 bit data types
and first word low data handling of 32 bit data types.
www. kepware.com
Modbus ASCII Serial Driver Help 17
Address Descriptions
Address specifications vary depending on the model in use. Select a link from the following list to obtain specific
address information for the model of interest.
3xxxxx.0/1-3xxxxx.15/16*** Boolean
Internal Registers As 300001.2H-365536.240H String Read Only 04
String with HiLo Byte
Order
.Bit is string length, range 2
to 240 bytes.
Internal Registers As 300001.2L-365536.240L String Read Only 04
String with LoHi Byte
Order
.Bit is string length, range 2
to 240 bytes.
Holding Registers 400001-465536 Word, Short, BCD Read/Write 03, 06, 16
400001-465535 Float, DWord, Long, LBCD
400001-465533 Double
Boolean
4xxxxx.0/1-4xxxxx.15/16*** 03, 06, 16, 22
Holding Registers As 400001.240H-465536.2H String Read/Write 03, 16
String with HiLo Byte
Order
.Bit is string length,
range 2 to 240 bytes.
Holding Registers As 400001.2L-465536.240L String Read/Write 03, 16
String with LoHi Byte
Order
.Bit is string length,
range 2 to 240 bytes.
www. kepware.com
18 Modbus ASCII Serial Driver Help
*The supported Function Codes are displayed in decimal. For more information, refer to Function Codes
Description.
**For more information, refer to Packed Coil Tags.
***For more information, refer to the "Use Zero-Based Bit Addressing Within Registers" subtopic in Settings.
Caution: Setting the Client Access privileges of Write Only tags to Read Only will cause writes to these tags to fail
and the client to always receive 0/NULL for numeric/string values.
where xxxxx is the address of the first coil, and nn is the number of coils to be packed into an analog value (1-
16).
The bit order will be such that the start address will be the LSB (least significant bit) of analog value.
String Support
The Modbus model supports reading and writing holding register memory as an ASCII string. When using hold-
ing registers for string data, each register will contain two bytes of ASCII data. The order of the ASCII data within
a given register can be selected when the string is defined. The length of the string can be from 2 to 240 bytes
and is entered in place of a bit number. The length must be entered as an even number. The byte order is spec-
ified by appending either a "H" or "L" to the address.
Note: For information on how to perform block read on string tags for the Modbus model, refer to Block Sizes.
String Examples
1. To address a string starting at 40200 with a length of 100 bytes and HiLo byte order, enter:
40200.100H
2. To address a string starting at 40500 with a length of 78 bytes and LoHi byte order, enter:
40500.78L
Note: The string length may be limited by the maximum size of the write request that the device will allow. If the
error message "Unable to write to address <address> on device <device>: Device responded with exception
code 3" is received while utilizing a string tag, the device did not like the string's length. If possible, try short-
ening the string.
2. Some documentation refers to Modbus addresses by function code and location. For instance, function code 3;
location 2000 would be addressed as '42000' (the leading '4' represents holding registers or function code 3).
3. Some documentation refers to Modbus addresses by function code and location. For instance, setting function
code 5 location 100 would be addressed as '0100' (the leading '0' represents output coils or function code 5).
Writing 1 or 0 to this address would set or reset the coil.
Array Support
Arrays are supported for internal and holding register locations for all data types except for Boolean and strings.
Arrays are also supported for input and output coils (Boolean data types). There are two methods of addressing
an array. Examples are given using holding register locations.
www. kepware.com
Modbus ASCII Serial Driver Help 19
For arrays, rows multiplied by cols cannot exceed the block size that has been assigned to the device for the reg-
ister/coil type. For register arrays of 32 bit data types, rows multiplied by cols multiplied by 2 cannot exceed the
block size.
*Address ranges 405000 to 406800 and 407000 to 407800 are 32 bit registers. Addresses in the range of
405000 to 406800 use a default data type of Long. Addresses in the range of 407000 to 407800 use a default
data type of Float. Since these address registers are 32 bit, only Float, DWord, Long or LBCD data types are
allowed. Arrays are not allowed for these special address ranges.
Arrays
Arrays are supported for internal and holding register locations for all data types except for Boolean. There are
two methods of addressing an array. Examples are given using holding register locations.
Rows multiplied by cols cannot exceed the block size that has been assigned to the device for the register type.
For arrays of 32 bit data types, rows multiplied by cols multiplied by 2 cannot exceed the block size.
The Flow Automation Flow Computer treats all data as a 32 bit floating point value. All addresses in the holding
register space of the device will be read as 32 bit floating point numbers. A complete memory map of the flow
automation control is provided in the custom report section of the flow automation manual.
www. kepware.com
20 Modbus ASCII Serial Driver Help
Error Descriptions
The following error/warning messages may be generated. Click on the link for a description of the message.
Address Validation
Missing address
Device address '<address>' contains a syntax error
Address '<address>' is out of range for the specified device or register
Device address '<address>' is not supported by model '<model name>'
Data Type '<type>' is not valid for device address '<address>'
Device address '<address>' is Read Only
Array size is out of range for address '<address>'
Array support is not available for the specified address: '<address>'
Serial Communications
COMn does not exist
Error opening COMn
COMn is in use by another application
Unable to set comm parameters on COMn
Communications error on '<channel name>' [<error mask>]
See Also:
Modbus Exception Codes
Address Validation
The following error/warning messages may be generated. Click on the link for a description of the message.
Address Validation
Missing address
Device address '<address>' contains a syntax error
Address '<address>' is out of range for the specified device or register
Device address '<address>' is not supported by model '<model name>'
Data Type '<type>' is not valid for device address '<address>'
Device address '<address>' is Read Only
Array size is out of range for address '<address>'
Array support is not available for the specified address: '<address>'
Missing address
Error Type:
Warning
Possible Cause:
www. kepware.com
Modbus ASCII Serial Driver Help 21
Solution:
Re-enter the address in the client application.
Possible Cause:
A tag address that has been specified statically contains one or more invalid characters.
Solution:
Re-enter the address in the client application.
Possible Cause:
A tag address that has been specified statically references a location that is beyond the range of supported loca-
tions for the device.
Solution:
Verify that the address is correct; if it is not, re-enter it in the client application.
Possible Cause:
A tag address that has been specified statically references a location that is valid for the communications protocol
but not supported by the target device.
Solution:
Verify that the address is correct; if it is not, re-enter it in the client application. Also verify that the selected
model name for the device is correct.
Possible Cause:
A tag address that has been specified statically has been assigned an invalid data type.
Solution:
Modify the requested data type in the client application.
Possible Cause:
A tag address that has been specified statically has a requested access mode that is not compatible with what the
device supports for that address.
Solution:
Change the access mode in the client application.
www. kepware.com
22 Modbus ASCII Serial Driver Help
Possible Cause:
A tag address that has been specified statically is requesting an array size that is too large for the address type or
block size of the driver.
Solution:
Re-enter the address in the client application to specify a smaller value for the array or a different starting point.
Possible Cause:
A tag address that has been specified statically contains an array reference for an address type that doesn't sup-
port arrays.
Solution:
Re-enter the address in the client application to remove the array reference or correct the address type.
Serial Communications
The following error/warning messages may be generated. Click on the link for a description of the message.
Serial Communications
COMn does not exist
Error opening COMn
COMn is in use by another application
Unable to set comm parameters on COMn
Communications error on '<channel name>' [<error mask>]
Possible Cause:
The specified COM port is not present on the target computer.
Solution:
Verify that the proper COM port has been selected.
Possible Cause:
The specified COM port could not be opened due an internal hardware or software problem on the target com-
puter.
Solution:
Verify that the COM port is functional and may be accessed by other Windows applications.
Possible Cause:
The serial port assigned to a device is being used by another application.
www. kepware.com
Modbus ASCII Serial Driver Help 23
Solution:
1. Verify that the correct port has been assigned to the channel.
2. Verify that only one copy of the current project is running.
Possible Cause:
The serial parameters for the specified COM port are not valid.
Solution:
Verify the serial parameters and make any necessary changes.
Possible Cause:
1. The serial connection between the device and the Host PC is bad.
2. The communications parameters for the serial connection are incorrect.
Solution:
1. Verify the cabling between the PC and the PLC device.
2. Verify that the specified communications parameters match those of the device.
Possible Cause:
1. The serial connection between the device and the Host PC is broken.
2. The communications parameters for the serial connection are incorrect.
3. The named device may have been assigned an incorrect Device ID.
4. The response from the device took longer to receive than the amount of time specified in the "Request Timeout"
device setting.
Solution:
1. Verify the cabling between the PC and the PLC device.
2. Verify that the specified communications parameters match those of the device.
3. Verify that the Device ID given to the named device matches that of the actual device.
4. Increase the Request Timeout setting so that the entire response can be handled.
www. kepware.com
24 Modbus ASCII Serial Driver Help
Possible Cause:
1. The serial connection between the device and the Host PC is broken.
2. The communications parameters for the serial connection are incorrect.
3. The named device may have been assigned an incorrect Device ID.
Solution:
1. Verify the cabling between the PC and the PLC device.
2. Verify that the specified communications parameters match those of the device.
3. Verify that the Device ID given to the named device matches that of the actual device.
Possible Cause:
See Modbus Exception Codes for a description of the exception code.
Solution:
See Modbus Exception Codes.
Possible Cause:
An attempt has been made to reference a nonexistent location in the specified device.
Solution:
Verify the tags assigned to addresses in the specified range on the device and eliminate ones that reference
invalid locations.
Possible Cause:
An array of addresses was defined that spans past the end of the address space.
Solution:
Verify the size of the device's memory space and then redefine the array length accordingly.
www. kepware.com
Modbus ASCII Serial Driver Help 25
Possible Cause:
The driver could not allocate memory required to process variable import file.
Solution:
Shutdown all unnecessary applications and retry.
Possible Cause:
The variable import file could not be read.
Solution:
Regenerate the variable import file.
Possible Cause:
The specified field in the variable import file could not be parsed because it is longer than expected or invalid.
Solution:
Edit the variable import file to change the offending field if possible.
Possible Cause:
The tag description given in specified record is too long.
Solution:
The driver will truncate the description as needed. To prevent this error in the future, edit the variable import file
to change the description if possible.
Imported tag name '<tag name>' is invalid. Name changed to '<tag name>'
Error Type:
Warning
Possible Cause:
The tag name encountered in the variable import file contained invalid characters.
Solution:
The driver will construct a valid name based on the one from the variable import file. To prevent this error in the
future, and to maintain name consistency, change the name of the exported variable if possible.
www. kepware.com
26 Modbus ASCII Serial Driver Help
Tag '<tag name>' could not be imported because data type '<data type>' is not
supported
Error Type:
Warning
Possible Cause:
The data type specified in the variable import file is not one of the types supported by this driver.
Solution:
If possible, change the data type specified in variable import file to one of the supported types. If the variable is
for a structure, manually edit file to define each tag required for the structure, or manually configure the
required tags in the OPC Server.
See Also:
Exporting Variables from Concept
Note: For this driver, the terms Slave and Unsolicited are used interchangeably.
www. kepware.com
Modbus ASCII Serial Driver Help 27
Index
Bad address in block [<start address> to <end address>] on device '<device name>' 24
Bad array spanning ['<address>' to '<address>'] on device '<device name>' 24
BCD 16
Block Sizes 9
Boolean 16
Cable Diagram 6
Channel Setup 5
Communications error on '<channel name>' [<error mask>] 23
COMn does not exist 22
COMn is in use by another application 22
Concept 12
Concept Data Type 13
www. kepware.com
28 Modbus ASCII Serial Driver Help
Error Descriptions 20
Error Handling 10
Error opening COMn 22
Error parsing import file record number <record>, field <field> 25
Exporting Variables from Concept 12
Exporting Variables from ProWORX 14
Imported tag name '<tag name>' is invalid. Name changed to '<tag name>' 25
LBCD 16
Long 16
Mask 23
Missing address 20
Modbus ASCII Addressing 17
Modbus Exception Codes 26
Modem Setup 7
www. kepware.com
Modbus ASCII Serial Driver Help 29
Network 6
Overrun 23
Overview 4
Serial Communications 22
Settings 7
Short 16
String 16
Tag '<tag name>' could not be imported because data type '<data type>' is not supported 26
Tag import failed due to low memory resources. 25
www. kepware.com
30 Modbus ASCII Serial Driver Help
Word 16
www. kepware.com