Modbus Serial Manual
Modbus Serial Manual
Table of Contents
Table of Contents 2
Modbus Serial Driver Help 4
Overview 4
Channel Setup 5
Device Setup 6
Cable Diagram 7
Modem Setup 7
Settings 8
Block Sizes 11
Variable Import Settings 12
Framing 13
Error Handling 15
Address Descriptions 21
Modbus Addressing 21
Magnetek GPD 515 Drive Addressing 23
Elliott Flow Computer Addressing 24
Daniels S500 Flow Computer Addressing 24
Dynamic Fluid Meter Addressing 25
Omni Flow Computer Addressing 26
Omni Custom Packets 28
Omni Raw Data Archive 30
Omni Text Reports 34
Omni Text Archive 36
Function Codes Description 37
Statistics Items 38
Error Descriptions 40
Address Validation 40
Address <address> is out of range for the specified device or register. 40
Array size is out of range for address <address>. 40
Array support is not available for the specified address: <address>. 40
Data Type <type> is not valid for device address <address>. 41
Device address <address> contains a syntax error. 41
Device address <address> is not supported by model <model name>. 41
Device address <address> is read only. 41
Missing address 41
Received block length of <received length> does not match expected length of <expected length> for
address <address> on device <device>. 41
www. kepware.com
Modbus Serial Driver Help 3
Serial Communications 42
Communications error on <channel name> [<error mask>]. 42
COMn does not exist. 42
COMn is in use by another application. 42
Error opening COMn. 43
Unable to set comm parameters on COMn. 43
Device Status Messages 43
Device <device name> is not responding. 43
Unable to write to address <address> on device <device>: Device responded with exception code
<code>. 44
Unable to write to <address> on device <device name>. 44
Write failed for <tag name> on device <device name>. Maximum path length of <number> exceeded. 44
Modbus Serial Specific Messages 44
Bad address in block [<start address> to <end address>] on device <device name>. 44
Bad array spanning [<address> to <address>] on device <device>. 45
Could not read Omni text buffer due to memory allocation problem. 45
Could not read Omni text report <address> on device <device name> due to packet limit. 45
Error writing Omni text data to file for <tag name> on device <device name> because <reason>. 46
No Omni text archive data available in specified date range on device <device name>. 46
Omni text output file specified for <tag name> on device <device name> could not be opened because
<reason>. 46
Write to Omni text report <address> on device <device name> truncated. 46
Automatic Tag Database Generation Messages 46
Description truncated for import file record number <record>. 47
Error parsing import file record number <record>, field <field>. 47
File exception encountered during tag import. 47
Imported tag name <tag name> is invalid. Name changed to <tag name>. 47
Tag <tag name> could not be imported because data type <data type> is not supported. 47
Tag import failed due to low memory resources. 48
Modbus Exception Codes 48
Index 49
www. kepware.com
4 Modbus Serial Driver Help
CONTENTS
Overview
What is the Modbus 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 are produced by the Modbus Serial driver?
Overview
The Modbus Serial driver provides a reliable way to connect Modbus 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 RTU protocol. The Modbus Serial driver has been developed to support a wide
range of Modbus RTU compatible devices.
www. kepware.com
Modbus Serial Driver Help 5
Channel Setup
Communication Serialization
The Modbus Serial driver supports communication serialization, which specifies whether data transmissions
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 Serial Driver Help
Device Setup
Supported Devices
Modbus compatible devices
Elliott Flow Computer
Magnetek GPD 515 Drive
Omni Flow Computer
Daniel S500 Flow Computer
Dynamic Fluid Meter (DFM) SFC3
TSXCUSBMBP USB Adapter
Communication Protocol
Modbus RTU Protocol
Note: Not all of the listed configurations may be supported in every device.
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 (such as the Lantronix DR1). It may be enabled through
the Communications dialog in Channel Properties. For more information, refer to the main OPC server's help file.
Flow Control
When using an RS232/RS485 converter, the type of flow control that is required will depend on the converter's
needs. Some do not require any flow control whereas others require RTS flow. Consult the converter's
documentation to determine its flow requirements. An RS485 converter that provides automatic flow control is
recommended.
Note: 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.
www. kepware.com
Modbus Serial Driver Help 7
Cable Diagram
For recommended wiring and cable diagrams, refer to the Modbus device manufacturer's documentation. The
Modicon 984 Modbus Controller cable diagram is shown below.
Modem Setup
This driver supports modem functionality. For more information, please refer to the topic "Modem Support" in the
OPC Server Help documentation.
www. kepware.com
8 Modbus Serial Driver Help
Settings
----- Data Access Group -----
<address>.<bit>
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 means the first bit begins at 0. One Based Bit
addressing means that the first bit begins at 1.
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, irrespective 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 deselected, the byte order of the masks sent in the command will be Intel byte
order.
The Use Modbus function 06 selection is used to force the driver to use only Modbus function 16 if needed. By
default, this selection is checked which allows the driver to operate as it has historically, switching between 06
and 16 as needed. If a device requires all writes be done using only Modbus function 16, uncheck this selection.
Note: For bit within word writes, the Holding Register Bit Mask Writes is not selected, then depending on the
selection of this property either function code 0x06 or 0x10 will be used for bit within word writes. When
Holding Register Bit Mask Writes is selected, then function code 0x16 is used no matter what the selection
www. kepware.com
Modbus Serial Driver Help 9
for this property. However, if Holding Register Bit Mask Writes). The Use Modbus Function 06 property takes
precedence over this property.
The Use Modbus function 05 selection is used to force the driver to use only Modbus function 15 if needed.
The default setting is checked. This allows the driver to operate as it has historically, switching between 05 and
15 as needed. If a device requires all writes be done using only Modbus function 15, however, this selection
should be unchecked.
Note: This setting does not apply to the Omni model. It always uses Modbus byte order.
Note: This setting does not apply to the Omni model. It always uses Modbus byte order.
Note: This setting does not apply to the Omni model, which always uses Modbus byte order.
Note: For the following example, the 1st through 16th bit signifies either 0-15 bits or 1-16 bits. This depends on
whether 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
www. kepware.com
10 Modbus Serial Driver Help
Values read above the specified range are not clamped, but the behavior is undefined. All read values are
decoded using the following formula:
[Read Value] = HighWord * 10000 + LowWord.
Written values greater than 99999999 are clamped to the maximum value. All written values are encoded using
the following formula:
Raw Data = [Written Value]/10000 + [Written Value] % 10000.
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 First Word Low in 32-Bit First DWord Low in 64-Bit
Byte Order Applicable Data Types Applicable Data 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
settings of the Data Encoding options. The default settings are correct for the majority of Modbus devices.
www. kepware.com
Modbus Serial Driver Help 11
Block Sizes
l Coils (8-2000 in multiples of 8): This parameter specifies the output and input coils. 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. The block size can be reduced to read data from non-contiguous locations
within the device. The default setting is 32.
l Registers (1-125): This parameter specifies the internal and holding registers. Registers can be read
from 1 to 125 locations (words) at a time. A higher block size means more register values will be read
from the device in a single request. The block size can be reduced to read data from non-contiguous
locations within the device. The default setting is 32.
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 this error, decrease the block size value
to 120.
l Perform Block Read on Strings: When checked, this option will block read string tags (which are
normally read individually). String tags will also be grouped together depending on the selected block
size. Block reads can only be performed for Modbus model string tags. The default setting is unchecked.
www. kepware.com
12 Modbus Serial Driver Help
l Variable Import File: This parameter is used to browse to the exact location of the Concept or ProWORX
variable import file that the driver will use during Automatic Tag Database Generation.
l Include Descriptions: When checked, imported tag descriptions will be used if present in the file.
Note: For more information on configuring the Automatic Tag Database Generation feature (and how to create a
variable import file), refer to Automatic Tag Database Generation.
www. kepware.com
Modbus Serial Driver Help 13
Framing
Some terminal server devices add additional data to Modbus frames; as such, the Framing parameters can be
used to configure the driver to ignore the additional bytes in response messages.
l Use Modbus TCP Framing: When checked, this parameter communicates with native Modbus TCP
devices using Ethernet Encapsulation.
l Leading bytes: This parameter specifies the number of bytes to be attached to the beginning of Modbus
responses. Values may range from 0 to 8.
l Trailing bytes: This parameter specifies the number of bytes to be attached to the end of Modbus
responses. Values may range from 0 to 8.
2. In the Communications tab, select Use Ethernet Encapsulation. This will enable Ethernet
Encapsulation for the channel. Then, click OK.
3. Next, open the device's Device Properties. Descriptions of the parameters are as follows:
l IP Address: This parameter specifies the device's IP address. The default setting is
255.255.255.255.
l Port Number: This parameter specifies the port number. 502 is usually entered for Modbus
TCP devices.
www. kepware.com
14 Modbus Serial Driver Help
l Protocol: This parameter specifies the protocol. The default setting is TCP/IP.
www. kepware.com
Modbus Serial Driver Help 15
Error Handling
The Error Handling parameters determine how to deal with errors from the device.
l Deactivate Tags on Illegal Address Exception: When checked, the driver will stop polling for a block
of data if 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. The default setting is checked.
l Reject Repeated Messages: When checked, the driver will expect repeated messages. When
unchecked, the driver will interpret a repeated message as an invalid response and will retry the request.
The default setting is unchecked.
Note: Some message-relay equipment will echo Modbus requests back to the driver.
www. kepware.com
16 Modbus Serial Driver Help
This driver requires additional settings in addition to the basic settings that are common to all drivers that
support automatic tag database generation. The specialized settings include the name and location of the variable
import file, which can be specified during the Variable Import Settings step of the Device Wizard or later by
selecting 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 is 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 inform users of any
such name changes in the server's Event Log.
User defined data types are not currently supported by this driver. Records in the export file containing
references to such types will be ignored. The table below displays the supported simple data types.
www. kepware.com
Modbus Serial Driver Help 17
Notes:
1. Unlocated variables, which do not correspond to a physical address in the device, will be ignored by the
driver.
2. Comments are allowed and can be included as the generated tag descriptions or not. For more
information, refer to Variable Import Settings.
1. Click File | Export. Then, select the Variables: Text delimited format.
3. Although any filter setting can be chosen, this driver will only be able to read the exported data if the
default semicolon separator is used. Click OK to generate the file.
www. kepware.com
18 Modbus Serial Driver Help
Note: As the ladder program is created, symbolic names for the various data points referenced can be defined
using the Document Editor.
Note: ProWORX does not place many restrictions on variable names. However, the OPC server requires that tag
names consist of only alphanumeric characters and underscores. The first character cannot be an underscore.
The driver will modify invalid imported tag names as needed and inform users of any such name changes in the
server's Event Log.
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 Exporting
Variables from Concept.
3. Descriptors are allowed and may be included as the generated tag descriptions. For more information,
refer to Variable Import Settings.
www. kepware.com
Modbus Serial Driver Help 19
www. kepware.com
20 Modbus Serial Driver Help
Value range is 0-9999. Behavior is undefined for values beyond this range.
LBCD Four byte packed BCD
Value range is 0-99999999. Behavior is undefined for values beyond this range.
String Null terminated ASCII string
Supported on Modbus Model, includes HiLo LoHi byte order selection, 8 Byte and 16 Byte
Omni Flow Computer string data.
Double* 64-bit floating point value
The driver interprets four consecutive registers as a double precision value by making the
last two registers the high DWord and the first two registers the low DWord.
Double Example If register 40001 is specified as a double, bit 0 of register 40001 would be bit 0 of the 64-
bit data type and bit 15 of register 40004 would be bit 63 of the 64-bit data type.
Float* 32-bit floating point value
The driver interprets two consecutive registers as a single precision value by making the
last register the high word and the first register the low word.
Float Example If register 40001 is specified as a float, bit 0 of register 40001 would be bit 0 of the 32-bit
data type and bit 15 of register 40002 would be bit 31 of the 32-bit data type.
*The descriptions assume the default 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 Serial Driver Help 21
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.
Modbus Addressing
Magnetek GPD 515 Drive Addressing
Elliott Flow Computer Addressing
Daniels S500 Flow Computer Addressing
Dynamic Fluid Meter Addressing
Omni Flow Computer Addressing
Statistics
Modbus Addressing
The default data types for dynamically defined tags are shown in bold. The Function Codes are displayed in
decimal. For more information, refer to Function Codes Description.
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,
400001-465535 Float, DWord, Long, LBCD 16
400001-465533 Double
Boolean
www. kepware.com
22 Modbus Serial Driver Help
Function
Address Range Data Type Access*
Code
4xxxxx.0/1-4xxxxx.15/16***
03, 06,
16, 22
Holding Registers As 400001.2H-465536.240H String** Read/Write 03, 16
String with HiLo Byte .Bit is string length, range
Order 2 to 240 bytes.
Holding Registers As 400001.2L-465536.240L String** Read/Write 03, 16
String with LoHi Byte .Bit is string length, range
Order 2 to 240 bytes.
*All Read/Write addresses may be set as Write Only by prefixing a "W" to the address such as "W40001." This
will prevent the driver from reading the register at the specified address. Any attempts by the client to read a
Write Only tag will result in obtaining the last successful write value to the specified address. If no successful
writes have occurred, the client will receive 0/NULL for numeric/string values for an initial value.
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.
H3xxxxx.0/1-H3xxxxx.F/10* Boolean
Internal Registers As H300001.2H-H3FFFF.240H. Bit String** Read Only 04
String with HiLo Byte is string length, range 2 to 240
Order bytes.
Internal Registers As H300001.2L-H3FFFF.240L. Bit String** Read Only 04
String with LoHi Byte is string length, range 2 to 240
Order bytes.
Holding Registers H400001-H410000 H400001- Word, Short, BCD Read/Write 03, 06,
H4FFFF H400001-H4FFFD Float, DWord, Long, LBCD 16
H4xxxxx.0/1-H4xxxxx.F/10* Double
Boolean
03, 06,
16, 22
Holding Registers As H400001.2H-H4FFFF.240H. Bit String** Read/Write 03, 16
String with HiLo Byte is string length, range 2 to 240
Order bytes.
Holding Registers As H400001.2L-H4FFFF.240L. Bit String** Read/Write 03, 16
String with LoHi Byte is string length, range 2 to 240
Order bytes.
*For more information, refer to "Zero vs. One Based Bit Addressing Within Registers" in Settings.
**For more information, refer to String Support.
String Support
The Modbus model supports reading and writing holding register memory as an ASCII string. When using
holding 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
specified by appending either a "H" or "L" to the address.
www. kepware.com
Modbus Serial Driver Help 23
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's length may be limited by the maximum size of the write request that the device will allow. If,
while utilizing a string tag, an error message of "Unable to write to address <address> on device <device>:
Device responded with exception code 3" is received in the server event window, this means that the device did
not like the string's length. If possible, shorten the string.
1. The 255'th output coil would be addressed as '0255' using decimal addressing or 'H0FF' using
hexadecimal addressing.
2. Some documentation refers to Modbus addresses by function code and location. For instance, function
code 3; location 2000 would be addressed as '42000' or 'H47D0'. 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' or 'H064'. 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. The following examples use holding register locations:
For arrays, rows multiplied by cols cannot exceed the block size that has been assigned to the device for the
register/coil type. For register arrays of 32-bit data types, rows multiplied by cols multiplied by 2 cannot exceed
the block size.
where xxxxx is the address of the first coil (decimal and hex values allowed), and nn is the number of coils to be
packed into an analog value (1-16, decimal only).
The bit order will be such that the start address will be the LSB (least significant bit) of analog value.
www. kepware.com
24 Modbus Serial Driver Help
*For more information, refer to "Zero vs. One Based Bit Addressing Within Registers" in Settings.
Example
To access the driver's Operation Status, address 02BH, enter the following address:
H4002B
Note: When adding a Magnetek Device to the OPC Server project, users must make sure that the setting "Use
Zero Based Addressing" is not checked. If this parameter is not set correctly, the Modbus RTU driver will offset all
of the Magnetek addresses by 1.
Array Support
Arrays are supported for holding register locations for all data types except Boolean. There are two methods of
addressing an array. The following examples use holding register locations:
Rows multiplied by cols cannot exceed the block size that has been assigned to the device for the register type.
3xxxxx.0/1-3xxxxx.15/16* Boolean
Holding Registers 400001-465536 Word, Short, BCD** Read/Write
400001-465535 Float, DWord, Long, LBCD
4xxxxx.0/1-4xxxxx.15/16* Boolean
*For more information, refer to "Zero vs. One Based Bit Addressing Within Registers" in Settings.
**Address ranges 405001 to 405315 and 407001 to 407315 are 32-bit registers. Addresses in the range of
405001 to 405315 use a default data type of Long. Addresses in the range of 407001 to 407315 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.
Array Support
Arrays are supported for internal and holding register locations for all data types except Boolean. There are two
methods of addressing an array. The following examples use 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.
Hex Decimal
Address Data Type Function Codes Access
Range Range
Totals 000-0FF 4096-4351 Double 03 Read Only
www. kepware.com
Modbus Serial Driver Help 25
Hex Decimal
Address Data Type Function Codes Access
Range Range
Calculated /Measured 100-24F 4352-4687 Float 03, 16 Read/Write
Variables
Calculation Constants 250-28F 4688-4751 Float 03, 16 Read/Write
Keypad Default Values 290-2AF 4752-4783 Float 03, 16 Read/Write
Alarm and Scaling Constants 2B0-5FF 4784-5631 Float 03, 16 Read/Write
Status /Control 700-7FF 5888-6143 Boolean 01, 05 Read/Write
Alarms 800-FFF 6144-8191 Boolean 02 Read Only
Boolean
Holding Registers (32 bit) 407001-408000 Float Read/Write
Holding Registers As 400000.2H-407000.240H String Read/Write
String 408001.2H-465535.240H
with HiLo Byte Order
.Bit is string length, range 2 to 240
bytes.
Holding Registers As 400000.2L-407000.240L String Read/Write
String 408001.2L-465535.240L
with LoHi Byte Order
.Bit is string length, range 2 to 240
bytes.
*For more information, refer to "Zero vs. One Based Bit Addressing Within Registers" in Settings.
Boolean
Holding Registers (32 bit) H401B59-H401F40 Float Read/Write
Holding Registers As H400000.2H-H401B58.240H String Read/Write
String H401F41.2H-H40FFFF.240H
with HiLo Byte Order
.Bit is string length, range 2 to 240
bytes.
Holding Registers As H400000.2L-H401B58.240L String Read/Write
String H401F41.2L-H0FFFF.240L
with LoHi Byte Order
.Bit is string length, range 2 to 240
bytes.
www. kepware.com
26 Modbus Serial Driver Help
*For more information, refer to "Zero vs. One Based Bit Addressing Within Registers" in Settings.
Note: This driver requires that all addresses begin with "4" for the Dynamic Fluid Meter model. This 4 may not
always be written explicitly in the Dynamic Fluid Meter documentation. For example, users may see a reference to
"Unit ID at address 3001". This value must be addressed in the server as "403001".
String Support
The Dynamic Fluid Meter model supports reading and writing holding register memory as an ASCII string. When
using holding 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 specified by appending either a "H" or "L" to the address.
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's length may be limited by the maximum size of the write request that the device will allow. If,
while utilizing a string tag, an error message of "Unable to write to address <address> on device <device>:
Device responded with exception code 3" is received in the server event window, this means the device did not
like the string's length. If possible, try shortening the string.
www. kepware.com
Modbus Serial Driver Help 27
www. kepware.com
28 Modbus Serial Driver Help
Packet Configuration
Each custom packet may contain up to twenty groups of data points. Each group is defined by its starting index
and the number of data points. The total size of the custom packet must not exceed 250 bytes. The addresses
used to define the custom packets are listed below.
to
www. kepware.com
Modbus Serial Driver Help 29
to
to
Note: Data is returned from the device as 16-bit registers. Digital I/O must be mapped in blocks of 16 bits.
*For more information, refer to "Zero vs. One Based Bit Addressing Within Registers" in Settings.
Notes:
2. If a 16 character ASCII string data address is contained in group configuration, then data can be read as
two 8 character ASCII string data items.
Example
Define Custom Packet #1 to map to the following:
Note: This will make a total of 222 bytes. The custom packet configuration registers would have the following
values:
3001 = 1001
3002 = 16
3003 = 5101
3004 = 15
3005 = 7001
3006 = 12
3007 = 4101
3008 = 4
3009 = 4808
3010 = 6
www. kepware.com
30 Modbus Serial Driver Help
3011 = 14001
3012 = 2
Tags to access the Digital I/O data would have the following addresses (all 16 values contained in word 0):
CP1_0.0 (Word 0 of Custom Packet 1, bit 0-mapped to 1009)
CP1_0.1 (Word 0 of Custom Packet 1, bit 1-mapped to 1010)
...
CP1_0.6 (Word 0 of Custom Packet 1, bit 6-mapped to 1015)
CP1_0.7 (Word 0 of Custom Packet 1, bit 7-mapped to 1016)
CP1_0.8 (Word 0 of Custom Packet 1, bit 8-mapped to 1001)
CP1_0.9 (Word 0 of Custom Packet 1, bit 9-mapped to 1002)
...
CP1_0.14 (Word 0 of Custom Packet 1, bit 14-mapped to 1007)
CP1_0.15 (Word 0 of Custom Packet 1, bit 15-mapped to 1008)
Tags to access the Meter Run 1 Batch data would have the following addresses (each 32-bit value uses 2 words):
CP1_1 (Word 1 of Custom Packet 1-mapped to 5101)
CP1_3 (Word 3 of Custom Packet 1-mapped to 5102)
...
CP1_29 (Word 29 of Custom Packet 1-mapped to 5115)
Tags to access the Analog Output data would have the following addresses (each 32-bit value uses 2 words):
CP1_31 (Word 31 of Custom Packet 1-mapped to 7001)
CP1_33 (Word 33 of Custom Packet 1-mapped to 7002)
...
CP1_53 (Word 53 of Custom Packet 1-mapped to 7012)
Tags to access the Meter Run 8 character ASCII String data would have the following addresses (each String
value uses 4 words):
CP1_55 (Word 55 of Custom Packet 1-mapped to 4101)
...
CP1_67 (Word 67 of Custom Packet 1-mapped to 4104)
Tags to access the Meter Station 8 character ASCII String data would have the following addresses (each String
value uses 4 words):
CP1_71 (Word 71 of Custom Packet 1-mapped to 4808)
...
CP1_91 (Word 91 of Custom Packet 1-mapped to 4813)
Tags to access the Flow Configuration 16 character ASCII String data would have the following addresses (each
String value uses 4 words):
CP1_95 (Word 95 of Custom Packet 1-mapped to 14001 characters 1-8)
CP1_99 (Word 99 of Custom Packet 1-mapped to 14001 characters 9-16)
CP1_103 (Word 103 of Custom Packet 1-mapped to 14002 characters 1-8)
CP1_107 (Word 107 of Custom Packet 1-mapped to 14002 characters 9-16)
Each record may contain up to sixteen groups of data points. Each group is defined by its starting index and the
number of data points. The addresses used to define the archive records are listed below. The total size of the
record must not exceed 250 bytes. The device will use the first 6 bytes for date and time stamp data, leaving 244
bytes for raw data. Each record will have its own Boolean trigger. Data will be stored when the trigger goes from
low to high.
Before a group starting index, number of points in group or trigger for a raw data archive can be changed,
archiving must halt. The Allow Archive Configuration Flag must be set in the device. Be aware that doing this
will likely cause the data archive in the device to be reinitialized, including all Raw Data Archives and the Text
Archive.
www. kepware.com
Modbus Serial Driver Help 31
This driver may be used to read a Raw Data Archive one record at a time. To read a record, first write the desired
record index to the "Requested record" register. Once this value is set, users may read the record with an "RA"
tag. Users should ensure that the specified record index does not exceed the maximum number of records
allowed for that archive. If the "Last record updated" value is zero, there have been no records saved in the
archive since it was last initialized.
to
to
to
to
www. kepware.com
32 Modbus Serial Driver Help
to
to
to
to
to
www. kepware.com
Modbus Serial Driver Help 33
to
Note: Data is returned from the device as 16-bit registers. Digital I/O must be mapped in blocks of 16 bits.
*For more information, refer to "Zero vs. One Based Bit Addressing Within Registers" in Settings.
Notes:
2. If a 16 character ASCII string data address is contained in group configuration, then data can be read as
two 8 character ASCII string data items.
Timestamp Format
The first 6 bytes of each record contains the time and date that the record was placed in the archive.
Byte Description
1 Month (1-12)*
Day (1-31)
2 Day (1-31)*
Month (1-12)
3 Year (0-99)
4 Hour (0-23)
www. kepware.com
34 Modbus Serial Driver Help
5 Minute (0-59)
6 Seconds (0-59)
Alarm Types
Type Description
0 Log event, sound beeper and display in LCD any edge change in bit identified by filed #3.
1 Log event, sound beeper and display in LCD rising edge changes in bit identified by filed #3.
2 Event Log any edge change in bit identified by field #3. No beeper or LCD display action.
3 Event Log rising edge changes in bit identified by field #3. No beeper or LCD display action.
Note: Fields 5 and 6 are set to 0.0 when the variable type changed is a string. Fields 7 and 8 contain null
characters when the variable type change is not a string. When fields 7 and 8 contain 8 character strings, the
remaining 8 characters are padded with nulls.
www. kepware.com
Modbus Serial Driver Help 35
Example
To read or write to the Snapshot Report Template (address 9001), create a tag with address "TR9001".
Note: Because it can take several seconds to read a Text Report, the "TR" tags should be kept inactive in the OPC
client. Alternatively, triggered reads can be used instead. No other tags on the channel can be read or written to
while the driver is reading or writing a Text Report.
A triggered read may not begin immediately depending on when in the Text Report tag's update cycle the trigger
is set. After the read attempt has been completed, the driver will clear the trigger state. The Text Report tag will
show the value and data quality that resulted from the last triggered read attempt.
Example
To read the Last Batch Report (address 9101) on trigger, create two tags. The first is a Text Report tag with
address "TR9101 T", and the second is a Text Report Read Trigger tag with address "TRIG_TR9101".
Note: The Text Report tag address looks like a normal Text Report address followed by a space and the letter "T"
for "triggered read". This "T" must be present in the address for triggered reads to work.
To trigger a read, set the trigger tag value to true (non-zero). After the read attempt has been completed, the
driver will set the trigger value to false (0). If the read was successful, the Text Report tag's data quality will be
Good. If the read failed, the Text Report tag's data quality will be Bad, and the value will be the last value
successfully read.
The path buffers are initialized to empty strings on server start up. The driver will not write Text Report data to
file until a valid path is saved in the associated path buffer. Path data is not persistent. The path strings must be
www. kepware.com
36 Modbus Serial Driver Help
rewritten each time the server is restarted. The path values can be changed at any time, allowing users to save
data to different files on each read if desired.
Example
To read the Last Batch Report (address 9101) and save the result to disk, create two tags. The first is a Text
Report tag with address "TR9101", and the second is a path tag with address "PATH_TR9101".
To save the report data in a file called "LastBatch.txt" (which is to be created in the folder
"C:\OmniData\BatchReports") set up the client so that the first thing that it does is write
"C:\OmniData\BatchReports\LastBatch.txt" to the path tag. Once this is done, read the Text Report tag. If the
path is not set before the first read of the Text Report, the driver will not be able to save the data to disk.
Note: To disable this feature, write a empty string to the path tag.
Note: Because it can take several minutes to read a Text Archive, the "TA" tag should be kept inactive in the OPC
client. Alternatively, triggered reads can be used instead. This tag should only be read using asynchronous
reads, since the maximum synchronous read timeout cannot be increased high enough in the server to read a
typical text archive request. No other tags on the channel can be read or written to while the Text Archive is being
read.
If a Text Archive read fails midway, users should reset the device's read buffer by writing 999 to the number of
days register (15127), and then repeat the normal Text Archive read procedure. Otherwise, the driver may not
get the first part of the requested archive range.
A triggered read may not begin immediately depending on when in the Text Archive tag's update cycle the trigger
is set. After the read attempt has been completed, the driver will clear the trigger state. The Text Archive tag will
show the value and data quality that resulted from the last triggered read attempt.
Example
www. kepware.com
Modbus Serial Driver Help 37
To read the Text Archive on trigger, create two tags. The first is a Text Archive tag with address "TA T", and the
second is a Text Archive Read Trigger tag with address "TRIG_TA". Users will also have to create start date and
number of days tags.
Note: The Text Archive tag address looks like a normal Text Archive address followed by a space and the letter
"T" for "triggered read". This "T" must be present in the address for triggered reads to work.
To trigger a read, set the trigger tag value to true (non-zero). After the read attempt has been completed, the
driver will set the trigger value to false (0). If the read was successful, the Text Archive tag's data quality will be
Good. If the read failed, the Text Archive tag's data quality will be Bad and the value will be the last value
successfully read.
The path buffer is initialized to an empty string on server start up. The driver will not write Text Archive data to
file until a valid path is saved in the associated path buffer. Path data is not persistent. Users will have to rewrite
the path string each time the server is restarted. The path value can be changed at any time, allowing the data to
be saved to different files on each read (if desired).
Example
To read the Text Archive and save the result to disk, create two tags. The first is a Text Archive tag with address
"TA", and the second is a path tag with address "PATH_TA". Users will also have to create start date and number
of days tags as described above.
To save the Text Archive data in a file called "TextArchive.txt" (which is to be created in the folder
"C:\OmniData\ArchiveData") set up the client so that the first thing that it does is write
"C:\OmniData\ArchiveData\TextArchive.txt" to the path tag. Once this is done, read the Text Archive tag. If the
path is not set before the first read of the Text Archive, the driver will not be able to save the data to disk.
Note: To disable this feature, write a empty string to the path tag.
www. kepware.com
38 Modbus Serial Driver Help
Statistics Items
Statistical items use data collected through additional diagnostics information, which is not collected by default.
To use statistical items, Communication Diagnostics must be enabled. To enable Communication Diagnostics,
right-click on the channel in the Project View and click Properties | Enable Diagnostics. Alternatively, double-
click on the channel and select Enable Diagnostics.
Note: Statistics at the channel level are the sum of those same items at the device level.
www. kepware.com
Modbus Serial Driver Help 39
www. kepware.com
40 Modbus Serial Driver Help
Error Descriptions
The following categories of messages may be generated. Click on the link for a list of the messages.
Address Validation
Serial Communications
Device Status Messages
Modbus Serial Specific Messages
Automatic Tag Database Generation Messages
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
Address <address> is out of range for the specified device or register.
Array size is out of range for address <address>.
Array support is not available for the specified address: <address>.
Data Type <type> is not valid for device address <address>.
Device address <address> contains a syntax error
Device address <address> is not supported by model <model name>.
Device address <address> is read only.
Missing address.
Received block length of <received length> does not match expected length of <expected length>
for address <address> on device <device>.
Possible Cause:
A tag address that has been specified statically references a location that is beyond the range of supported
locations 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 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
support arrays.
Solution:
Re-enter the address in the client application to remove the array reference or correct the address type.
www. kepware.com
Modbus Serial Driver Help 41
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 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 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 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.
Missing address
Error Type:
Warning
Possible Cause:
A tag address that has been specified statically has no length.
Solution:
Re-enter the address in the client application.
Received block length of <received length> does not match expected length of
<expected length> for address <address> on device <device>.
Error Type:
Warning
Possible Cause:
www. kepware.com
42 Modbus Serial Driver Help
The driver attempted to read a block of memory but the PLC did not provide the driver with the requested size of
data. No error code was returned.
Solution:
N/A
Serial Communications
The following error/warning messages may be generated. Click on the link for a description of the message.
Serial Communications
Communications error on <channel name> [<error mask>].
COMn does not exist.
COMn is in use by another application.
Error opening COMn.
Unable to set comm parameters on COMn.
Possible Cause:
1. The serial connection between the device and the Host PC is bad.
Solution:
2. Verify that the specified communications parameters match those of the device.
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 serial port assigned to a device is being used by another application.
Solution:
www. kepware.com
Modbus Serial Driver Help 43
1. Verify that the correct port has been assigned to the channel.
Possible Cause:
The specified COM port could not be opened due an internal hardware or software problem on the target
computer.
Solution:
Verify that the COM port is functional and may be accessed by other Windows applications.
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 broken.
3. The named device may have been assigned an incorrect Network ID.
4. The response from the device took longer to receive than the amount of time specified in the "Request
Timeout" device setting.
Solution:
3. Verify the Network 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
44 Modbus Serial Driver Help
Possible Cause:
See Modbus Exception Codes for a description of the exception code.
Solution:
See Modbus Exception Codes.
Possible Cause:
1. The serial connection between the device and the host PC is broken.
3. The named device may have been assigned an incorrect network ID.
Solution:
3. Verify that the Network ID given to the named device matches that of the actual device.
Write failed for <tag name> on device <device name>. Maximum path length
of <number> exceeded.
Error Type:
Warning
Possible Cause:
Path length is limited to the indicated number of characters.
Solution:
Devise a shorter path.
www. kepware.com
Modbus Serial Driver Help 45
Possible Cause:
1. An attempt has been made to reference a nonexistent location in the specified device.
2. An attempt has been made to read more registers than allowed by the protocol.
Solution:
1. Verify the tags assigned to addresses in the specified range on the device and eliminate ones that
reference invalid locations.
See Also:
Error Handling
Block Sizes
Possible Cause:
1. An attempt has been made to reference a nonexistent location in the specified device.
2. An attempt has been made to read more registers than allowed by the protocol.
Solution:
1. Verify that all the register addresses requested in the array exist in the device and reduce the array size
such that only valid addresses (that exist in the device) are requested by the array.
See Also:
Error Handling
Block Sizes
Could not read Omni text buffer due to memory allocation problem.
Error Type:
Serious
Possible Cause:
The driver could not allocate memory required for an Omni Text Record or Text Archive read operation.
Solution:
Shutdown all unnecessary applications and then retry.
Could not read Omni text report <address> on device <device name> due to
packet limit.
Error Type:
Serious
Possible Cause:
Text reports are expected to be 8192 bytes or less. This is a limit imposed by the protocol. The driver read 8192
bytes before encountering the expected end of file character.
Solution:
Verify that the report template used by the device will generate reports of 8192 bytes or less.
www. kepware.com
46 Modbus Serial Driver Help
Error writing Omni text data to file for <tag name> on device <device name>
because <reason>.
Error Type:
Warning
Possible Cause:
The driver could not write the Omni text data to disk for the indicated reason.
Solution:
The operating system supplies the reason indicated. The reason should determine appropriate corrective
measures.
No Omni text archive data available in specified date range on device <device
name>.
Error Type:
Warning
Possible Cause:
No data was stored in the text archive for the date range specified by the Start Date register (15128) and the
Number of Days register (15127).
Solution:
This is not necessarily an error.
Omni text output file specified for <tag name> on device <device name> could
not be opened because <reason>.
Error Type:
Warning
Possible Cause:
The file specified in an Omni Text Path tag could not be created or opened.
Solution:
The operating system supplies the reason indicated. The reason should determine appropriate corrective
measures. The most likely cause is an invalid path.
See Also:
Omni Text Reports
Omni Text Archive
Write to Omni text report <address> on device <device name> truncated.
Error Type:
Serious
Possible Cause:
An attempt was made to write more than 8192 bytes to a text report. This is a limit imposed by the protocol.
Solution:
Do not write strings greater than the 8192 byte limit. If the string is longer, only the first 8192 characters will be
written to the device.
www. kepware.com
Modbus Serial Driver Help 47
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.
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 variable import file could not be read.
Solution:
Regenerate the variable import file.
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).
Tag <tag name> could not be imported because data type <data type> is not
supported.
Error Type:
Warning
Possible Cause:
The driver does not support the data type specified in the variable import file.
Solution:
Change the data type specified in the variable import file to one that is supported. If the variable is for a
structure, manually edit the file to define each tag required for the structure. Alternatively, configure the
required tags manually in the OPC server.
See Also:
Exporting Variables from Concept
www. kepware.com
48 Modbus Serial Driver Help
Possible Cause:
The driver could not allocate memory required to process variable import file.
Solution:
Shut down all unnecessary applications and then retry.
Note: For this driver, the terms Slave and Unsolicited are used interchangeably.
www. kepware.com
Modbus Serial Driver Help 49
Index
Bad address in block [<start address> to <end address>] on device <device name>. 44
Bad array spanning [<address> to <address>] on device <device>. 45
BCD 20
Block Size 6
Block Sizes 11
Boolean 20
Cable Diagram 7
Channel Setup 5
Channels, maximum 6
Coils 21
Communications error on <channel name> [<error mask>] 42
COMn does not exist. 42
COMn is in use by another application. 42
Could not read Omni text buffer due to memory allocation problem. 45
Could not read Omni text report <address> on device <device name> due to packet limit. 45
www. kepware.com
50 Modbus Serial Driver Help
Imported tag name <tag name> is invalid. Name changed to <tag name>. 47
LBCD 20
Long 20
Network 6
No Omni text archive data available in specified date range on device <device name>. 46
Parity 42
www. kepware.com
Modbus Serial Driver Help 51
Received block length of <received length> does not match expected length of <expected length> for address
<address> on device <device>. 41
Registers 21
Serial Communications 42
Settings 8
Short 20
Statistics Items 38
Tag <tag name> could not be imported because data type <data type> is not supported. 47
Tag import failed due to low memory resources. 48
Word 20
Write failed for <tag name> on device <device name>. Maximum path length of <number> exceeded. 44
Write to Omni text report <address> on device <device name> truncated. 46
www. kepware.com