Hello FactoryIO Community! I have searched both on this forum, YouTube and checked codesys/factoryio documents, I don’t find anything that answer my question so now I will ask here in hope that someone could take some time and help me out.
I don’t have a problem to communicate with the BOOL input/outputs via Codesys bulilt-in Modbus TCP, but how do I communicate with values like INT and REAL?
I use the Slave Modbus TCP device.
Is there really nobody on this forum that knows the answer? This is really frustrating and stops me from doing many of the scenes.
When using Modbus, Factory I/O scales Float sensor values by 100, converts it to an integer, and sends it in a Word. In Codesys you have to convert this Word to a Real and divide it by 100 to get the correct value. Note that Factory I/O Float and Int data types correspond to Real and DInt in Codesys.
You can find additional information here: Modbus TCP/IP Client - FACTORY I/O
Sorry for my late reply. You maybe could use a web tool we have developped to get the Codesys file from a FACTORY I/O scene.
This application allows to obtain from a Factory I/O scene file with [Modbus TCP/IP Client card configured], the application canvas for EcoStruxure Control Expert/Unity Pro (.xef), EcoStruxure Machine Expert - BASIC 1.2 (.smbp) & CoDeSys 3.5.14/3.5.17 (.xml).
The project includes all declared PLC variables and the configured Modbus TCP/IP client communication allowing a connection with their soft PLC.
I’m stuck at this stage, I have factoryio 2.5.1 and Codesys 126.96.36.199
I just want to say a big thank you to @bernard.riera that took his own time and helped me personally. We had a videocall one-on-one via Discord, he shared his screen and explained to me the process of how to use Factory IO and CodeSys.
I then used his website to generate all PLC variables of the FactoryIO scene inside CodeSys, it was easy to use and saves time when starting a new scene project.