Help with modbus TCP/IP Client "Talking" to Codesys V3.5

Hi! There might be similar “Topics” on here but i can’t seem to find exactly what i am looking for.

So the trouble i am having with Codesys and connecting factory i/o over the modbus TCP/IP Client. I have been able to follow the guide on the factory i/o site: (Setting up CODESYS Modbus TCP - Factory I/O - Documentation, up to the point so that i have been able to get a connection between codesys and factoryio, but only by setting the slave ID to 0 and/or 255. The problem i’m having is reading and writing values and therefore not able to run my code.
I am not familiar with setting up the codesys modbus slave and what parameters/addresses i need to configure as i have only used Siemens TIA portal and connecting to factoryio with PLCsim in school before and now i want to continue programming privately.

If needed i can provide pictures and more info
Any help is greatly appreciated!

I am using the Trial version of factory i/o if there is any limitations to this version.
My first project is getting the waring light to light up when pressing a button just as a
“getting it to work project” so nothing advanced.

Hi @thasamm,
Are you using SP16 or higher? If so, CODESYS suffered some changes, so try this:

  1. Check the “Discrete Bit Areas” box under ModbusTCP_Slave_Device > General > Configured Parameters and write the number of Coils and Discrete Inputs you need, as shown in the image below.

  2. Map the variables (using Coils and Discrete Inputs).

  3. Map these variables in FIO.

We’ll release a tutorial regarding these alterations. Meanwhile, let me know if this worked for you.

2 Likes

Yes I am using SP16 and it worked! Thank you so much!

The help is greatly appriciated!

1 Like