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.


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

The help is greatly appriciated!

1 Like

I am trying to run your example “Setting up CODESYS Modbus TCP (SP16 or higher)” using CODESYS V3.5 SP17.

Probably there are needed some steps that are described in Setting up CODESYS OPC UA (SP17 or higher) and are related with authentification.

After this step: , there was an error and unfortunately I did not noted the name and password for device user.

Now after few weeks I tried it again and only the window with authentification shows and I do not know the name and password…

How can I delete the device user and create a new one? Thank you!

Hi Eriknem, welcome to the forum!

I looked into the situation you described, and from what I could gather there doesn’t seem to be any way to delete the device user and create a new one without logging in first. My recommendation is that you try to contact Codesys regarding the issue to see if they can help you.


I’m having a similar problem and I’m unable to find any answers online.

I’m creating a super simple scene where I have two buttons, one in order to make a pusher go forward, and another one in order to make it go back (a biestable pusher).

I’m using codesys and after configurating the modbus there, getting online and charging my program to the virtual PLC, the only way I’m able to communicate with factory IO is by forcing the variables in my program. If I force them, the pusher moves in factory IO, but when I push the buttons that I created in factory IO, codesys doesn’t change the value of those variables.

Anyone could tell me please what could I do? I can’t seem to find anything and I don’t know what to do at all.

Thanks a lot in advance.