TwinCAT Modbus TCP Configurator
The configurator is installed per default to the directory \TwinCAT\TcModbusSrv. The tools allow to read and change the actual configuration of TwinCAT Modbus TCP server.
IP Address: IP of the server. If no address is set, the local one is used (default) .
Port: Configured port of the server (default port = 502).
Get Configuration: Read configured IP address and port.
Set Configuration: Set IP address and port.
Export Configuration: Read and save configuration.
Import Configuration: Import new configuration.
Set Default Configuration: Reset to default-settings (use local ip, Port = 502, and default mapping).
Note: TwinCAT must be stopped if you want to use the configurator, which will be done by the tool.
Export configuration
The configuration is XML-based and can be changed by a text editor.
Hint: It is easier to edit and activate an exported configuration.
Importing Mapping information
Use the "Import Configuration" function to import and set active an existing (altered) configration file.
Example for simple mapping:
<Configuration>
<Port>502</Port>
<IpAddr\>
<Mapping>
<InputRegisters>
<MappingInfo>
<!--Port 801 = PLC1 TC2 -->
<AdsPort>801</AdsPort>
<StartAddress>0</StartAddress>
<EndAddress>32767</EndAddress>
<!-- IndexGroup 61472 = 0xF020 physical plc input register %I -->
<IndexGroup>61472</IndexGroup>
<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/>
<InputCoils/>
<OutputCoils/>
</Mapping>
</Configuration>
This samples maps the input register (IndexGroup 0xF020) of the first TwinCAT2 runtime (port = 801) to the Modbus input registers.
Hint: It is possible to map by variablename or IndexGroup/Offset(better performance).
The default configuration can be found here.