Communicating S7-1500 to LabVIEW via UDP in TIA Portal V14

David Krause15 min read
Industrial NetworkingSiemensTutorial / How-to
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

Communicating S7-1500 to LabVIEW via UDP in TIA Portal V14

The SIMATIC S7-1500 controller family supports connectionless UDP communication natively on its integrated PROFINET interface. Unlike legacy S7-300 CPUs whose integrated PN port did not implement the full open user communication stack and frequently required a separate CP (e.g. CP 343-1) for UDP, the S7-1500 integrated port implements UDP, TCP, ISO-on-TCP, and Modbus/TCP without additional hardware. This tutorial walks through the full configuration path: hardware selection, TIA Portal V14 project setup, the UDP connection definition in Devices & Networks, the TUSEND / TURCV program blocks on the PLC side, and the matching LabVIEW UDP VIs on the IPC side. Target engineers: anyone running a supervisory/test application on a National Instruments IPC that must exchange process data with an S7-1500 CPU over Ethernet.

1. Communication Architecture Overview

UDP is a connectionless, datagram-oriented transport protocol. There is no three-way handshake, no acknowledgement, and no built-in retransmission — every datagram is sent best-effort. The trade-off is low latency and low overhead, which is well suited to cyclic data streaming from a controller to a measurement/visualization front-end, or to small, frequent command/response messages where loss of an individual packet is non-critical.

In the S7-1500 world UDP is realized by the T-block family (TSEND, TRCV, TUSEND, TURCV, TCON, TDISCON) sitting on top of the operating system's ISO/OSI transport layer. The TIA Portal V14 release shipped TUSEND V1.0 and TURCV V1.0 for S7-1200/S7-1500, both of which are still the standard blocks for UDP traffic in current TIA Portal versions. The connection itself is configured declaratively in the Devices & Networks editor — the program blocks only reference the connection by ID.

The endpoints of a UDP "connection" in TIA Portal are described by a Local End Point (PLC IP + local port) and a Remote End Point (partner IP + partner port). Note that despite the name, no persistent connection state is established — the description simply tells the CPU where to send and where to accept datagrams from. See the official TIA Portal reference UDP address details (S7-300, S7-400, S7-1500) for the parameter model used in TIA Portal.

2. Prerequisites

Item Requirement Notes
S7-1500 CPU CPU 1511-1 PN, 1513-1 PN, 1515-2 PN, 1516-3 PN/DP, 1517-3 PN/DP, 1518-4 PN/DP, or 1516F/1517F/1518F fail-safe variants Any S7-1500 CPU whose part number ends in "-1 PN" or higher ships with an integrated PROFINET interface that supports TCP, UDP, ISO-on-TCP, and Modbus/TCP out of the box
Firmware FW 1.8 minimum recommended for TIA V14 SP1; FW 2.0+ for newer TUSEND/TURCV features UDP itself works on FW 1.0 and later, but bug-fix and security improvements accumulate in newer firmware
TIA Portal STEP 7 Professional V14 / V14 SP1 (or later) V14 SP1 added several diagnostic improvements; V15+ is also fine and the procedure is identical
PC interface Onboard Ethernet of the IPC, or any compatible PCIe/USB Ethernet adapter Disable Windows Firewall rules or open the UDP port explicitly on the IPC
LabVIEW LabVIEW 2014 or later (any edition; Base, Full, Professional) The UDP VIs sit in the Data Communication » Protocols » UDP palette and require no add-on toolkit
Cabling Cat 5e / Cat 6 patch, direct or via managed switch If the IPC and PLC are on the same subnet, a crossover is no longer required for any modern NIC
IP plan PLC e.g. 192.168.0.10/24, IPC e.g. 192.168.0.20/24 Avoid DHCP for the PLC — assign a static IP via TIA Portal or display
Network address design rule. For UDP, both endpoints must be on the same IP subnet, or routing must be configured on the gateway device. There is no discovery mechanism — if either side has the wrong subnet mask or default gateway, datagrams will be silently dropped with no error on the application layer.

3. Configuring the S7-1500 Hardware in TIA Portal V14

  1. Open TIA Portal V14 and create a new project. Add a new device Add new device » SIMATIC S7-1500 » CPU ... » 6ES7 XXX-... matching the catalog number of the physical CPU. Confirm the firmware version matches the target (e.g. CPU 1515-2 PN, 6ES7515-2AM02-0AB0, FW 2.6).
  2. Open Device view and select the PROFINET interface X1. Under Ethernet addresses, set the IP address (e.g. 192.168.0.10) and subnet mask (255.255.255.0). Leave the router empty unless traffic must leave the subnet.
  3. Under Properties » General » PROFINET interface » Advanced options » Port statistics, enable the access to the port statistics if you want to monitor received/sent packets.
  4. Download the hardware configuration to the CPU. The CPU's X1 LEDs should show a steady green LINK on the port connected to the IPC or switch.

