Overview
The server can receive Modbus functions via TCP/IP.
Modbus areas
According to the Modbus specification, the following four Modbus areas are defined:
Modbus areas | Data type | Access | Application example |
---|---|---|---|
Digital inputs (discrete inputs) | 1 bit | Read only |
|
Digital outputs (coils) | 1 bit | Read and write |
|
Input register | 16 bit | Read only |
|
Output register | 16 bit | Read and write |
|
After installation, the Modbus areas are mapped to the memory areas of the PLC.
The default setting of the Modbus TCP server can be found in the article on default mapping.
The default setting can be adjusted using the configuration file TcModbusSrv.xml or the configurator.
ADS access
To ensure that the specified Modbus areas can be accessed via ADS, please add the following global variables to your PLC project.
VAR_GLOBAL
mb_Input_Coils : ARRAY [0..255] OF BOOL;
mb_Output_Coils : ARRAY [0..255] OF BOOL;
mb_Input_Registers : ARRAY [0..255] OF WORD;
mb_Output_Registers : ARRAY [0..255] OF WORD;
END_VAR
Prerequisites
Development environment | Target platform | PLC libraries to include |
---|---|---|
TwinCAT v3.0.0 | PC or CX (x86) | Tc2_ModbusSrv |