Mapping between Modbus and ADS
The standard mapping of the server is illustrated in the following tables for the first runtime system:
Modbus ranges |
Modbus address |
ADS range | |
---|---|---|---|
Digital inputs |
0x0000 - 0x7FFF |
Index group |
Index offset |
0xF021 - process image of the physical inputs (bit access) |
0x0 | ||
0x8000 - 0x80FF |
Name of the variables in the PLC program |
Data type | |
.mb_Input_Coils |
ARRAY [0..255] OF BOOL | ||
Digital outputs (coils) |
0x0000 - 0x7FFF |
Index group |
Index offset |
0xF031 - process image of the physical outputs (bit access) |
0x0 | ||
0x8000 - 0x80FF |
Name of the variables in the PLC program |
Data type | |
.mb_Output_Coils |
ARRAY [0..255] OF BOOL | ||
Input registers |
0x0000 - 0x7FFF |
Index group |
Index offset |
0xF020 - process image of the physical inputs |
0x0 | ||
0x8000 - 0x80FF |
Name of the variables in the PLC program |
Data type | |
.mb_Input_Registers |
ARRAY [0..255] OF WORD | ||
Output registers |
0x0000 - 0x2FFF |
Index group |
Index offset |
0xF030 - process image of the physical outputs |
0x0 | ||
0x3000 - 0x5FFF |
0x4020 - PLC memory area |
0x0 | |
0x6000 - 0x7FFF |
0x4040 - PLC data area |
0x0 | |
0x8000 - 0x80FF |
Name of the variables in the PLC program |
Data type | |
.mb_Output_Registers |
ARRAY [0..255] OF WORD |
The server maps this to the individual ADS ranges and enables access to the physical process image and the PLC flag ranges.
The configurator enables the adaptation of the setting.
Default XML
The standard configuration looks like this:
<Configuration>
<!-- Modbus TCP port, default = 502-->
<Port>502</Port>
<!-- optional IP configuration for Modbus TCP server-->
<IpAddr/>
<Mapping>
<InputCoils>
<MappingInfo>
<!-- AdsPort: TwinCAT2 PLC1 = 801, PLC2 = 811...-->
<AdsPort>801</AdsPort>
<StartAddress>0</StartAddress>
<EndAddress>32767</EndAddress>
<!-- IndexGroup 61473 = 0xF021 -> physical plc inputs %IX -->
<IndexGroup>61473</IndexGroup>
<!-- Bit offset-->
<IndexOffset>0</IndexOffset>
</MappingInfo>
<MappingInfo>
<AdsPort>801</AdsPort>
<!-- Modbus input coils -->
<StartAddress>32768</StartAddress>
<EndAddress>33023</EndAddress>
<VarName>.mb_Input_Coils</VarName>
</MappingInfo>
</InputCoils>
<OutputCoils>
<MappingInfo>
<AdsPort>801</AdsPort>
<EndAddress>32767</EndAddress>
<!-- IndexGroup 61489 = 0xF031 -> physical plc outputs %QX -->
<IndexGroup>61489</IndexGroup>
<!-- Bit offset-->
<IndexOffset>0</IndexOffset>
</MappingInfo>
<MappingInfo>
<AdsPort>801</AdsPort>
<!-- Modbus output coils-->
<StartAddress>32768</StartAddress>
<EndAddress>33023</EndAddress>
<VarName>.mb_Output_Coils</VarName>
</MappingInfo>
</OutputCoils>
<InputRegisters>
<MappingInfo>
<AdsPort>801</AdsPort>
<StartAddress>0</StartAddress>
<EndAddress>32767</EndAddress>
<!-- IndexGroup 61472 = 0xF020 -> physical plc input register %I -->
<IndexGroup>61472</IndexGroup>
<!-- Byte offset-->
<IndexOffset>0</IndexOffset>
</MappingInfo>
<MappingInfo>
<AdsPort>801</AdsPort>
<!-- Modbus input registers -->
<StartAddress>32768</StartAddress>
<EndAddress>33023</EndAddress>
<VarName>.mb_Input_Registers</VarName>
</MappingInfo>
</InputRegisters>
<OutputRegisters>
<MappingInfo>
<AdsPort>801</AdsPort>
<StartAddress>0</StartAddress>
<EndAddress>12287</EndAddress>
<!-- IndexGroup 61488 = 0xF030 -> physical plc output register %Q -->
<IndexGroup>61488</IndexGroup>
<!-- Byte offset-->
<IndexOffset>0</IndexOffset>
</MappingInfo>
<MappingInfo>
<AdsPort>801</AdsPort>
<StartAddress>12288</StartAddress>
<EndAddress>24575</EndAddress>
<!-- IndexGroup 16416 = 0x4020 -> plc memory area %M -->
<IndexGroup>16416</IndexGroup>
<!-- Byte offset-->
<IndexOffset>0</IndexOffset>
</MappingInfo>
<MappingInfo>
<AdsPort>801</AdsPort>
<StartAddress>24576</StartAddress>
<EndAddress>32767</EndAddress>
<!-- IndexGroup 16448 = 0x4040 -> plc data area -->
<IndexGroup>16448</IndexGroup>
<!-- Byte offset-->
<IndexOffset>0</IndexOffset>
</MappingInfo>
<MappingInfo>
<AdsPort>801</AdsPort>
<!-- Modbus output registers -->
<StartAddress>32768</StartAddress>
<EndAddress>33023</EndAddress>
<VarName>.mb_Output_Registers</VarName>
</MappingInfo>
</OutputRegisters>
</Mapping>
</Configuration>