4. Creating the UDP Connection

  1. In the project tree, switch to Devices & Networks and select the S7-1500 CPU.
  2. Click Connections in the toolbar, then choose the connection type UDP connection from the drop-down. A new connection line appears, anchored at the CPU's PROFINET port.
  3. Drag the right end of the line to the not connected endpoint. In the inspector Properties » General » General, choose Unspecified as partner for the initial setup, or pick a partner CPU/PC station if you have added one.
  4. In Properties » General » Address details, configure the endpoints:
Field Value (example) Meaning
Local end point » IP address 192.168.0.10 PLC IP, taken from PROFINET interface X1
Local end point » Port 2000 Local UDP port the CPU listens on. Use a port > 1024 to avoid well-known port conflicts
Remote end point » IP address 192.168.0.20 IPC IP. Set to 0.0.0.0 if the partner is unspecified
Remote end point » Port 2001 IPC UDP port the LabVIEW VIs will use
Connection name PLC_LabVIEW_UDP_1 Free-form, appears in the program as a connection ID resource

Confirm the connection. The connection ID is generated automatically; you will read it from the Connection resources tab of the inspector (e.g. ID = 1). The local ID is the handle the TUSEND/TURCV blocks will reference.

Connection name rules. Siemens connection names are limited to 24 characters in TIA V14; avoid spaces and special characters. The full path to the connection (CPU name + connection name) must be unique across the project.

5. PLC Program: TUSEND and TURCV Blocks

The S7-1500 UDP blocks are:

Block Direction Purpose
TUSEND Send Sends a UDP datagram from the PLC to the configured remote endpoint
TURCV Receive Receives a UDP datagram from any permitted remote endpoint on the local port

Both blocks ship in the Instructions » Communication » Open user communication task card of TIA Portal. Drop one TUSEND DB and one TURCV DB into the project; the DBs become the instance data blocks for the blocks.

5.1 Send (TUSEND) — SCL example

// FB "PLC_LabVIEW_Sender" — call in OB1 cyclic
// Sends 10 bytes from DB100 starting at byte 0 every 100 ms

#TUSEND_Instance(REQ     := TRUE,                   // rising edge triggers send
                 ID      := 1,                       // connection ID from Devices & Networks
                 LEN     := 10,                      // payload length in bytes
                 DATA    := P#DB100.DBX0.0 BYTE 10,  // ANY pointer to send area
                 DONE    => #sendDone,
                 BUSY    => #sendBusy,
                 ERROR   => #sendError,
                 STATUS  => #sendStatus);

5.2 Receive (TURCV) — SCL example

// FB "PLC_LabVIEW_Receiver" — call in OB1 cyclic
// Receives up to 100 bytes into DB101 starting at byte 0

#TURCV_Instance(EN_R     := TRUE,                    // enable receive
                 ID       := 1,                       // connection ID
                 LEN      := 100,                     // max length to accept
                 DATA     := P#DB101.DBX0.0 BYTE 100, // ANY pointer to receive area
                 NDR      => #rcvNewData,             // new data flag
                 BUSY     => #rcvBusy,
                 ERROR    => #rcvError,
                 STATUS   => #rcvStatus,
                 RCVD_LEN => #rcvLen);                // actual bytes received

Important T-block behavior:

  • TUSEND is edge-triggered on REQ. Hold REQ = TRUE and the block sends one datagram per rising edge of REQ. To send cyclically, pulse REQ with a 100 ms timer (e.g. from a TP/IEC_TIMER) or feed it from the BUSY fall-edge in a wrapper FB.
  • TURCV is level-triggered. As long as EN_R is TRUE and there is no error, it pulls a datagram from the receive buffer on every call. NDR is set for one cycle whenever a new datagram has been copied into the receive area. RCVD_LEN tells you the actual length.
  • STATUS returns the standard S7 communication error codes (e.g. 0000_0000 = OK, 80A4_0000 = no partner reachable, 80A7_0000 = data length error). The block help (F1) lists every value.
Datagram size limit. UDP datagrams are limited to 1,472 bytes on a standard Ethernet/IPv4 frame (1,500-byte MTU minus 20-byte IP header and 8-byte UDP header). TIA Portal V14 will accept LEN values larger than this, but the CPU will return STATUS = 80A7 at runtime. Keep your payload <= 1,400 bytes for safety.

