IMDHMIControls LibraryShop main store

Troubleshooting

Why a PLC-triggered data table upload fails on a direct link

SCADA and data logging Published 10 min read

Short answer

Yes. Set the PC exporter to Ethernet (listen), make the PLC socket the TCP master, and trigger TCP/IP Connect from a positive transition, leaving the socket open. If the office network works but a direct cable fails, Windows has classified the isolated link as Public and its firewall is dropping the PLC's inbound connection; one inbound allow rule for the exporter fixes it.

On this page
  1. Can the PLC start the data table upload itself?
  2. Why does the socket drop from initialized to closed when I trigger it?
  3. Should the PLC close the socket after each upload?
  4. Which IP settings does a direct cable need?
  5. Why does the upload work on the office network but fail on a direct cable?
  6. How do I prove the firewall is the failing hop?
  7. What firewall change fixes the direct link?
  8. What do I check, in what order, on the next machine?
  9. Questions asked

Yes, the PLC can start the data table upload itself. Three changes make it work: set the PC-side exporter to Ethernet (listen), configure the PLC socket as a TCP master, and fire TCP/IP Connect from a positive-transition contact — then leave the socket open between uploads. When that arrangement runs on the office network but dies on a cable straight from the laptop to the controller, the ladder is usually innocent: Windows has classified the unidentified direct link as a Public network, and the Public-profile firewall drops the PLC's inbound connection until an inbound rule permits the exporter. The checks below run in the order that separates a ladder fault from an addressing fault from a firewall fault, and the addressing numbers are worked out in full.

Can the PLC start the data table upload itself? #

Yes — reverse the roles: the exporter waits in Ethernet (listen) mode with its port defined in PC Ports, the PLC socket runs as a TCP master, and one positive transition on TCP/IP Connect starts the collection, which then runs exactly as the site configuration defines it.

The collector only needs a connection; it does not care which end opens it. In the PC-initiated arrangement you have already proved, the exporter dials out with Ethernet (Call) while the PLC socket waits as TCP, Slave. Reversing the roles flips every setting that says who waits and who dials:

Setting PC dials (the test you proved) PLC dials (the goal)
Exporter port mode Ethernet (Call) Ethernet (listen)
PLC socket role TCP, Slave TCP, Master
Who opens the connection The exporter TCP/IP Connect in the ladder
Destination the dialer needs The PLC's address and port The PC's wired address and the exporter's listening port
Firewall direction that matters Outbound from the PC Inbound to the PC

Initialize the Ethernet card once at power-up with TCP/IP CARD INIT, configure socket 0 as TCP, Master, and let the ladder open the connection to the PC's address and listening port. Once the controller connects, the exporter collects everything the site configuration defines — no schedule, no operator call. The controller owning the socket is a pattern you may already run elsewhere: PLC code starts an OPC UA client connection the same way, with your logic deciding when the connection opens.

Why does the socket drop from initialized to closed when I trigger it? #

Because a plain contact feeding TCP/IP Connect stays true for every scan the button is held, the block restarts the connection attempt each scan and the socket status shuttles from 14 - Socket Initialized to 0 - Connection Closed before any transfer settles.

A screen button referenced as a direct contact is true for as long as it is pressed. At a 10 ms scan time, for example, a two-second press re-issues the connect on the order of 200 scans (2 s divided by 10 ms is 200), and each restart tears down the attempt the previous scan began — the two status values you see alternating are the block fighting itself. Replace the plain contact with a positive-transition (one-shot) contact so the block fires once per press, and keep the interlock that only allows a connect when the socket is not already connected. That one-shot is the change that took this logic from intermittent to consistent.

Should the PLC close the socket after each upload? #

No — leave the socket open once it connects: closing after each transfer produced one good upload after power-up and then nothing, while the open-socket version with a one-shot trigger ran every cycle.

It reads naturally as polite housekeeping — open, transfer, close — but the close is what breaks the sequence. In the runs where the ladder closed the socket after each transfer, the first upload after power-up worked and later ones did not, because the close and the connect logic stepped on each other. The arrangement that ran every cycle has no close from the ladder at all: TCP/IP Connect fires only from a one-shot, and only when the socket is not already connected, so each new connection delivers the site's data and the next cycle's trigger reconnects cleanly. Issuing a connect while a transfer is still running is the other way to lock the socket — the one-shot plus the not-connected interlock removes both failure modes at once. Decision: remove TCP/IP Close from the ladder and edge-qualify the connect.

Which IP settings does a direct cable need? #

