Navigation: Settings > Data sources >
This data source can function as the master using MODBUS RTU or MODBUS TCP protocols and receive values from the slave.
Data exchange can be carried out via a COM port or over an Ethernet network.
When exchanging data over a single connection, the program will line up all requests in one queue and execute them sequentially. Write requests always get to the front of the queue, ahead of read requests. A request at the beginning of the queue will be executed first.
When a connection over several ports is set up, data exchange will be carried out in parallel, each connection having its own queue.
It is not allowed to create different connections using the same port number.
Fig. 17. MODBUS.
Connection - the program allows you to configure a connection to several slave devices at the same time. Use the list of previously configured connections to select a connection, or click the Add button to configure a new connection (Fig. 18). The other buttons in the window are used to change connection settings and delete connections.
Name - specifies a value name for your data.
Device Address - the field is used to specify the address of your device in the network of MODBUS devices. According to the MODBUS protocol specification, an address is a number from 0 to 255. If you specify 0 as the device address, then all devices on the network will respond to this request.
Memory - defines the memory area of the slave device from which values will be read.
Memory Offset - Each memory area can have up to 65536 registers with an offset from 0 to 65535 (depends on the slave device). Sometimes in the device documentation, an offset is not indicated, rather an address of the type 40100. In this case, the first digit indicates the memory area and the other digits indicate the address from the range 1 to 65535. That means you need to deduct 1 from the address and specify the resulting value as an offset. Example:
Memory area code: 4
Memory address: 100
Memory area codes:
0 - Coils.
1 - Discrete inputs.
3 - Input registers.
4 - Holding registers.
Number of Registers - specifies the number of serial registers in the device memory in which a value is stored. A value can occupy several serial registers in the device memory, depending on the type of the value. One register stores two bytes of data. For example, the data type "I32" will occupy two registers in the memory (32 bits → 4 bytes → 2 registers of 2 bytes each).
Data Type - defines the data type of value. As a rule, memory areas 0 and 1 store logic values, while 3 and 4 store numeric values.
Byte order in the register/value depends on the data storage method in internal memory. Although there is no specific standard for data storage, the most common storage method is when the oldest register of a value and byte in the register are transmitted in a data packet first, which corresponds to BA and DC order.
Interval - you can set the polling interval for a MODBUS device to check for a new value in a MODBUS register. A lower value provides a faster reaction to changes, but requires more CPU resources and lead to higher network traffic.
Cron schedule - these parameters allows you to set a flexible schedule to poll a MODBUS device. You can use it for rare reads.
Fig. 18. Connection via COM port.
Connection options have a few differences depending on the type of connection.
The common options are:
Name - the name of a connection that is displayed in the list of connections (Fig. 17).
Type - connection type (COM port or network).
Mode - specifies the type of MODBUS protocol. Usually, MODBUS RTU is used when transmitting data via a COM port, and MODBUS TCP is used when transmitting data over a network. However, in some cases, MODBUS RTU may be used with a network connection.
Request Timeout is the interval from sending a request to receiving a response from a MODBUS device. If the timeout is exceeded, the program will automatically cancel the current request and proceed to the next request in the queue. If the response comes after this interval, it will be ignored. The timeout value depends on several factors: connection speed, device performance, the amount of data transmitted in a request or response.
COM port - allows selecting a port from the list. The program automatically detects all available ports in the operating system.
Speed, Data bits, Parity, Stop bits - these options define settings of communication with a device and depend on the device settings.
RS 485 Interface Mode - the option enables automatic control of the program by the signal of RTS COM port. During data transmission, the program will always keep this port enabled. This may be required when using external RS232-RS485 hardware converters.
Fig. 19. Network connection.
IP Address - IP address of the device.
Port – the field if used to specify a TCP port to connect to. The standard value is 502. Kindly note that some MODBUS devices limit the number of simultaneous connections, and sending requests to one device from different computers may not be possible.