The structure ST_StartAddressConfig specifies the start addresses of the data blocks for discrete inputs, coils, input registers, and holding registers. The external Modbus TCP clients must have the address range provided by the Modbus TCP server for each block to create valid Modbus requests for accessing the objects.
Name |
Data type |
Default value |
Description |
---|---|---|---|
UINT |
1 |
Address of the first object in the data block for discrete inputs. |
|
UINT |
1 |
Address of the first object in the data block for coils. |
|
UINT |
1 |
Address of the first object in the data block for input registers. |
|
UINT |
1 |
Address of the first object in the data block for holding registers. |
The data block for holding registers is configured in the Modbus TCP server as follows:
For the FB_ModbusTcpServer, an array of 10 words (for example, ARRAY [0..9] OF WORD) is assigned to the parameter i_awAppMemoryHoldingRegisters.
The starting address for holding registers (i_stStartAddressConfig.uiStartAddressHoldingRegisters) is set to 101
.
By this configuration, the Modbus TCP server provides 10 holding registers with address 101...110. The highest address is determined by the size of the block and the start address. With starting address 101, the 10th register (WORD) has address 110.
Modbus requests attempting to access holding registers outside this address range lead to an exception code in response.