Appendix B        Modbus CSV Import Files

B.1       Modbus RTU Master Read/Write Maps

The CSV file for configuring Modbus TCP client read and write maps should contain a single header line with the labels indicated below, and content as applicable.

Header Line Label
Notes
Description of Use
RW
-
Enter 'R' to Read from a remote device, or 'W' to Write to a remote device.
TYPE
-
Use this column to specify remote registers by type (see Reference B)
REG
-
Use this column in conjunction with Type to specify remote register numbers of the selected type. Note that register numbers are 1-indexed, meaning raw address 0 should be entered as register #1.
FORMAT
-
Specify the format of the remote register to be read or written (see Reference C)
SLAVE
-
Provide the slave address, ID, or unit number, of the Modbus RTU slave to be polled.
SWAP
-
Any data item that occupies more than one Modbus register, e.g. 32-bit or Float, needs to have the register order defined since this is not standardized by Modbus protocol. The ValuPoints default to the high order register first. If the remote Modbus slave has its registers ordered with low order first, then select 'T' (True) to "swap" the register order (or 'F' to keep the default order).
SCALE
-
Data is multiplied by this scale factor after read from a remote device or before being written to a remote device.
OFFSET
-
This offset is added to the data value after read from a remote device or before being written to a remote device.
POLL
-
Specify a periodic poll time in seconds (fractions of sections are recognized).
LOCALREG
-
Specify a local Modbus register number where data read from a remote device will be placed, or where data written to a remote device will be taken from.
MASK
-
When READING: If a bit mask is entered (in hexadecimal), and the remote register type is signed or unsigned integer, the mask will be bit-wise logical AND-ed with the data, and the retained bits will be right justified in the result.

When WRITING: If a bit mask is entered, and the remote register type is signed or unsigned, the mask will be bit-wise logical AND-ed with the data. The mask is right justified, then AND-ed with the data. The result is then left shifted back to the original position of the mask. In other words, the least significant bits of the original data will be stuffed at the position marked by the mask.

DEFAULT
-
When READING: The default value will be stored into the local object/register after the given number of read failures if the fail count (MAXFAIL) is non-zero.

When WRITING: The default value will be stored into the local object/register if POR is set to True, or if the amount of time specified by TIMEOUT is exceeded without an update to the local object by a remote client.

MAXFAIL
1
If non-zero, sets the maximum number of times that a read attempt may fail before the default value will be placed in the local object/register. Setting the count to zero will disable the default, and the object/register will retain the most recent value obtained.
FILL
2
When WRITING: The bit fill will be logically OR-ed into the result, but only if the mask was nonzero and was used. Both mask and fill are entered in hexadecimal.
MAXQUIET
2
If using 'send on delta', to guarantee that the remote device will be written at least occasionally even if the data does not change, enter a maximum quiet time (in seconds).
MINQUIET
2
If using 'send on delta', and the delta increment is small, the result can be a large amount of network traffic. To limit network traffic, provide a MINQUIET time (in seconds) that must elapse between transmission of changed values.
DELTA
2
The local object/register data may be written to the remote device periodically, or when the local value changes, or both. To send upon change (send on delta), provide a DELTA value as the amount by which the local object/register must change before being written to the remote device. Leave blank if send on delta should not be used.

The minimum required header line for Modbus RTU must include RW, LOCALREG, TYPE, REG, FORMAT, and SLAVE. All other columns are optional.

This is an example of a minimum CSV file as it would appear in a spread sheet program:

This is an example of how the minimum CSV file looks as just plain text:

B.2       Modbus TCP Client Read/Write Maps

The CSV file for configuring Modbus TCP client read and write maps should contain a single header line with the labels indicated below, and content as applicable.

The only difference between TCP and RTU formats is DEVNUM and UNIT in TCP, versus just SLAVE in RTU. Everything else is identical.

