Connect To ModBus Slave

Follow the guide Add Module to Apis Hive, but this time select a module of type ApisModbus from the "Module type" dropdown list.

  • After adding the module, select the new module named "ApisModbus1" from the Solution Explorer.

Basic setup, communication interface

The module supports both serial (RTU) and TCP/IP (Modbus TCP) interface, depending on your server. In the Properties Editor, enter values for:

  1. TCP/IP based server:

    • Comm. type: TCP/IP
    • IP address: IP address of your Modbus slave.
    • Port: TCP port of your Modbus slave

    .

  2. Serial communication based server :

    • Comm. type receive : Serial
    • Com port: Com port connected to the slave.
    • BaudRate: Baud rate of your slave serial setup.
    • DataBits: Data bits of your slave serial setup.
    • FlowControl: Handshake of your slave serial setup.
    • Parity: Parity of your slave serial setup.
    • StopBits: Stop bits of your slave serial setup.

  • Further in the Properties Editor:
    • Poll interval: Enter the value for how often this masterr should poll for new values on server (in seconds).
    • Default Slave address : Note! this is the initial property when new items are created.

Add Items (registers)

Now follow the guide Add Items to a Module, but this time select the Modbus module and add items of one of the register types:

  • Coil
  • DiscretesInput
  • InputRegister
  • HoldingRegister

Example Holding register:

Give the Item a proper name like "Temp_Man_6". Assure SrcItemID is pointing to valid register address like "40002",check the Slaveadress and set correct Valetype of the value in the register of the slave. Ok

If all setting are correct the "Temp_Man_6" tag should be displaying the value of holding register 40002 of the slave.

Troubleshooting

If there's no connection or data received:

  • Use a third-party terminal application like wireshark, to check if the server is sending telegrams.
  • For a TCP/IP based server:
    • Check the firewall settings for the receiving port.
    • Check the network connection to the server, (ping)