IMDHMIControls LibraryShop main store

Comparison

Which path links LabVIEW to an S7-300: OPC, direct Ethernet or MPI

Industrial networks Published 6 min read By IMDHMI controls team

Short answer

Use an OPC server with a supported Siemens S7-300 driver, hosted on Windows, unless the application must run entirely on the CompactRIO target. Siemens did not modify TCP/IP: S7comm is an application protocol over ordinary TCP on port 102, and a reverse-engineered library stays unverified until tested against your CPU, communication hardware and execution target.

On this page
  1. Why TCP/IP alone is not a protocol choice
  2. The four candidate paths compared
  3. What the S7-300 side must allow
  4. The CompactRIO constraint that decides the architecture
  5. Worked example: a CompactRIO reading 40 tags from an Ethernet-equipped S7-300
  6. Acceptance test before you commit
  7. Questions asked

Use an OPC server with a supported Siemens S7-300 driver, running on a Windows host, and point LabVIEW at it. That is the fastest documented path and the one with maintained driver support behind it. Siemens did not modify TCP/IP: the S7-300 speaks S7comm, a proprietary application protocol carried over ordinary TCP on port 102, and no special network hardware is needed to reach it. A reverse-engineered direct Ethernet library is not wrong, but it stays unverified until you test it against your exact CPU, communication module and LabVIEW execution target. MPI and PROFIBUS are options only when that is the physical interface the CPU actually offers.

Why TCP/IP alone is not a protocol choice #

TCP/IP moves bytes; it does not define how a client asks for a PLC variable. That layer is the application protocol: S7comm in the S7-300/400 family, carried over Ethernet on port 102 (the Nmap scripts s7-info.nse and s7-enumerate.nse and the Wireshark dissector packet-s7comm.c all key on that port). A direct library, an OPC server and a gateway all implement the same S7comm exchange; they differ only in who maintains that implementation and where it runs.

OPC is an interface between your application and a communication server. The server's Siemens driver does the S7comm work; LabVIEW talks to the server. So "TCP/IP over OPC" is backwards: OPC is the application interface, and TCP/IP is just the wire underneath it. Note also that OPC Classic and OPC UA are different interfaces. OPC Classic leans on Windows COM/DCOM; OPC UA is platform-independent. Pick the one your installed server and your LabVIEW target both support.

The four candidate paths compared #

Path How it reaches the S7-300 Where the software runs Choose it when
OPC server with Siemens S7 driver S7comm over Ethernet (port 102) or PROFIBUS, depending on the driver Server on a Windows host; LabVIEW client on PC or via a host-mediated link You want the shortest development time and maintained drivers
Direct Ethernet library S7comm requests coded in LabVIEW over TCP On the CompactRIO target itself The controller must run standalone and you validate the library first
MPI or PROFIBUS Requires a matching physical interface or adapter on the PC side PC adapter plus driver, as in connecting SCADA to an S7-300 MPI port with a PC adapter USB The CPU has no usable Ethernet endpoint and you accept extra hardware
Modbus Only if a Modbus implementation exists at both ends Driver or library on each side Both endpoints already speak it; otherwise it is a new integration task, not a shortcut

One clarification on the last row: putting Modbus on an S7 CPU's PROFINET port is its own question, covered in Modbus TCP and PROFINET on one CPU port. Do not assume it is free because the port exists.

What the S7-300 side must allow #

On the PLC side, S7 connections are configured in SIMATIC Manager: open NetPro through the menu "Options > Configure Network" and configure the S7 connection for the S7-300 CPU, with the PUT/GET instructions as the data-exchange mechanism. An external client over S7comm depends on the CPU accepting that connection, so if a direct library or OPC driver refuses to connect, check the connection configuration and the CPU's communication capability before blaming the client. The family name "S7-300" alone does not tell you which interface you have: read the CPU and any communication processor from the hardware configuration.

A ping proves only that the IP path works. The real test is reading one known value through the client and matching it to what the engineering tool shows.

The CompactRIO constraint that decides the architecture #

OPC Classic works naturally on the development computer because Windows provides DCOM. The deployed CompactRIO target may have no OPC Classic client interface at all, so a project that runs on your desk can fail on the controller. Check the client support for the actual target, not the workstation. If the target cannot open the OPC interface, run the OPC server on a Windows host, for example an industrial mini PC in the cabinet, and define the host-to-controller link and its failure behavior: losing that host interrupts data even while PLC and controller keep running. A direct controller-side client removes that dependency but moves connection management, byte-order decoding, reconnection and error reporting into your application.

