Contact and Coil | Nearly In Control

TwinCAT 3 Tutorial

This is an in-depth tutorial on Beckhoff’s TwinCAT 3 PC-based automation software.

Twin cats?

Twin cats?

The tutorial is organized into a chapter format and is meant to be read like a book. Start here with the Table of Contents:

  1. Introduction
  2. Quick Start
  3. Structuring PLC Data
  4. Persistent Variables
  5. Structuring PLC Logic
  6. Multiple Virtual PLCs
  7. Ladder Logic Editor
  8. Writing your own Functions and Function Blocks
  9. Structured Text
  10. Building an HMI in .NET
  11. Introduction to Motion Control
  12. Introduction to TwinSAFE
  13. The Scope View
  14. Part Tracking

Be sure to check out my RSLogix 5000 Tutorial as well.


  • codezs09 · January 29, 2016 at 12:59 pm

    This tutorial is great. Very specific in every details with understandable explanations.
    There are not a lot intro related to TWINCAT 3. This one is really the best I have ever seen.
    Much thanks to your effort! And strongly recommend it to others.

  • Gerard · February 23, 2016 at 11:28 am

    I find it a pity that the tutorials don’t come with a time stamp. One can see how old the blog entries are, but no idea about each of the tutorial chapters.

  • Ledian · February 28, 2016 at 8:58 am

    I come from an Omron plc experience background on Cx-Programmer and now I am trying to learn NJ-controllers (Sysmac Studio) and Backhoff (TwinCat 3) as both environments are based on Codesys. I like the ideology of these products more than Siemens and AB. I found these TwinCAT 3 tutorial useful as it’s detailed and clear to understand with examples. Thank you for your contribution, I will continue to follow every chapter of this tutorial hoping to get all the basic knowledge of PC based Automation Technology from Beckhoff. Good work, thanks again.

  • John nielsen · March 18, 2016 at 4:24 pm

    Great tutorial. Very easy to understand and thoug with very detailed and good explanations.
    The Best intro to TWINCAT 3.I have seen so far.
    Are you planning a chapter on scoope view ?
    I very much recommend this tutorial to others.
    Very god work, thank you very much

  • Author comment by Scott Whitlock · March 19, 2016 at 10:11 am

    @JohnNielsen – Thank you! Yes, after the next chapter (on TwinSAFE) then I’m going to do a chapter on the Scope Viewer, which is a really useful tool, even though it’s a bit intimidating at first.

  • John C. · April 15, 2016 at 1:44 pm

    Scott, I very much appreciate your tutorials. I’m in the process of learning TwinCAT 3 and, as others have pointed out, there are virtually no “getting started” materials available from Beckhoff. I found your “Structuring PLC Logic” lesson to be particularly interesting, as I come from an AB background. Keep them coming!

    (If you’re taking suggestions for future lessons, I’d like to learn more about EtherCAT… tips on laying out networks with couplers and terminals, addressing, troubleshooting, etc.)

  • glauber cabral de souza · April 17, 2016 at 12:42 pm

    Thank you a lot!!!! this helped me so much.

  • alex · April 20, 2016 at 10:20 am

    great tutorial for starters just like me
    many thanks from china!

  • biruk · May 17, 2016 at 5:39 am

    This is a great tutorial, very well organized, simple and tractable explanations. Thank you

  • Jeyfel Brandauer · May 19, 2016 at 5:50 am

    Thank you for this great tutorial!
    I’m a student currently in an internship and i’m kind of new in the automation control world. I do software development. So this tutorial is definitely helpful as I have to use TwinCAT.

    In the 6th part of the tutorial we create a EtherCAT device and its I/O. Each I/O (eg. EL1008 channels) of an EtherCAT device has its own Index group and offset. Does it mean that we can access them remotely with a TwinCAT ADS Client?
    This would be of great help to me.

    Jeyfel B

  • Author comment by Scott Whitlock · May 19, 2016 at 7:24 am

    @JeyfelBrandauer – In theory yes, but I can’t remember ever doing it. If you happen to be doing a non-real-time system (just using Beckhoff I/O controlled from, e.g. C++ or C# in a PC program) then I recall the right way to do that is to create a Task in TwinCAT without creating a PLC (this way you only need the I/O license, not the PLC license). You create variables directly in the Task and you map them to the I/O. I/O needs to be linked to a task for it to “scan”. The task has an ADS port number. You then read and write to the variables you’ve created directly in that task, and TwinCAT handles moving the data to/from the I/O card (e.g. EL1008). That was a long time ago, though, so it’s a bit fuzzy.

  • Jeyfel Brandauer · May 20, 2016 at 3:56 am

    @Scott – Thank you for the reply! I’m working on a virtual commissioning project. We need to test and validate our PLC programs (Ladder, ST etc.) by running them inside of TwinCAT. My goal is to build an external program (i.e an ADS client program, in C++) which will “drive” the validation of our PLC programs by interacting with TwinCAT. Actually I did couple of things such as reading and writing PLC variables. The problem that I’m facing is to subscribe to their “state change” event. TwinCAT provides an ADS notification service to do so, but it’s not available for IO-tasks. @soberschmidt at GitHub suggested me a workaround: a mapping to PLC variables. I thought that I had to create a device (EtherCAT simulation for instance) and map its I/O to my PLC variables.But the device I/O are unreachable through ADS protocol.

    I will try what you suggested to me and combine it with an existing PLC project. Thanks again.

    Jeyfel B
    (sorry for my English, I’m from France)

  • Sina B · May 26, 2016 at 7:39 am

    This is amazing! Keep the nice work up.

  • Ivan · June 15, 2016 at 10:26 pm

    Hi Scott. Thank you very much for creating this excellent guide. It has been extremely useful in helping me learn TwinCAT 3. Thank you for putting this together and sharing your knowledge.

  • Chris · June 21, 2016 at 2:01 pm

    This is a nice write-up… many thanks!

  • Sachin Kapatkar · July 18, 2016 at 5:41 am

    Nice presentation in tutorial.
    Thanks allot.
    Keep sharing such helpful information.

    Best regards,
    Sachin Kapatkar
    (From India)

  • Krystian · November 28, 2016 at 2:13 pm

    I have just little experience with automation and this is very helpful. I just have a question if there is possible to run some kind of simulation mode, to check if my code/diagrams are logically correct. Like Simulation Mode from Siemens Logo!.


  • Armando Narvaez · November 28, 2016 at 7:40 pm

    Hi Scott,

    I have to say that your tutorial is great! I come from an AB/Ladder background but, ever since I started my Master’s, I had to switch to a CODESYS/ST environtment. It was kind of tough at the beggining but, on the programming aspect, I think I can handle it myself. It is a bit helpfull that I also have a strong background on OOP and CS concepts.

    I wanted to ask you, if you have a “rule of Thumb” or way to choose which PLC should you use or which specs (# of cores, RAM, SDD storage and whatsoever) ?

    I’m asking you this because, outside of my Master’s, I’m working on a project with around 300 IO’s, 30 PTP axes, an OPC UA Server, a MySQL database and an HMI. But I don’t know if a PLC with only 2/4 cores could handle everything.

    Thanks in advance,
    Best Regards,

    Armando Narvaez.

  • Author comment by Scott Whitlock · January 8, 2017 at 4:38 pm

    @ArmandoNarvaez – sorry for the delay. The higher end Beckhoff IPC at the moment is a Core i7 with 4 cores, and even though they force Hyperthreading off in the BIOS, it still screams when it comes to PLC and motion control logic. We always use a Core i5 now, and it just doesn’t seem to make a difference how much logic you throw at it.

    We always use an SSD and 8GB of RAM at the moment.

  • MaximilianoG · March 3, 2017 at 5:13 am

    This is by far the best written tutorial compilation for the TwinCAT Software that I have found. Thank you again Mr. Scott for the detailled explanation. It has eased my begin with the Software a lot.
    Thanks for sharing your knowledge!!

  • Bernd Esch · August 8, 2017 at 2:36 am

    Thanks for your tutorial Scott,
    it helped me very much to run a 400 Volts EXLAR Drive on
    480 Volts in San Francisco, using the settings you recommended in the
    Introduction to Motion Control
    I also can confirm that Beckhoff Motors run without Problems on 480V

    Great Job You made
    Bernd Esch
    (from Switzerland)

  • Bassam · September 4, 2017 at 9:06 am

    this turorial is very helpful for TC3 beginners and it saves a lot of time which would have been lost searching all over the internet.

    thanks for this useful peace of work.

  • Ravi · November 9, 2017 at 7:15 am


    Thanks for the document, very helpful:-) Also could you please provide the same for TwinCAT3 Visualization?

  • Author comment by Scott Whitlock · November 9, 2017 at 4:17 pm

    @Ravi – actually I haven’t used TwinCAT 3 visualization since version 2, so I’m not sure I’d be a good source for that information. We just use Visual Studio and C# internally to build our HMIs.

  • Joe C. · November 25, 2017 at 4:36 am

    Hi Scott,

    I’m a Mechanical Engineer now also a beginner to Beckhoff PLC’s in structured text in the last 12 months & found this very helpful. Thanks for sharing your knowledge. Great way to get started in TwinCAT 3. Very thorough & great referece. Especially helpful for TwinSAFE
    @Ravi / If anyone is looking for more information on TwinCAT / structured text including visualisation, a video series (11 episodes) can be found on YouTube if you search for “Learning PLCs With Structured Text”
    I also found this very helpful & I hope you don’t mind me sharing on your site.

    Joe (From Australia)

  • Dhruvan Shah · June 18, 2018 at 12:10 am

    Hi, I am an Automation Engineer working with a private firm. My company wants to do business with beckhoff and I am in-charge of this project. Honestly I knew nothing regarding beckhoff’s Twincat 3. But this tutorial has given me a lot of insight and made my work much easier. The information is presented in a language that is easily comprehensible. I want to thank you for all your effort in making this tutorial. It’s been more than 2.5 years since you posted this but yet no material is available on the internet that comes anywhere near to you.Thanks again, you did a great job.

  • Bart · September 23, 2018 at 8:25 am

    This is an amazing tutorial!!!1
    Thanks for this!

  • Klaus Schermer · October 19, 2018 at 1:30 pm

    Best Site with description of the TwinCAT3 System i’ve eher seen! Beckhoff should Link your Site, because it’s even better than the Beckhoff Documentation. Thanks a lot to the author for sharing his Knowledge!

Leave a Reply

Theme Design by