Skip to Content


Category: TwinCAT for dummies

Installing TwinCAT 3 XAE on Windows 10 x86 VM

Installing TwinCAT ain’t always issue free download->install->restart->run. Such was my case with following clean setup on Virtual Machine:

  • Windows 10 Enterprise 32bit
  • TwinCAT 3.1 Build 4020

where I received this nice error message: “the installation of microsoft visual studio 2013 integrated shell has failed

First thought, restart and try again, usually worked on another errors on different configurations, but not this time.

Visual Studio 2013 Integrated Shell

Download this small installer here and run. It’ll probably end up with “Windows Program Compatibility mode is on. Turn it off and then try Setup again.” such as in my case. To save you googleing, copy installer to another location and rename to VS_ISOSHELL, that should solve the problem.

Next time you run TwinCAT XAE installer, it should detect existing VS2013 shell, as it would with any other installed VS > 2010, and offer to integrate it.

Existing VS shell integration

When installing TwinCAT XAE on system with existing VS installation, be aware that it will most probably mess up your VS window settings.


Some time has passed since the last post… actually a long time.

Quick DajSiePoznac summary

Let’s be honest, it was an utter failure. At some point, due to participating in too many projects I faced hard choice regarding my spare time, bloggers fame and glory or sleep, I choose the letter, yet had none of the above. Pure magic. When it comes to visitors, one is sure, bots love my writing. They visit and comment everyday, day and night (if only those comments made any sense). Beside them… well… even saying friends and family is exaggeration.

What’s next?

Since I don’t have enough time to finish library I started to write for DajSiePoznac, I’ll focus on things I use, and will use in following months. Which may be interesting for some (doubt that). By coincidence I will have to learn some new stuff, and learn it fast. Google based crash course you may say, and what’s better way to understand stuff, than explaining it to another?

Real-Time, TwinCAT 3 and LIN

So far I wrote CAN/LIN communication software in C#, and lately in F#. On a horizon, I have project which requires hard RT, and thus .NET is not an option (damn you Garbage Collector!!!).

CLR GC is a poor choice for hard RT

Before you argue, if an actual hard real-time is needed for LIN communication, or it can be worked around for performance, ask yourself, would you’d like to end up with premium car with incorrectly calibrated seat-heater, just because GC kicked-in. I thought so.

I’m kind of excited when I think of it.

  • new programming language and environment (so far I only know how to do pretty basic, PASCAL-like stuff in  TwinCAT 2)
  • new hardware (never worked with Beckhoff EL6001  Serial Interface Terminal before)
  • tight timing for operations

how bad can it get?



So far I considered few alternatives, Haskell EDSLs Ivory and Atom, as funprog is jazzy, but no one I know could confirm it’s actually suited for my application, it would mean writing additional wrappers for manufacturer provided drivers, for Kvaser LIN Leaf or Vector VN1611, plus I already have to failed attempts to learn Haskell.


There seems to be something called RTSJ (Real-Time Specification for Java), which is claimed to be used in South Korean T-50 jet trainer. But it’s more like curiosity for me. I just don’t trust anything that’s named Java, JVM or based on it.


No introduction required, best candidate. But where’s the fun? The journey into unknown?


DajSiePoznac was a failure. Expect “LIN/TwinCAT for dummies by dummy”, unless again I’ll have to pick between sleep and blog.

Setting up development environment

In order to run software communicating with TwinCAT one needs actual runtime. If you can get a hold of actual PLC that’s great! In other cases you’ll need to setup it on your computer, in this post we’ll focus on setting in up on VM. VirtualBox to be precise.

Development environment

I think it’s safe to assume that today’s development machines consist mostly of x64 OS, thus our final setup will be:

  • x64 Windows host
  • x32 Windows VM
  • TwinCat 2

Note, that it’s not possible  to run TwinCAT 2 runtime on x64 host, we’ll need TwinCAT engineering for that. I assume you’re familiar with basic VirtualBox VM setup.

Downloading TwinCAT

Go to beckhoff download page and download TwinCAT 2.11 R3 and TwinCAT 2.11 x64 Engineering. After installation TwinCAT 2.11 R3 works for 30 days, but later on you can reinstall. For our purposes we’ll go with installation as Next-clicking until it’s finished. Remember TwinCAT 2.11 R3 is for VM and TwinCAT 2.11 x64 Engineering is for host.

Configuring network

For your VM select Host-only adapter.

Adding route

After installing TwinCAT and configuring network you should setup route between host and VM TwinCAT instalations. To do so:

  • click on TwinCAT tray icon
  • then “System Manager”
  • “Choose target”
  • “Search (Ethernet)…”
  • “Broadcast Search”
  • wait till search finishes, you should see 2 runtimes available, host and VM
  • Choose “IP Address” radio button for “Address info:”
  • click “Add route”
  • popup will appear, you should provide credentials for VM user with administrative privileges and confirm by clicking OK.
  • close “Add route dialog”
  • on a treeview select VM and click OK

After doing so you should be able to put VM TwinCAT in run mode, and upload program from TwinCAT PLC Control (TwinCAT tray icon –> “PLC Control”)

Adding route manually

if you’d want to add route manually, for whatever may your reason be:

  • click on TwinCAT tray icon and select properties
  • go to AMS Router tab
  • click Add
  • provide remote Machine name, Ams Net Id, and IP address  or click browse and search through your local network (note: that your probably won’t be able to read remote machine Ams Net Id via “Browse” due to 0x80070005 Access Denied exception)
  • repeat for both host and VM

Reading Ams Net Id of remote machine via Browse

In order to read remote machine AmsNetId, you’ll need to do some more configuration, at least that was my case, though you’ll probably won’t need read it anyway.

  1. make sure user accounts on VM and host have same login and password
  2. enable DCOM access rights (VM + host)
  3. enable WMI namespace access rights (VM + host)
  4. verify WMI service is running (VM + host)
  5. enable local security policy (VM + host)
DCOM access rights
  1. run dcomcnfg from Start –> Run
  2. enter “Component Services” –> “Computers”
  3. right click on “My Computer” and select “Properties”
  4. go to “Com Security” tab
  5. for both “Edit Limits” and “Edit Default” under “Access Permissions”
    1. click “Add”
    2. find user you’ll be connecting
    3. check “Local Address” and “Remote Address” boxes
    4. “Apply”
  6. click “OK”
WMI namespace access rights
  1. run wmimgmt.msc from Start –> Run
  2. right click “WMI Control” and select “Properties”
  3. go to “Security” tab
  4. click “Security” and then “Advanced”
  5. find user you’ll be connecting and lick “Edit”
  6. check “Execute Methods”, “Enable Account” and “Remote Enable”
  7. click “Apply” and then “OK”
verify WMI service is running
  1. run services.msc from Start –> Run
  2. scroll to “Windows Management Instrumentation”
  3. right click on it and verify if started and set to “Automatic”
enable local security policy
  1. run secpol.msc from Start –> Run
  2. select “Local Policies” –> “Security Options”
  3. scroll to “Network access: Sharing and security model for local accounts”
  4. right click and select “Properties”
  5. select “Classic – local users authenticate as themselves”
  6. confirm with “OK”
  7. restart

Running TwinCAT program

You can pickup sample program from #DSP project or write your own, whichever you choose, to run it:

  • Online –> Choose Run-Time System
  • Select available port from VM and click OK
  • Online –> Login (F11) to login with program
  • Online –> Run (F5) to run it