FORUM CTRLX AUTOMATION
ctrlX World Partner Apps for ctrlX AUTOMATION
Dear Community User! We are updating our platform to a new
system.
Read more: Important
information on the platform change.
09-02-2022 11:15 AM
Hello everyone,
I'm posting this message because I need to make a modbus tcp communication with a ctrlX core PLC. I saw that on the store, there is an app "CTRLX CORE Modbus tcp", is it necessary to download it to communicate with a modbus tcp module?
Then I read that the XF50 port is reserved for EtherCat. So I guess the app allows to configure the XF51 port to communicate?
Thanks in advance for your answer,
Kévin
Solved! Go to Solution.
09-05-2022 09:27 AM
Could you please have a look to this post for further information?
09-06-2022 08:39 AM
I have succeeded in communicating with my modbus module (the IL_ModbusTCPclient module and the IL_modbusTCPRead device Identification module are working), but I can't read the information in the registers (float 32) of the Schneider module.
I don't know what the differences are between the ModbusTCPReadCoils, ModbusTCPReadHoldingRegister and ModbusTCPReadinputRegister blocks.
In my case, I created a real array to store the data with a word pointer to it.
But it gives me as error :
Resource_error for the ModbusTCPReadinputRegister block which means an error "Input 'ModBusLink' is invalid".
Communication_error for the IL_ModbusTCPclient block which means "the socket is not connected or Remote station closed Connection".
I admit that if you have an idea, I would be delighted.
Thanks in advance for your answer,
Translated with www.DeepL.com/Translator (free version)
09-06-2022 09:28 AM
CoilData, SizeOfCoilData
The "CoilData" input maps the coils defined in Modbus. Coils form a bit field with a maximum length of 65536 bits. The bits can be read as well as written. The data exchange takes place via the array created at the "CoilData" input. Each byte of the array represents 8 bits.
The size of the array in bytes must be created at the "SizeOfCoilData" input. The SIZEOF() operator can be used for this. The function block uses "SizeOfCoilData" to check whether incoming requests are within the created field.
InputData, SizeOfInputData
The "InputData" input maps the discrete inputs defined in Modbus. Discrete inputs form a bit field with a maximum length of 65536 bits. The bits can only be read. Data exchange takes place via the array created at the "InputData" input. Each byte of the array represents 8 bits.
The size of the array in bytes must be created at the "SizeOfInputData" input. The SIZEOF() operator can be used for this. The function block uses "SizeOfInputData" to check whether incoming requests are within the created array.
HoldingRegisterData, SizeOfHoldingRegisterData
The input "HoldingRegisterData" maps the holding registers defined in Modbus. The registers form a field of words (16 bit values) with a maximum length of 65536 words. The registers can be read as well as written. Data exchange takes place via the array created at the "HoldingRegisterData" input.
The size of the array in bytes must be created at the "SizeOfHoldingRegisterData" input. The SIZEOF() operator can be used for this. The function block uses "SizeOfHoldingRegisterData" to check whether incoming requests are within the created array.
However, the actual error is due to the non-existent connection. The connect reports an error. To do this, you would need to know the detailed information of the error message of the client module. ErrorID and ErrorIdent!
Regards
09-06-2022 09:35 AM - last edited on 02-24-2023 02:04 PM by CodeShepherd
More information you can find in the online help of ctrlX Works:
09-06-2022 02:27 PM
Hello, despite the information, it does not work. Either with the module "ModbusTCPReadInputRegisters or ModbusTCPReadHoldingRegisters". The error is "resource_error" and the code "additionnal 1 = 16#0A0F1850" and the code "additionnal 2 = 16#0c230003". Unfortunately, these error codes are not found in the documentation.
If you have any information, thank you in advance for your reply,
Kévin
09-06-2022 03:42 PM
But you have also an error at the function block ModbusClient. What is the error information for this error?
09-07-2022 08:54 AM
Hello, the error code for the client tcp module is :
add1: 16#0A0F0111 and add2: 16#0C23020E. In the documentation, this means that the connection has been closed.
The problem is that when I use the module to retrieve the module constructor information with the client tcp module, I get it.
The variables are of type "float 32", my question is: should I use an array of type "word" with its "pointer to word"?
I confess that I do not understand. I put additional screenshots.
Thank you in advance for your answer
09-07-2022 09:24 AM
Hello,
first of all something about the programme. Setting the enable signal on the ReadInputRegister module to TRUE only makes sense if the client module also supplies an InOperation. The InOperation output can be the input for the Read module, for example. And as long as the client always reports an error, we don't need to look for errors in the read component.
If a 32-bit value is to be read, an array of words with at least 2 elements must be specified as the target. This is also described in the interface description in the documentation.
So I would first do the following:
09-07-2022 09:27 AM
Okay, thank you very much for your answers and clarifications.
09-08-2022 08:24 AM
One question:
which PLC Version and which CXA_ModbusTCP Library are used?