Modbus-Interfaces
Address | Description | |||
---|---|---|---|---|
0x0000 | Process data inferface | |||
0x0800 | Process data inferface | |||
0x1000 | Read only | Bus Coupler detection | ||
0x1010 | Process image length in bit, analog outputs | |||
0x1011 | Process image length in bit, analogue inputs | |||
0x1012 | Process image length in bit, digital outputs | |||
0x1013 | Process image length in bits, digital inputs | |||
0x1020 | Watchdog, current time in [ms] | |||
0x1021 | Number of triggered fallbacks (watchdog timeout or bus error) | |||
0x1022 | Number of active TCP connections | |||
0x1030 | Hardware version | |||
0x1031 | Software version Main | |||
0x1032 | Software version Sub-Main | |||
0x1033 | Software version Beta | |||
0x1034 | Serial number | |||
0x1035 | Production date Day | |||
0x1036 | Production date Month | |||
0x1037 | Production date Year | |||
0x1040 | E-Bus Status 1 OK, 0 not OK | |||
0x1120 | Read/Write | Watchdog predefined time in [ms] (default: 1000) | ||
0x1121 | Watchdog reset register | |||
0x1122 | Type of watchdog | 2 | Disable | |
1 | Telegram watchdog (Default) | |||
0 | Watchdog write telegram | |||
0x1123 | Fallback Mode | 2 | Stop E-bus, E-bus is stopped, E-bus can be reactivated with 0x1140 | |
1 | Freeze | |||
0 | Set to Zero (Default) | |||
0x1124 | Writelock | 1 | Yes (Default) | |
0 | No | |||
0x1140 | Write 0, E-bus is switched to INIT, value > 0 EtherCAT master is switched to OP (attention: the last output values are written again), 5 sec timeout in which no fallback is considered. |
Extended Modbus interface
Address | Description | |
---|---|---|
0x6000 | Read only | Bus Coupler detection (9000dec) |
0x6001 | 1st terminals | |
0x60xx | xxth terminal |
Address | Register communication via Modbus interface - Description | ||
---|---|---|---|
0x1400 | Read/Write | READ | WRITE |
STATUS | CONTROL | ||
0x010x - Error | 0x0001 execute | ||
0x020x - Busy | -- | ||
0x040x - done | - | ||
0x1401 | Bit 15 0 - Read/ 1 - Write | Bit 0..14 Terminal number (position in the EtherCAT structure), starts with 1 | ||
0x1402 | CoE index number | ||
0x1403 | Register bit 0..7 Sub Index, bit 8..15 not used | ||
0x1404 | Length in byte | ||
0x1405 | Error Code: ADS Error Code | ||
0x1406..14FF | Data[1]...Data[FF] |
Example: Reading the 2nd EtherCAT Terminal (EL3204) Object 0x1008 SubIndex 0x00 (name of the terminal)
(Example: Download)
1st step
ModbusRegWrite
MB.Addr:=0x1400
MB.Len:= 5 (words or registers)
0x1400:=0x0001
0x1401:=0x0002; read bit 15=FALSE, 2nd terminal
0x1402:=0x1008; Object 0x1008
0x1403:=0x0000; SubIndex 0
0x1404:=0x0000; Length (only necessary for writing)
Client:
ModbusTCP | Function Code | Start Addr | Length | Byte Len | Execute | R/W | Object | SubIndex | Length |
7 byte | 1 byte | 2 byte | 2 byte | 1 byte | 2 byte | 2 byte | 2 byte | 2 byte | 2 byte |
00 00 00 00 00 11 00 | 10 | 14 00 | 00 05 | 0A | 00 01 | 00 02 | 10 08 | 00 00 | 00 00 |
Server:
ModbusTCP | Function Code | Start Addr | Length |
7 byte | 1 byte | 2 byte | 2 byte |
00 00 00 00 00 06 00 | 10 | 14 00 | 00 05 |
2nd step
ModbusRegRead
MB.Addr:=0x1400
MB.Len:= 12 (words or registers)
0x1400:=0x0201; SDO communication not yet completed, polling must continue, repeat step 2 until value is 0x0400 (where 0x0500 indicates an error).
0x1401:=0x0002;2nd terminal
0x1402:=0x1008;
0x1403:=0x0000;
Client:
ModbusTCP | Function Code | Start Addr | Modbus Length |
7 byte | 1 byte | 2 byte | 2 byte |
00 00 00 00 00 06 00 | 03 | 14 00 | 00 14 |
Server:
ModbusTCP | Function Code | Byte Length | Execute | R/W | Object | SubIndex | COE | Rest |
7 byte | 1 byte | 1 byte | 2 byte | 2 byte | 2 byte | 2 byte |
| 30 byte |
00 00 00 00 00 2B 00 | 03 | 28 | 02 01 | 00 02 | 10 08 | 00 00 | 00 00 | Don't use it, because length is 0 byte |
3rd step (repeat step 2):
ModbusRegRead
MB.Addr:=0x1400
MB.Len:= 12 (words or registers)
0x1400:=0x0400; without error data ready
0x1401:=0x0002; 2nd terminal
0x1402:=0x1008; Object 0x1008
0x1403:=0x0000; SubIndex
0x1404:=0x000B; Length
0x1405:=0x0000; Error Code
0x1406:=0x4C45; 'EL'
0x1407:=0x3233; '32'
0x1408:=0x3430; '02'
0x1409:=0x30D2; '-0'
0x140A:=0x3030; '00'
0x140B:=0x0030; '0'
Client:
ModbusTCP | Function Code | Start Addr | Modbus Length |
7 byte | 1 byte | 2 byte | 2 byte |
00 00 00 00 00 06 00 | 03 | 14 00 | 00 14 |
Server:
ModbusTCP | Function Code | Byte Len | Execute | R/W | Object | SubIndex | COE | Error | Data | Rest |
7 byte | 1 byte | 1 byte | 2 byte | 2 byte | 2 byte | 2 byte | 2 byte | 2 byte | 11 byte | 17 byte |
00 00 00 00 00 2B 00 | 03 | 28 | 04 00 | 00 02 | 10 08 | 00 00 | 00 0B | 00 00 | 4C 45 32 33 32 30 30 D2 30 30 30 | Don't use it, because length is 11 byte |
If more data is read than the CoE length returns, this data is to be ignored. Old data may still be in the buffer here, but this is irrelevant for the response; the COE length must be evaluated here.
Example: Writing the 5th EtherCAT Terminal (EL3318) Object 0x8000 SubIndex 0x19, value for 75µV measurement = 102 dec
Example of a write to an EL3318 (5th terminal) where the first channel of the terminal is to be set to the 75µV measurement type.
1st step
Write Multiple Registers (Modbus Function Code 16)
MB.Addr:=0x1400
MB.Len:= 7 (words or registers)
0x1400:=0x0001
0x1401:=0x8005; Write (bit 15 = TRUE), 5. Terminal
0x1402:=0x8000; Object 0x8000
0x1403:=0x0019; SubIndex 0x19
0x1404:=0x0002; Length
0x1405:=0; Error Code
0x1406:=102; Value for 0x8000, SubIdx 0x19
2nd step
Read Multiple Register (Modbus Function Code 3), at least 6 words should be read here. If an error occurs, the error code starts at offset 0x1405.
Query up to bit 10 in offset 0x1400, if this is "done" (0x04xx), the write was successful.
If the response in offset 0x1400 is the value 0x02xx, the write process has not yet been completed. The reading is then to be repeated.
If the response in offset 0x1400 is the value 0x01xx, an error has occurred. The error code can then be found in offset 0x1405, it is a ADS error code.
Modbus UDP
The communication can also optionally be used via Modbus UDP.