Modbus is an application-level messaging protocol that provides client-server communication between devices connected on different types of buses or networks. You can create a Modbus or Modbus Slave I/O server to read data from or write data to Modbus devices.

For example, you can create a Modbus Slave I/O server on a real-time controller and use this controller as a Modbus slave device. You also can create a Modbus I/O server on a host computer and use this server as a Modbus master device to communicate with a Modbus slave device.

Note

Use the View I/O Items dialog box to view the data items to which the I/O server can read or write. You also can monitor these data items by using the Distributed System Manager. To launch the System Manager from LabVIEW, select Tools»Distributed System Manager.

Modbus I/O servers use six-digit addresses. You can convert a five-digit address to a six-digit address by adding a zero between the first and the second digits of the five-digit address. For example, you can convert address 45001 to 405001.

Modbus and Modbus Slave I/O server data items use the following denotations:

  • A—Denotes an array.
  • D—Denotes a 32-bit unsigned integer.
  • F—Denotes a 32-bit floating-point number.
  • L—Denotes the length of an array. The Maximum Data Points Per Command values that you specify in the Advanced Attribute Settings dialog box determine the maximum length of the array. If the array elements are 32-bit integers or floating-point numbers, the maximum length of the array is half the value you specify for the corresponding Maximum Data Points Per Command value.
  • S—Denotes a 16-bit signed integer.
  • SD—Denotes a 32-bit signed integer.
  • The following table lists the data items that a Modbus or Modbus Slave I/O server supports. The Example column of this table explains the relationship between data items and their physical I/O point addresses on a Modbus device. This column uses the following format: Data Item = {I/O point address}. Note that one 32-bit data item occupies two I/O points.
    Note When reading or writing valid and invalid data items simultaneously, Modbus and Modbus Slave I/O servers identify all data items as invalid.
    Data ItemData TypeModbus ReadModbus WriteModbus Slave ReadModbus Slave WriteDescriptionExample
    000001–065535Boolean valueYesYesYesYesAccesses single-bit coils.000001 = {000001}
    100001–165535Boolean valueYesNoYesYesAccesses single-bit discrete inputs.100002 = {100002}
    300001.1–365535.16Boolean valueYesNoYesYesAccesses individual bits of input registers and interprets them as logical TRUE or FALSE values. The least significant bit is 1. The most significant bit is 16.300001.1 = {the first bit of 300001}
    300001–36553516-bit unsigned integerYesNoYesYesAccesses 16-bit input registers as unsigned integers ranging from 0 to 65,535.300001 = {300001}
    400001.1–465535.16Boolean valueYesNoYesYesAccesses individual bits of holding registers and interprets them as logical TRUE or FALSE values. The least significant bit is 1. The most significant bit is 16.400002.16 = {the 16th bit of 400002}
    400001–46553516-bit unsigned integerYesYesYesYesAccesses 16-bit holding registers as unsigned integers ranging from 0 to 65,535.400002 = {400002}
    A000001L1–A065535L1Array of Boolean valuesYesYesYesYesAccesses arrays of single-bit coils.A000001L2 = {000001, 000002}
    A100001L1–A165535L1Array of Boolean valuesYesNoYesYesAccesses arrays of single-bit discrete inputs.A100005L3 = {100005–100007}
    A300001L1–A365535L1Array of 16-bit unsigned integersYesNoYesYesAccesses arrays of 16-bit input registers as arrays of unsigned integers.A300001L2 = {300001, 300002}
    A400001L1–A465535L1Array of 16-bit unsigned integersYesYesYesYesAccesses arrays of 16-bit holding registers as arrays of unsigned integers.A400005L3 = {400005–400007}
    AD300001L1–AD365534L1Array of 32-bit unsigned integersYesNoYesYesAccesses arrays of 32-bit unsigned integers. Each 32-bit unsigned integer in the array is composed of two adjacent 16-bit input registers.AD300001L1 ={300001, 300002}
    AD400001L1–AD465534L1Array of 32-bit unsigned integersYesYesYesYesAccesses arrays of 32-bit unsigned integers. Each 32-bit unsigned integer in the array is composed of two adjacent 16-bit holding registers.AD400002L3 = {400002–400007}
    AF300001L1–AF365534L1Array of 32-bit floating-point numbersYesNoYesYesAccesses arrays of 32-bit floating-point numbers. Each 32-bit floating-point number in the array is composed of two adjacent 16-bit input registers.AF300001L2 = {300001–300004}
    AF400001L1–AF465534L1Array of 32-bit floating-point numbersYesYesYesYesAccesses arrays of 32-bit floating-point numbers. Each 32-bit floating-point number in the array is composed of two adjacent 16-bit holding registers.AF400002L3 = {400002–400007}
    AS300001L1–AS365535L1Array of 16-bit signed integersYesNoYesYesAccesses arrays of 16-bit input registers as arrays of signed integers.AS300001L1 = {300001}
    AS400001L1–AS465535L1Array of 16-bit signed integersYesYesYesYesAccesses arrays of 16-bit holding registers as arrays of signed integers.AS400002L3 = {400002–400004}
    ASD300001L1–ASD365534L1Array of 32-bit signed integersYesNoYesYesAccesses arrays of 32-bit signed integers. Each 32-bit signed integer in the array is composed of two adjacent 16-bit input registers.ASD300001L1 = {300001, 300002}
    ASD400001L1–ASD465534L1Array of 32-bit signed integersYesYesYesYesAccesses arrays of 32-bit signed integers. Each 32-bit signed integer in the array is composed of two adjacent 16-bit holding registers.ASD400002L3 = {400002–400007}
    CommFailBoolean valueYesNoYesNoRepresents a signal the Modbus I/O server generates. The signal is TRUE in the following cases:
    • Errors occur when the Shared Variable Engine fails to communicate with a Modbus device.
    • Errors occur on the serial ports or Ethernet interface of a Modbus Slave I/O server.
    N/A
    D300001–D36553432-bit unsigned integerYesNoYesYesAccesses two adjacent 16-bit input registers as one 32-bit unsigned integer ranging from 0 to 4,294,967,295.D300001 = {300001, 300002}
    D400001–D46553432-bit unsigned integerYesYesYesYesAccesses two adjacent 16-bit holding registers as one 32-bit unsigned integer ranging from 0 to 4,294,967,295.D400002 = {400002, 400003}
    ErrorStatus32-bit signed integerN/AN/AYesNoRepresents the error status of the Modbus Slave I/O server. If CommFail is FALSE, this data item is 0. If CommFail is TRUE, this data item returns an error code.N/A
    F300001–F36553432-bit floating-point numberYesNoYesYesAccesses two adjacent 16-bit input registers as one 32-bit floating-point number.F300001 = {300001, 300002}
    F400001–F46553432-bit floating-point numberYesYesYesYesAccesses two adjacent 16-bit holding registers as one 32-bit floating-point number.F400002 = {400002, 400003}
    OffHookBoolean valueYesYesN/AN/ASpecifies that a Modbus object retain exclusive use of a communication port when the value of OffHook is TRUE. If the value is FALSE, the Modbus object does not retain exclusive use of the communication port. Modbus Slave I/O servers do not support this data item.N/A
    S300001–S36553516-bit signed integerYesNoYesYesAccesses 16-bit input registers as signed integers ranging from –32,768 to 32,767.S300001 = {300001}
    S400001–S46553516-bit signed integerYesYesYesYesAccesses 16-bit holding registers as signed integers ranging from –32,768 to 32,767.S400002 = {400002}
    SD300001–SD36553432-bit signed integerYesNoYesYesAccesses two adjacent 16-bit input registers as one 32-bit signed integer ranging from –2,147,483,648 to 2,147,483,647.SD300001 = {300001, 300002}
    SD400001–SD46553432-bit signed integerYesYesYesYesAccesses two adjacent 16-bit holding registers as one 32-bit signed integer ranging from –2,147,483,648 to 2,147,483,647.SD400002 = {400002, 400003}
    UpdateNowBoolean valueNoYesN/AN/ASpecifies that the Modbus I/O server refresh the Modbus device once if the value of UpdateNow changes from FALSE to TRUE. Modbus Slave I/O servers do not support this data item.N/A
    UpdateRate64-bit floating-point numberYesYesN/AN/ASpecifies how often the Modbus I/O server refreshes a Modbus device, in seconds. You can specify a non-integer value for this data item. If the value of this data item is zero, the Modbus I/O server does not refresh the device. Modbus Slave I/O servers do not support this data item.N/A
    UpdatingBoolean valueYesNoYesNoRepresents a signal the Modbus or Modbus Slave I/O server generates. The signal is TRUE while the Modbus I/O server polls a Modbus device or the Modbus Slave I/O server is being updated.N/A