Iβm trying to establisch communicate with a Modbus TCP slave.
I need to reed address 3201 by using FC3. For some reason I always get error βillegal data addressβ.
I have double checked the addressing (Unit ID = 0, FC3, offset 3201) with an external Modbus TCP tool and this works.
Do I miss something within the Codesys configuration
Keep in mind that Modbus starts with address 1, but this is actually register 0. CODESYS uses a 0 based offset. So what you can try is to read 3200, because maybe your device uses a 1 based offset.
Additionally maybe you can set the length to only one register just to see if this works.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Unit ID feels wrong also, even if it seems to work.
Recall that serial Modbus uses addresses 1 to 247 decimal, and reserves 0 as a broadcast address.
Even if some modbus TCP devices just ignore the address and echoes it back, 255 is generally used for a single device.
So if this device is a gateway, 1-247 is generally used with a gateway(TCP/SL) to point a device on SL.
Exception Code MODBUS name Comments 01 - Illegal Function Code - The function code is unknown by the server 02 - Illegal Data Address - Dependant on the request 03 - Illegal Data Value - Dependant on the request 04 - Server Failure - The server failed during the execution 05 - Acknowledge - The server accepted the service invocation but the service requires a relatively long time to execute. The server therefore returns only an acknowledgement of the service invocation receipt. 06 Server Busy - The server was unable to accept the MB Request PDU. The client application has the responsibility of deciding if and when to re-send the request. 0A Gateway problem - Gateway paths not available.
* 0B Gateway problem - The targeted device failed to respond. The gateway generates this exception.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
Iβm trying to establisch communicate with a Modbus TCP slave.
I need to reed address 3201 by using FC3. For some reason I always get error βillegal data addressβ.
I have double checked the addressing (Unit ID = 0, FC3, offset 3201) with an external Modbus TCP tool and this works.
Do I miss something within the Codesys configuration
Keep in mind that Modbus starts with address 1, but this is actually register 0. CODESYS uses a 0 based offset. So what you can try is to read 3200, because maybe your device uses a 1 based offset.
Additionally maybe you can set the length to only one register just to see if this works.
Unit ID feels wrong also, even if it seems to work.
Recall that serial Modbus uses addresses 1 to 247 decimal, and reserves 0 as a broadcast address.
Even if some modbus TCP devices just ignore the address and echoes it back, 255 is generally used for a single device.
So if this device is a gateway, 1-247 is generally used with a gateway(TCP/SL) to point a device on SL.
Exception
Code MODBUS name Comments
01 - Illegal Function Code - The function code is unknown by the server
02 - Illegal Data Address - Dependant on the request
03 - Illegal Data Value - Dependant on the request
04 - Server Failure - The server failed during the execution
05 - Acknowledge - The server accepted the service invocation but the service requires a relatively long time to execute. The server therefore returns only an acknowledgement of the service invocation receipt.
06 Server Busy - The server was unable to accept the MB Request PDU. The client application has the responsibility of deciding if and when to re-send the request.
0A Gateway problem - Gateway paths not available.
* 0B Gateway problem - The targeted device failed to respond. The gateway generates this exception.