For data checking, verify representative values of every data type you need. S7 values arrive in big-endian byte order; one working Boolean read proves nothing about how your REALs decode. For writes, distinguish a completed request from acceptance by the machine: cyclic logic can overwrite your value on the next scan, so use a command location the PLC program owns.

Worked example: a CompactRIO reading 40 tags from an Ethernet-equipped S7-300 #

Inputs (typical project values, use your own):

  • Tags to exchange: 40, mixed Boolean and 16-bit integer, as an example project list.
  • CPU: an S7-300 with a configured Ethernet endpoint, IP address known from the hardware configuration.
  • Execution target: CompactRIO real-time, no Windows on the controller.

Rule: the path must be one the execution target can open; pick the cheapest architecture that survives that test.

Arithmetic: 40 tags, take 2 bytes each as the worst case for Booleans packed one per byte plus INTs: 40 x 2 B = 80 B per poll. One S7comm PDU easily carries that in a single request, so bandwidth decides nothing here; the target constraint decides everything. The controller has no OPC Classic (DCOM) client, so an OPC server hosted on the controller is out. Two architectures remain: a direct S7comm library on the controller, or an OPC server on a Windows host with a host-to-controller link.

Decision: run the OPC server with the Siemens S7 driver on a Windows host and give the CompactRIO a supported link to it. Choose the direct library only if you validate it on your CPU and target first (connect, read all 40 tags, verify byte order on an INT, kill and restore the cable to test reconnection) and the standalone-controller requirement outweighs that validation effort. Above roughly a day of validation effort on the library, the host-mediated OPC design is cheaper overall.

Acceptance test before you commit #

  1. Confirm the CPU and communication module from the hardware configuration, and the S7 connection in NetPro.
  2. Read one known INT through the chosen client; the value must match the engineering tool exactly.
  3. Read every data type you will use, and check byte order and signedness on the INTs and REALs.
  4. Write one value to an application-approved location and confirm the PLC logic does not overwrite it.
  5. Pull the Ethernet link, restore it, and confirm the client reconnects and recovers data without a restart.

Pass all five on the deployed target and the path is verified; fail any and fix the cause before scaling up.

Questions asked

Does Siemens use a modified TCP/IP stack on the S7-300?

No. TCP/IP is transport only; S7comm is a proprietary application protocol carried over ordinary TCP on port 102. No special network hardware or stack is needed to reach it, but the client software must implement the S7comm requests, addressing and data types correctly.

Is a ping enough to prove the S7-300 is reachable for data exchange?

No. A successful ping shows the IP path and physical link work, nothing more. Read one known value through the actual client and compare it with the value the PLC engineering tool shows; only that proves the application connection and the decoding.

What does PUT/GET have to do with an external LabVIEW client?

PUT/GET are the S7 communication instructions configured in NetPro under Options > Configure Network; they define which S7 connections the CPU accepts. An external client over S7comm depends on the CPU allowing that connection, so confirm the connection configuration before blaming the client library.

Why does the OPC connection work in development but fail on the deployed CompactRIO?

The development computer runs Windows and can act as an OPC Classic client over DCOM; the CompactRIO real-time target often has no such client interface. Test the exact target: if it cannot open the OPC interface, run the OPC server on a Windows host and move data to the controller over a supported host-to-controller link.

Keep reading

  • How-to

    CODESYS as an OPC UA client to an S7-1200 server

    Yes: a CODESYS runtime can act as an OPC UA client to an S7-1200 acting as the server, but only with the separately licensed OPC UA Client SL on the CODESYS device, an S7-1200 CPU and firmware that support its OPC UA server with published variables, and a matching endpoint, exchanged application certificates, an authorized user identity and the variable's NodeId. Configuring the S7-1200 server alone provides none of that.

    Industrial networks

  • Explainer

    S7-1500 OPC UA server over a CP 1543-1: when it works

    The S7-1500 OPC UA server is reachable only through the CPU's integrated PROFINET interfaces. One documented exception exists: a CP 1543-1 at firmware V2.2 or later, a CPU at firmware V2.8 or later (V3.1 for R/H CPUs), projected in TIA Portal V16 or later, carries the server over IPv4 forwarding and the CPU's virtual communication interface. Older combinations, including any CP1542SP-1, leave only the CPU's own address in the server list.

    Industrial networks

  • Selection guide

    Choosing how an S7 PLC talks to a Mitsubishi Q or AnS PLC

    Yes — the link exists on every generation. Put Modbus TCP (QJ71MT91) or Modbus RTU (QJ71MB91) against a Mitsubishi Q series PLC, PROFIBUS master or slave against an AnS or QnAS because those generations had no Modbus modules, and a protocol-converting gateway where the two sides share no interface.

    Industrial networks