Stream Gateway can communicate to PLC and other devices that support Modbus serial communication. In this case, Stream Gateway acts as the Modbus RTU Master and the PLC is the Modbus TCP Slave.
Both Modbus RTU and Modbus ASCII are supported.
From Stream Explorer, select Data Sources and click on the Add button.
- Name: Unique name for the data source.
- Description: Optional information about the data source.
- Data Source Type: Selecting Modbus RTU or Modbus ASCII means that Stream Gateway is Modbus master and it will initiate communications with the Modbus slave (e.g. a PLC).
- Cycle: This is the scan rate for this data source.
- COM Port: Select the serial COM port.
- Settings: COM port settings:
- Baud rate
- Parity (None=0, Odd=1, Even=2)
- Data bits
- Stop bits
- Port No.: Device port number. The default for Modbus is 502.
- Slave ID: Each Modbus device (Server or Slave) in a network is assigned a unique unit address from 1 to 247.
- Timeout: Configures operation or socket time-out
- Retry: Configures the automatic retry setting. A value of 0 disables any automatic retries.
- Big Indian Integers: This option is required to read data correctly from a big-indian device.
- Swapped Floats: This option is required to read data correctly in some cases (Words order need to be swapped).
- Status Tag: Select or type a Boolean tag name that will become True only when if the device comm status is healthy.
Here we define the exact addresses ranges that need to be scanned. The address of any defined tag should fall within one of the defined ranges.
Currently, There are types of Modbus actions that Stream Gateway can perform:
1. Read Coils
Performs Modbus Function Code 1 (01 hex). Define the start coil number in Start and define how many coils to be read in this scan in Count. Up to 2000 coils can be read in one scan.
2. Read Holding Registers
Performs Modbus Function Code 3 (03 hex) for integer data types (16-bit). Define the start holding register number in Start and define how many holding registers to be read in this scan in Count. Up to 125 registers can be read in one scan.
3. Read Holding Longs
Performs Modbus Function Code 3 (03 hex) for double words data types (32-bit). Define the start holding register number in Start and define how many holding double words to be read in this scan in Count. Up to 62 double words can be read in one scan.
4. Read Holding Floats
Performs Modbus Function Code 3 (03 hex) for floating data types (32-bit). Define the start holding register number in Start and define how many floats to be read in this scan in Count. Up to 62 floats can be read in one scan.
The above example instructs Stream Gateway to perform the following during runtime:
- Read Coils from 1 to 500.
- Read Holding Registers from 1 to 100.
- Read Holding Registers from 100 to 150.
- Read Floats from 200 to 220.
Note: You can copy the entire table of ranges from Excel. Simply by Ctrl+C and then Ctrl+V.
The next step is to add Tags and link them to this data source. See Modbus Addressing.