Trouble with communication between factory IO and Tia Portal

I have tried it with both V19 and V21 of TIA Portal. I have connected Factory I/O and TIA Portal to a physical machine (S7-1200 – 1215C DC/DC/DC).

I have Factory I/O running with TIA Portal, and I have established a stable connection between the two.

I have checked the inputs and outputs to make sure they match.

I can use the Start button to set and the Stop button to reset, but if I hold down the button, the input in TIA Portal does not register. The same happens with all the buttons. They work as set/reset, but not when I hold them down, which is causing problems, for example, with sensors.

As you can see in the picture, I1.0 is TRUE in Factory I/O, but it is not TRUE in TIA Portal (sensor B1).

Factory IO’ s input’s address can not be the same for the PLC physical inputs address.
Inputs can not be used in parallel because inputs can not be written to the process memory of the the PLC.

Change the starting (hardware) address on the PLC from 0 to for example 10.
or
change the BOOL input in Factory IO from 0 to for example 10 .

1 Like

Hello hwj

I’d like to make a suggestion. I’ve looked at the program you created and the way you structured the logic—which mirrors the old-school method of hardwiring control panels: routing the live wire through the “Stop” button, then to the “Start” button, and finally to contactor K1, while placing a K1 contact in parallel with the “Start” button. The operation involved pressing the button to let current flow; this activated the contactor, closing the parallel contact across the “Start” button. You could then release the button, as contactor K1 would remain energized until the “Stop” button was pressed to cut the power. Is that correct? I believe so—please correct me if I’m wrong. Anyway, the reason I mention this is that it forms the underlying logic for hwj’s program.

Now, I propose the following to the community:

Consider a hospital heating control system with 8 floors and 100 rooms per floor. The operation is simple: each room has a thermostat that controls a valve; the valve opens if the temperature is below the setpoint and closes once that setpoint is reached. That’s it—that is the program. Let’s outline it:

If Input 1 = 1, then Valve = 1; meaning, if the thermostat is closed, the valve activates until the setpoint is reached. Then, the thermostat switches to 0, the valve closes, and heating stops. It would look like this:

If term1 = 1, then val1 = 1; otherwise, val1 = 0.

Now, let’s look at hwj’s program:

8 floors × 100 rooms means a minimum of 800 lines of code just for the function we are discussing. This represents hardwired logic—the kind shown in the previous image.

Let’s look at the programmed logic:

for each I as integer = 0 to 800

if input(I) = true then valve(I) = true

else valve(I) = false

End if

next

That’s right—5 lines for 800 rooms; but if there were 1,500 instead of 800—or even 8,000, for that matter—you’d just change 800 to 1,500 or 8,000 in my code. It makes no difference; it works for any number.

Now all that’s left is to execute the code every X amount of time, and that’s it…

And now for the best part—users might think, “You aren’t controlling a hospital here, just a single bit of something or other, so the comparison doesn’t hold.” Well, before you jump to that absurd conclusion, let me tell you: if that is your take on my comment, you are completely mistaken. A good programmer never programs a bit the way it’s shown in the image—and here’s why:

PLCs aren’t used for the task shown in the image—nobody uses a PLC for that, nobody—because PLCs are employed for more complex operations, not for this specific example. Let’s consider the example: what if two more conditions had to be added to that motor setup? Where would you place the sensors, detectors, or whatever else is needed? How would you integrate those extra conditions into the code? Take “Contribution 142,” for instance: it started with six parts, then added an operator-controlled part-selection feature for each output, followed by three more parts—all while maintaining the existing structure—and finally, the requirement for the machine to handle four parts simultaneously. Now, make a mental effort to extrapolate that scenario to the code in the image. You need to understand that what I am writing stems from a perspective on programming that very few people grasp—the very perspective I aim to convey in “Contribution 123” regarding these two different programming approaches.

Regards.

1 Like