To talk to a TwinCAT PLC from C#, install Beckhoff’s TwinCAT ADS .NET client from NuGet, make sure an ADS/AMS router is reachable from the machine running your code, and connect using the target’s AMS NetId and the ADS port of the PLC runtime. Beckhoff lists port 801 for PLC Runtime 1. Before you copy any code, though, you need to know which API generation you are using, because Beckhoff’s current documentation centres on AdsClient while an older reference centres on TcAdsClient.
What ADS is, and what it is not
ADS (Automation Device Specification) is the communication protocol of TwinCAT, Beckhoff’s automation software. Clients use it to reach TwinCAT systems and to access process-image data, status changes, PLC symbol information, and variables addressed by name. TwinCAT modules exchange commands and data locally and across TCP/IP through a message-router architecture.
As an Amazon Associate I earn from qualifying purchases.
ADS is an interface, not a promise that every device answers the same requests in the same way. What a request means depends on the ADS device you address. Treat the device’s own documentation as the authority for its services, and treat the ADS documentation as the authority for how the message is framed and routed.
Choose the API generation before you install anything
Beckhoff’s .NET API has changed shape over time, and the two generations you are likely to encounter use different entry points. Decide which one your project targets, then use only the packages, constructors and method signatures documented for that generation.
#1 Best Overall
- -- PLC Type: Fully compatible with FX1S, 7 Input 5 Relay Output (24V pulse single). Have additional 4 Transistor Output: 2 for high speed pulse 100KHz & 2 for direction, can drive 2 servos or 2 steppers with pulse
- -- PLC software: Use GX Workers 2 or Developer (pls download from GX Workers 2 website, we only have Chinese version), support Command + T Ladder Diagram + SFC for programming
- -- HMI Software: YKBuilder V5.3/7.0 (Pls contact us, we will share it and the video instruction and guidelines). For HMI model: pls choose FE Serial, 280D
- -- Use the same Cable for download program from PC to PLC/HMI: Use the: mini port – USB cable, pls install HMI & PLC’s USB driver first, which we will share.
| Generation | Main entry point | Where it is documented | What to do |
|---|---|---|---|
| Current | AdsClient |
Current TwinCAT ADS .NET API documentation | Install Beckhoff.TwinCAT.Ads and follow the current API reference for signatures. |
| Older | TcAdsClient |
Older TwinCAT ADS .NET API reference | Use only if your existing project is built against that generation; do not mix its constructors with AdsClient code. |
If you find a sample online, check which class it instantiates before you reuse it. Code that mixes the two generations will not compile reliably, and reading an older sample against a current package is a common source of confusion.
Prerequisites
Beckhoff’s Version 6 prerequisites page describes the following requirements for the API generation it covers. Re-check them against the NuGet release you actually install.
- An ADS/AMS router. Beckhoff documents a local TwinCAT installation and router-console or TCP-router arrangements as options. Which one fits depends on where your .NET process runs and what router is available to it.
- A compatible .NET SDK. The page lists .NET 5 or later, .NET Core 3.1 or later, .NET Framework 4.61 or later (the value as written on the page; confirm the exact string there), or a .NET Standard 2.0-compatible SDK.
- The target’s AMS NetId and PLC runtime ADS port. You cannot connect without them.
- A configured route from the machine running your code to the target.
Install the package
Beckhoff names NuGet as its preferred installation method and identifies Beckhoff.TwinCAT.Ads as the main package for ADS client functionality.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Rank #2
- Weight: 1.00lb
- Product Dimensions: 9.00 x 9.00 x 7.00 inches
- Condition: New
- Confirm the API generation your code will use, as described above.
- Add the package to your project. In a terminal in the project directory, run:
dotnet add package Beckhoff.TwinCAT.AdsIn Visual Studio, use the NuGet Package Manager (Project > Manage NuGet Packages) and search for
Beckhoff.TwinCAT.Ads. Pin a specific version if your project requires one. - Optional: add
Beckhoff.TwinCAT.Ads.Reactiveif you want ADS notifications exposed as observable events. It is an extension package and is not needed for basic reads and writes. - Avoid manual DLL references unless you have a specific reason. Beckhoff documents them as an alternative, but the installation page marks that approach as obsolete and non-preferred.
Address the target: AMS NetId and ADS port
An ADS destination is identified by two values. The AMS NetId identifies the system and must be unique among its communication partners. The ADS port selects the runtime or device on that system. Keep the two separate in your code: the NetId is not an IP address, and the port is not a fixed property of every TwinCAT target.
| Item | Value | Scope and source |
|---|---|---|
| AMS NetId | Taken from your target system’s configuration | Must be unique among communication partners (Beckhoff ADS documentation). Not a fixed value. |
| PLC Runtime 1 ADS port | 801 | Listed on Beckhoff’s current device-identification page. Verify that it is the runtime you intend to use. |
| ADS TCP port on a CX8090 | 48898 (0xBF02) | Device-specific, from Beckhoff’s CX8090 communication page. Applies only to that device and must be checked against its configuration. |
Do not assume that 801 applies to every runtime or device. Other runtimes use their own ports, and the value should come from the target’s documentation or configuration.
What you can do after connecting
Beckhoff’s .NET API documents a set of capabilities that cover most first projects:
Rank #3
- -- PLC Type: Fully compatible with FX1S, 10 Transistor Input (NPN Type), 7 Relay Output. Have additional 4 Transistor Output: 2 for high speed pulse 100KHz & 2 for direction, can drive 2 servos or 2 steppers with pulse, built-in 2AD(0-10V) and 2DA(0-10V), also 2 NTC10K B3435 probe. Just read the address of AD DA NTC's will ok, 2 high speed input 100KHz X0 X1 to control encoder
- -- PLC software: Use GX Workers 2 or Developer (pls download from GX Workers 2 website, we only have Chinese version), support Command + T Ladder Diagram + SFC for programming
- -- HMI Software: YKBuilder V5.3 and Choose FE serial 380 model in HMI software. (Pls contact us, we will share it and the video instruction and guidelines), very easy to use, just create the buttun and set the address
- -- Use the same Cable for download program from PC to PLC/HMI: Use the: mini port – USB cable, pls install HMI & PLC’s USB driver first, which we will share.
- Read and write process-image information, either as raw bytes or in typed form.
- Browse server-side PLC symbols.
- Access variables by name rather than by memory offset.
- Receive notifications when values change, delivered as events.
ADS also supports synchronous and asynchronous access, as well as cyclic and event-based messages. The choice between these styles is a question of fit for your application rather than of measured speed. The documentation consulted here publishes no benchmark or latency figures, so no approach should be assumed faster in general.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11| Approach | Fits when | Trade-off to plan for |
|---|---|---|
| One-off read or write | Your code needs a value at a specific moment, such as a status check or a single command. | Your code must decide when to ask again. |
| Notifications | Your code should react to a change rather than poll. | You manage subscriptions and their lifetime. The Reactive package is optional. |
| Raw process-image access | You need byte-level control or already know the memory layout. | You own the data layout and type conversion. |
| Typed or symbolic access | You work with named variables and .NET types. | Symbol information must be available for the variables you use. |
| Synchronous calls | The logic is simple and sequential. | The calling thread waits for each response. |
| Asynchronous calls | The application must keep other work running while waiting. | Your code needs consistent async handling. |
A first working sequence
The steps below are an editorial sequence built from the documented prerequisites and capabilities. Beckhoff’s pages do not prescribe this exact order, so confirm method names and signatures in the reference for your API generation.
- Identify the package generation and install its NuGet package.
- Confirm that an ADS/AMS router is available to the .NET process.
- Obtain the target’s AMS NetId and PLC runtime port, and confirm that routing is configured.
- Create an
AdsClientconnection using constructors and methods from the same API generation. - Perform one read or one write against a known PLC variable that your project declares and permits you to access.
- Expand to symbol browsing or notifications once the simple read or write works.
- Add error handling around connection and calls, and close or dispose the client when finished, following the pattern documented for your version.
When the connection fails
Work through these checks in order. Each maps to a prerequisite above.
Rank #4
- -- PLC Type: Fully compatible with FX1S, 10 Input 7 Relay Output (5V pulse single). Have additional 4 Transistor Output: 2 for high speed pulse 100KHz & 2 for direction, can drive 2 servos or 2 steppers with pulse; have 2 high speed input 100KHz X0 X1 to control encoder also
- -- PLC software: Use GX Workers 2 or Developer (pls download from GX Workers 2 website, we only have Chinese version), support Command + T Ladder Diagram + SFC for programming
- -- HMI Software: YKBuilder (Pls dowload from link or contact us, we will share it and the video instruction and guidelines), very easy to use, just create the buttun and set the address
- -- Use the same Cable for download program from PC to PLC/HMI: Use the: mini port – USB cable, pls install HMI & PLC’s USB driver first, which we shared from link
- No router reachable. Confirm that TwinCAT is installed locally, or that the remote router is running and reachable from your machine.
- NetId mismatch. The NetId in your code must match the target’s configured NetId exactly.
- Wrong port. Port 801 is PLC Runtime 1 in Beckhoff’s listing. Other runtimes and devices use different ports.
- No route. The client machine needs a configured route to the target.
- Generation mismatch. Code written for
TcAdsClientwill not match a currentAdsClientpackage, and the reverse is also true. - Unsupported runtime. Your .NET SDK must meet one of the baselines listed on the prerequisites page.
What this guide does not establish
This guide does not include a tested end-to-end program for any particular PLC project. Variable declarations, access permissions, timeout strategy and error conditions depend on your installation, so treat the steps above as a structure to adapt rather than as code that runs unchanged. Version requirements, package APIs and routing details can change, so confirm them against the NuGet release and TwinCAT version you use.
Beckhoff’s documentation establishes the protocol, package, addressing and capability facts in this article. It does not establish performance characteristics, so choose between the access styles above on functional grounds.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