Give both ends fixed addresses on one subnet you control — for example the PLC at 192.168.10.50 and the laptop's wired adapter at 192.168.10.10, both with mask 255.255.255.0 — and point the connect block at 192.168.10.10.

A direct cable is a path, not an address service. On the office network something else handed out addresses; unplugged from it, the laptop's adapter may still hold an address from a network that is no longer there, so fix both ends by hand. The worked example:

  • Controller address 192.168.10.50, mask 255.255.255.0. Network = 192.168.10.50 AND 255.255.255.0 = 192.168.10.0.
  • Laptop wired address 192.168.10.10, mask 255.255.255.0. Network = 192.168.10.10 AND 255.255.255.0 = 192.168.10.0.
  • Both AND out to the same network, 192.168.10.0, so delivery is local and the connect block needs no gateway entry: destination address 192.168.10.10, destination port equal to the exporter's listening port from PC Ports — for example 20256, with the real value read from your project.

Keep the laptop's wireless adapter out of the plan: a second active adapter with its own subnet gives Windows two routes, and the route it picks for the controller's address may not be the wired one. Disable the wireless adapter during the test or make the wired route explicit. And retire the cable theory for good: a standard Cat5e cable and a crossover Cat5e cable produced the identical failure, which is the evidence that nothing on the wire was wrong.

Why does the upload work on the office network but fail on a direct cable? #

Because Windows filed the two links under different firewall profiles: through the office infrastructure the adapter lands in the Private profile, while the unidentified direct link lands in Public, and the Public profile blocks inbound connections that no rule allows — including the PLC's connect request.

This is documented firewall behavior, not a quirk. Microsoft's documentation for the Windows Security app describes an incoming-connections setting that blocks all incoming connections, including ones from apps on the allowed list, and hardening baselines for Windows Firewall set the default inbound action of each profile to Block — the recommended state is that an inbound connection matching no allow rule is dropped. Windows sorts every network it sees into a profile, and a network it cannot identify — a laptop wired straight to a controller, with no office gateway to vouch for it — gets the Public profile. The office link lands in Private, where a rule already admitted the exporter; the direct link lands in Public, where none does, so the PLC's request is dropped before the exporter ever sees it.

Reconnection is what makes this maddening. In the traced failure, the pair ran fine through the office switch even with the server behind it disconnected — until the laptop itself was unplugged and plugged back; then the transfer failed until the server returned. Unplugging and reconnecting is the moment Windows re-runs classification, so the profile you verified an hour ago is not the profile you have now.

Test on the pair Result What it proves
Both on the office switch Connection and upload succeed Ladder, addressing, and exporter are all correct
Direct cable, standard or crossover Cat5e Fails every time Not the cable, not the ladder
Office server off the switch, laptop left alone Still works No office service is needed while the session is up
Laptop reconnected while the server stays absent Fails until both are back Reconnection changes the classification, not just the wire

Decision: an office-network success proves the application and proves nothing about the direct path's inbound policy — treat a direct-link failure as a profile problem first.

How do I prove the firewall is the failing hop? #

Capture the wired adapter while the PLC triggers: if the PLC's connection request arrives at the laptop with no reply, the listener or the firewall is refusing it, and once netstat -ano shows the exporter listening, the inbound rule is what remains.

Read the capture against these outcomes:

  • No request on the wire — the fault is below the firewall: link state or addressing. Return to the addressing plan.
  • Request arrives, silence follows — the firewall is dropping it under a profile with no allow rule. This is the direct-link signature.
  • Request arrives and an immediate reset comes back — something answered no: either nothing is listening on that port or a rule rejects rather than drops. Match the port against the PC Ports entry and run netstat -ano to confirm the exporter is LISTENING on the address and port the connect block targets.
  • Read the active network profile in Windows settings after every reconnection; if it says Public, no Private-scoped rule can save this path.

Add one inbound rule for the actual exporter executable and leave the firewall on: allow the program, scope it to the exporter's listening port and the PLC's address, and make it apply to the Public profile, because the unidentified link always lands there.

In the traced installation, adding the exporter program to the firewall's incoming rules turned the direct connection from dead to working, with no other change. Set the rule against the executable that actually runs: the display name a firewall dialog shows for an application of this kind can differ from the executable's file name, so browse to the file on disk rather than trusting the label. Then verify the rule's four properties — enabled, action allow, profiles including Public, executable path — plus any address or port restrictions, which must include the controller, not exclude it.

When the exporter graduates from a borrowed laptop to a computer that lives at the line, an industrial mini PC in the cabinet takes over the same listening role next to the controller, and the same scoped inbound rule applies to it.

