Modbus TCP enables communication with devices with Modbus TCP Server protocol from the inSCADA platform.
Figure 1 : Modbus TCP
To communicate with a device with Modbus TCP Server protocol, we need know following definitions:
- IP Address,
- Slave Id/Station Number,
- Data blocks start and end addresses,
- Data type of variables within data blocks.
Now let's examine how the Modbus TCP protocol is configured in the inSCADA platform.
To connect to a device, we must first create a connection.
Figure 2 : Connection
As shown in Figure 2, the IP address of the device we want to connect to is: 0.0.0.0 Port: 3501. We create a connection based on this information.
Now let's create a device to connect to.
Figure 3 : Device
As shown in Figure 3, we create a device connected to the connection we created in the previous step. We choose protocol as "Modbus TCP", station address: 1. We set the scanning time to 1000 ms.
In this step, we will now define the data blocks that will be read from the device. Data blocks in MODBUS protocol can be maximum 255 bytes/127 Word/63 Double Word. MODBUS protocol has grouped data blocks into 4 different types. They are;
- Holding Registers,
- Input Registers,
- Digital Inputs,
Figure 4 : Frame
As shown in Figure 4, we create a data block of the Holding Register type connected to the device we created in the previous step. We define with the starting address as 1000 and 20 Words.
After completing the steps here, we can now communicate with the device. You need to have information about the configuration settings you edited here, the device you want to communicate with, and the data blocks you want to read/write from.
To begin the communication, you can go to the Control Panel and start the corresponding Connection. If there are no incompatibilities, your connection will appear as Connected on the Control Panel.
After the communication is established, we can now create our variables, read and write data from the device. To do this, we need to create a variable from the Development-> Variables menu.
Figure 5 : Variables
As shown in Figure 5, we create a variable that depends on our data block. Now we can go back to our Control Panel, update our connection. and see the variable value.
Figure 6 : Modbus TCP Test On Control Panel