Overview
The server can receive Modbus functions via TCP/IP.
Modbus-areas
The Modbus specification defines these four Modbus-areas:
Modbus-areas | Data type | Access | Example |
---|---|---|---|
digital inputs (Discrete Inputs) | 1 Bit | Read only |
|
digitale outputs (Coils) | 1 Bit | Read / write |
|
Input registers | 16 Bit | Read only |
|
Output registers | 16 Bit | Read / write |
|
After the installation the modbus areas are mapped to the PLC areas. Check the article about the default-mapping.
The TwinCAT Modbus TCP/IP server configurator is used for configuring this mapping.
ADS-Access
If you want to access the specific modbus areas, you have to add these 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
Requirements
Development environment |
Target system type |
PLC libraries to be linked |
---|---|---|
TwinCAT v3.0.0 |
PC or CX (x86) |
Tc2_ModbusSrv |