Do not disable the firewall or flip the machine to a looser profile to make this work — one scoped rule gives the PLC its path and gives every other port nothing. Decision: one inbound allow rule for the exporter executable, applied to all profiles so a reclassification cannot undo it.

What do I check, in what order, on the next machine? #

Work the path from wire to policy: link lights, then addresses and subnet, then listener, then capture, then the inbound rule — and fix each layer before blaming the one above it.

  1. Link lights at both ends. Dark means cable, connector, or port; fix that first. Cable type is not a candidate — both Cat5e types already failed identically.
  2. Addresses on one subnet by the worked example: both ends static, connect block aimed at the PC's wired address, wireless adapter out of the way.
  3. Ladder: TCP/IP CARD INIT once at power-up, socket 0 as TCP, Master, TCP/IP Connect from a positive transition gated on not-connected, and no TCP/IP Close anywhere.
  4. Listener: exporter in Ethernet (listen), port read from PC Ports, confirmed listening with netstat -ano.
  5. Capture while a trigger fires: a request with no reply is policy, an immediate reset is listener or port, no request is physical or addressing.
  6. Firewall: inbound allow rule for the real exporter executable, scoped to its port and the controller's address, applied to all profiles; re-read the active profile after any reconnection.

The case-to-decision table for everything above:

  • Works on the office network, fails on the direct cable — Public-profile firewall; add the scoped inbound rule.
  • Status cycles from initialized to closed while the trigger is held — plain contact re-triggering the connect; fit the one-shot.
  • One upload after power-up, then nothing — the ladder is closing the socket; remove the close and edge-qualify the connect.
  • Connect fires once and never again — the not-connected interlock is missing or the socket never dropped; check the interlock contact.
  • Request never reaches the wire — link or addressing; redo the addressing plan before touching policy.

Worked in that order, the direct link behaves like the office one: the PLC triggers, the socket holds, and the data lands.

Questions asked

Why did a crossover cable make no difference?

Either Cat5e type failed because the fault was never electrical. Almost every Ethernet interface built in the last fifteen years negotiates its transmit and receive pairs automatically (Auto MDI-X), so a crossover cable and a straight cable present the same working link to the driver, and your link lights confirmed exactly that. The failure sat one layer up, in Windows treating the unidentified link as Public and dropping the PLC's inbound connection.

Should I just put the machine on the office network instead?

You could, because an office-managed link usually lands in the Private profile and the PLC's inbound connection passes. It also couples a production line to office infrastructure and puts the machine's data path under someone else's change control. The durable fix is the scoped inbound rule on a dedicated direct link, which keeps the collection working with no office switch involved.

How do I scope the inbound rule so it opens only this path?

Create the rule for the exporter executable's real file path, set the action to allow, restrict the local port to the exporter's listening port from PC Ports, and restrict the remote address to the controller's fixed address from your addressing plan. Apply the rule to all profiles so a reclassification after a reconnection cannot silently cut the path again.

My connect fires once and works, but the next trigger does nothing — is that the firewall again?

No, that is the interlock, not the firewall. The connect only runs when the socket is not already connected; if the socket stayed open from the last transfer, a new trigger has nothing to do and rightly does nothing. It is the same reason a trigger pressed during a running transfer can wedge the socket: give the one-shot the not-connected condition and both symptoms disappear.

Keep reading

  • How-to

    Getting CompactLogix PLC data into Excel over EtherNet/IP

    Excel has no EtherNet/IP client, so a CompactLogix reaches a workbook only through a driver layer: an RSLinx edition that documents OPC or DDE support, or a driver library used within its license — RSLinx Classic Lite does neither. Put the PC and controller on one subnet, prove a single controller-scoped tag read, map that one cell, and add writes only against a dedicated test tag the logic validates.

    SCADA and data logging

  • How-to

    Connecting Wonderware to DH+ PLCs over Ethernet

    Put a 1756-DHRIO in an Ethernet-connected ControlLogix chassis and point the Wonderware ABCIP DA server at it: one device definition per DH+ controller, each carrying the full CIP path of chassis IP, module slot, DH+ channel and node address. Commission one known tag end to end before activating the rest. For one or two nodes with serial-speed access acceptable, per-PLC Ethernet-to-serial adapters work, but the PLC serial-port speed caps throughput.

    SCADA and data logging

  • How-to

    Control PLC connect and disconnect from a button

    Run the whole connect and disconnect cycle from one button with DisableSubscriptions: True while the operator edits settings, False only after the address is bound as a new Drivers.PLCAddressItem. EthernetIPforCLXCom drops its connection about 5 s after requests stop; OpcDaCom exposes no disconnect method, only paused subscriptions.

    SCADA and data logging