Header Line Label
Notes
Description of Use
RW
-
Enter 'R' to Read from a remote device, or 'W' to Write to a remote device.
TYPE
-
Use this column to specify remote registers by type (see Reference B)
REG
-
Use this column in conjunction with Type to specify remote register numbers of the selected type. Note that register numbers are 1-indexed, meaning raw address 0 should be entered as register #1.
FORMAT
-
Specify the format of the remote register to be read or written (see Reference C)
DEVNUM
-
Specify the device number where the remote register is to be found. This number is used to look up a device in the Modbus TCP Client Device table which contains the device's IP address, etc.
UNIT
-
Unit number is optional, and may be 1 to 247. (BB2-6010, BB2-7010 only)
SCALE
-
Data is multiplied by this scale factor after read from a remote device or before being written to a remote device.
OFFSET
-
This offset is added to the data value after read from a remote device or before being written to a remote device.
POLL
-
Specify a periodic poll time in seconds (fractions of sections are recognized).
LOCALREG
-
Specify a local Modbus register number where data read from a remote device will be placed, or where data written to a remote device will be taken from.
MASK
-
When READING: If a bit mask is entered (in hexadecimal), and the remote register type is signed or unsigned integer, the mask will be bit-wise logical AND-ed with the data, and the retained bits will be right justified in the result.

When WRITING: If a bit mask is entered, and the remote register type is signed or unsigned, the mask will be bit-wise logical AND-ed with the data. The mask is right justified, then AND-ed with the data. The result is then left shifted back to the original position of the mask. In other words, the least significant bits of the original data will be stuffed at the position marked by the mask.

DEFAULT
-
When READING: The default value will be stored into the local object/register after the given number of read failures if the fail count (MAXFAIL) is non-zero.

When WRITING: The default value will be stored into the local object/register if POR is set to True, or if the amount of time specified by TIMEOUT is exceeded without an update to the local object by a remote client.

MAXFAIL
1
If non-zero, sets the maximum number of times that a read attempt may fail before the default value will be placed in the local object/register. Setting the count to zero will disable the default, and the object/register will retain the most recent value obtained.
FILL
2
When WRITING: The bit fill will be logically OR-ed into the result, but only if the mask was nonzero and was used. Both mask and fill are entered in hexadecimal.
MAXQUIET
2
If using 'send on delta', to guarantee that the remote device will be written at least occasionally even if the data does not change, enter a maximum quiet time (in seconds).
MINQUIET
2
If using 'send on delta', and the delta increment is small, the result can be a large amount of network traffic. To limit network traffic, provide a MINQUIET time (in seconds) that must elapse between transmission of changed values.
DELTA
2
The local object/register data may be written to the remote device periodically, or when the local value changes, or both. To send upon change (send on delta), provide a DELTA value as the amount by which the local object/register must change before being written to the remote device. Leave blank if send on delta should not be used.

The minimum required header line for Modbus TCP must include RW, LOCALREG, TYPE, REG, FORMAT, and DEVNUM. All other columns are optional.

B.3       Register Types

The content of the TYPE column should contain one of the following CSV Labels:

CSV Label Modbus Register Type
Function Code for Read
Function Code for Write
COIL Coil (1 bit)
1
5 or 15
DISC Discrete Input (1 bit)
2
n/a
INPUT Input Register (16 bits)
4
n/a
HOLD Holding Register (16 bits)
3
6 or 16

B.4       Register Formats

The content of the FORMAT column should contain one of the following CSV Labels:

CSV Label Modbus Register Data Format
Occupies # Registers
S16 Signed 16-bit Integer
1
U16 Unsigned 16-bit Integer
1
S32 Signed 32-bit Integer
2
U32 Unsigned 32-bit Integer
2
FP Floating Point, IEEE 754 32-bit
2
BIT Bit (only used for Coil or Discrete Input registers)
-
MOD102 Mod-10, 2-register
2
MOD103 Mod-10, 3-register
3
MOD104 Mod-10, 4-register
4
S64 Signed 64-bit Integer
4