Skip to content

Latest commit

 

History

History
38 lines (32 loc) · 2.28 KB

README.md

File metadata and controls

38 lines (32 loc) · 2.28 KB

TF6310 PLC Getting Started Sample

Overview

This TwinCAT 3 sample provides a compact introduction to TF6310 TCP/IP communication in PLC code. It contains both TCP client and TCP server function blocks and demonstrates local loopback communication.

Contents

Item Description
TF6310_GettingStarted.sln Solution file for the Getting Started sample.

Prerequisites

  • TwinCAT 3 XAE engineering installed on Windows
  • TwinCAT 3 XAR runtime (local or remote)
  • TF6310 TCP/IP installed (local or remote)

Quick start

  1. Open TF6310_GettingStarted.sln in TwinCAT XAE.
  2. Select your target system.
  3. Build the solution and activate the configuration.
  4. Download the PLC project and set the runtime to Run.
  5. Observe client/server communication variables in MAIN.

What this sample does

  • Demonstrates basic TCP client and TCP server usage in one PLC project
  • Shows loopback communication using configurable local ports
  • Provides a minimal baseline for extending TCP/IP logic in TwinCAT
  • The sample runs one client (fbTcpClient1) and one echo server (fbTcpEchoServer1) in the same MAIN program and connects them via loopback (sServer1Host := '127.0.0.1', nServer1Port := 12000).
  • On each send cycle, the client payload is written to sClient1SendData. If bAutogenerateData = TRUE, the value is updated cyclically to TestString No.<counter> using nCnt and tClient1CycleTime.
  • The client sends sClient1SendData to the server and receives the server response into sClient1ReceivedData.
  • The server receives the incoming client telegram internally (server FB internal receive buffer), copies it to its send buffer, and exposes that send buffer at MAIN level through sServerData (sSendData => sServerData). This is the echoed value sent back to the client.
  • For online observation, monitor these communication variables in MAIN:
    • sClient1SendData (client transmit value)
    • sServerData (server echo/transmit value)
    • sClient1ReceivedData (client receive value)
    • bClient1Connected and bServer1Connected (connection state)

Support

Should you have any questions regarding this sample, please contact your local Beckhoff support team. Contact information can be found on the official Beckhoff website at https://www.beckhoff.com/contact/.