6. LabVIEW UDP Configuration

On the IPC side, the equivalent communication primitives live on the block diagram under Data Communication » Protocols » UDP. The minimum set of VIs is:

VI Role Key inputs
UDP Open Reserves a local UDP port and returns a session handle port = 2001, optionally net address = "0.0.0.0" for any local adapter
UDP Write Sends a datagram connection in / out, remote host = "192.168.0.10", remote port = 2000, data in (variant)
UDP Read Receives a datagram connection in / out, max datagram size = 1472, data out, source address / source port
UDP Close Frees the local port connection

6.1 Minimal LabVIEW block-diagram recipe

  1. Place UDP Open on the diagram, wire port 2001 into the port terminal. Run the VI once to verify Windows can bind the port; if the VI returns error 8 ("Specified address is already in use"), another process holds the port — close it or pick a different port.
  2. Wrap UDP Read in a While Loop with a 50 ms wait. Set max datagram size to 100 (matching the PLC's LEN). The data out cluster gives you the raw bytes and the source IP/port. Use Unflatten From String with the matching cluster type to decode the payload.
  3. For sending, build a cluster of your process data, run it through Flatten To String, and wire the result to UDP Write with remote host = "192.168.0.10" and remote port = 2000.
  4. Place UDP Close in the stop condition of the While Loop so the socket is freed when the VI terminates.

6.2 Byte order on the wire

S7-1500 is little-endian. LabVIEW's Flatten To String also writes in host byte order, which is little-endian on x86/x64 Windows. By default, S7-1500 byte memory (%DB100.DBX), word (%DB100.DBW) and dword (%DB100.DBD) is stored little-endian, so a 4-byte float placed at offset 0 lines up byte-for-byte with a LabVIEW Single unflattened from offset 0. If you use the S7-1500 Optimized Block Access for DB100/DB101, you must disable that property on the data blocks used for UDP exchange, or the compiler will reorder the fields.

7. End-to-End Commissioning Procedure

  1. From the IPC, ping the PLC: ping 192.168.0.10. A reply confirms layer-3 reachability.
  2. Open a Command Prompt on the IPC and run netstat -an | findstr 2001 after starting the LabVIEW VI. You should see UDP 0.0.0.0:2001 *:*.
  3. In TIA Portal, go Online » Go online, then Online » Diagnostics » Connection diagnostics. The UDP connection should show status Established.
  4. Force a value in DB100 (e.g. set byte 0 to 16#AA) and observe it arrive in LabVIEW. Set a value in LabVIEW and observe it land in DB101 on the PLC.
  5. Open TIA Portal » Online » Diagnostics » Port statistics on the PROFINET interface to confirm send/receive counters are incrementing in both directions.

8. Diagnostics and Status Codes

STATUS (hex) Meaning (TUSEND / TURCV) Engineer action
0000 0000 OK, no error None
7000 0000 Block is idle / call without active job Normal in cyclic OB1
7001 0000 Job is starting / first call Normal
7002 0000 Job is running (BUSY) Wait for DONE / NDR
8085 0000 LADDR / ID parameter wrong Verify connection ID matches Devices & Networks
80A1 0000 Connection or port already in use Check IP/port conflicts, look at Port statistics
80A4 0000 No partner reachable / ARP failed Ping the partner, check subnet mask, check switch port
80A7 0000 Data length error / buffer too small Reduce LEN to <= 1472, or enlarge receive buffer
80B4 0000 Connection type not UDP / wrong protocol configured Verify the connection in Devices & Networks is a UDP connection
80C3 0000 Memory / resource bottleneck Reduce send rate, check for overlapping receive areas

For deeper inspection, use the record set PROFINET IO » Port statistics » Record index 0x800A via RDREC, or read the CPU web server's Diagnostics » Information » Communication page. The web server is enabled under CPU properties » Web server » Activate; access it from a browser at http://192.168.0.10.

9. Performance and Tuning

Default OB1 cycle on a CPU 1515-2 PN with a typical program is 1 to 5 ms. Sending a UDP datagram of 100 bytes every 1 ms is feasible; every 0.1 ms starts to show load. The two tuning knobs are:

  • Send rate. Bound the TUSEND trigger to an IEC timer rather than a free-running OB1 call. A 50 to 200 ms cycle is the typical range for HMI / IPC visualization.
  • Payload size. UDP performance is dominated by per-packet overhead. Sending 16 single-byte datagrams is roughly 16x more expensive than sending one 16-byte datagram. Bundle your process data into one struct per cycle.

If you need a lower-level of assurance, drop UDP and use ISO-on-TCP (TRCV/TRCV with a confirmed connection). UDP cannot tell you if a datagram was lost; ISO-on-TCP adds TCP's stream and acknowledgement guarantees on top of the same T-block API.

10. Security Considerations

UDP is unencrypted and unauthenticated. For shop-floor deployments, do the following:

  • Place the PLC and IPC on an isolated VLAN or behind a managed switch with port-based ACLs.
  • If the S7-1500 must sit on a routed network, use a CP 1543-1 (6GK7543-1AX00-0XE0) for an additional Ethernet interface with firewall and VPN; configure the Security » Firewall rules to permit only the IPC's IP on the UDP ports in use.
  • Enable CPU properties » Security » Activate access protection and assign a password to the PLC. Without it, anyone on the network can stop/restart the CPU and modify the program.

11. Troubleshooting Matrix

Symptom Likely cause Fix
LabVIEW error 7 at UDP Open Port < 1024 chosen without admin rights Use a port > 1024, or run LabVIEW as administrator
LabVIEW error 8 at UDP Open Port already in use by another process netstat -ano | findstr :2001 to find the PID and stop the process
TUSEND STATUS 80A4 IPC not reachable, ARP not resolving Ping the IPC, verify switch port is up, check subnet mask
TURCV never sets NDR LabVIEW sending to wrong port, or wrong IP Wireshark on the IPC to verify the source port matches the configured remote port
Data arrives but values are garbled Byte order mismatch or Optimized Block Access Disable Optimized Block Access on the data DB, swap bytes in LabVIEW using Byte Swap if necessary
STATUS 8085 after download Connection ID changed because the connection was recreated Re-read the connection ID from Devices & Networks, update the ID constant in the program
Intermittent packet loss Network congestion, broadcast storm, duplex mismatch Force switch port and NIC to 100 Mbps / full duplex, isolate VLAN, lower send rate

12. Frequently Asked Questions

Does the S7-1500 integrated PROFINET port really support UDP without a CP card?

Yes. From firmware 1.0 onward, every S7-1500 CPU with a PROFINET interface (X1, X2, X3 depending on the model) supports TCP, UDP, ISO-on-TCP, and Modbus/TCP on the integrated port. The historical limitation that required a CP card existed on older S7-300 CPUs and is not present on the S7-1500 platform.

Which TIA Portal blocks do I use for UDP: TSEND_C/TRCV_C or TUSEND/TURCV?

Use TUSEND for sending and TURCV for receiving. The TSEND_C / TRCV_C blocks are for TCP/ISO-on-TCP connections; TIA Portal will reject a TCP block bound to a UDP connection description. For S7-1200/S7-1500 the modern T-block family is the correct API.

What port numbers can I use for the S7-1500 UDP connection?

Any port from 1 to 49151, with 1024 to 49151 being the practical range to avoid well-known services. Typical choices are 2000, 2001, 3000, 5000, or 6000. The local and remote ports must be different. The CPU rejects ports already in use by another connection or system service and returns STATUS 80A1.

How do I find the connection ID for the TUSEND/TURCV ID input?

Open Devices & Networks, click the UDP connection, then look at Properties » General » Connection resources. TIA Portal lists the local ID (used as input to ID), the partner ID, and the connection name. The local ID is unique per CPU.

Can I use the same PLC UDP port for multiple LabVIEW clients?

Yes, with care. UDP is one-to-many by design. Create one UDP connection per peer in TIA Portal; the connection resource table will list the additional connections and the receive block will need to be expanded to distinguish sources by the RCVD parameter. A simpler approach is to run the supervisory front-end on a single IPC and use a hub-and-spoke topology with one connection per direction.

What is the maximum payload size I can send in a single TUSEND call?

1,472 bytes on a standard 1,500-byte Ethernet MTU. TIA Portal will accept larger LEN values in the editor, but the CPU returns STATUS 80A7 at runtime. For larger datasets, split into multiple datagrams and reassemble in the receiver, or switch to ISO-on-TCP / TCP for a streaming channel.

Do I need Optimized Block Access turned off for the UDP data DBs?

Yes. Optimized Block Access rearranges the byte layout of the DB so that symbols are aligned to word or dword boundaries, which breaks a fixed-offset Flatted-String exchange with LabVIEW. Either disable Optimized Block Access on the data DBs, or define the exchange area as a single Array of Byte in the optimized DB and interpret the array index in both applications.

Back to blog