VERY WIP
TwinCAT (The Windows Control and Automation Technology)
The ESI files for Beckhoff already included when you install TwinCAT (located at C:\TwinCAT\Io\EtherCAT\
).
WIP
TwinCAT (The Windows Control and Automation Technology)
The ESI files for Beckhoff already included when you install TwinCAT (located at C:\TwinCAT\Io\EtherCAT).
See also:
Awesome tutorial series: PLC programming using TwinCAT 3 - Introduction (Part 1/18)
ML = Motion Link
Its important to get the latest LinMot Talk software when gathering the XML ESI files, newer drives are not included in older ESI files.
When connecting a new drive, make sure to do the Motor Wizard Setup
Make sure it is connected to the configure port!!!
Then scan ethernet to find the ip
169.254.12.37
TwinCAT XAE Shell (TcXaeShell):
XAR can be in 3 modes
You need a specific BIOS setting enabled in order to be able to run the TwinCAT scheduler
BIOS Example 1:
On HP Host PC:
Create an XAE project. You get a "standard" VS solution, and in here is your project.
This project consists of:
Only bold 3 will be used in the tutorial series I followed here:
Create a new PLC project (RMB). This creates a project, if you open it up you see a bunch of new objects:
activate different licenses (e.g. test license), set RT settings; This is the environment for the executable.
source (pt3)
in the PLC --> Project --> POUs find the auto-generated MAIN program.
![[POU_Example.png]]
We see the program is split up into two parts. The first part is kind of like the "C++ Header" file. The bottom part is where the main code goes.
IMPORTANT: This program is ran every cycle time (10ms by default) as if in an endless while-loop.
There is no traditional console logging in TwinCAT. Instead, we can send a message to Visual studio:
ADSLOGSTR(msgCtrlMask := ADSLOG_MSGTYPE_ERROR OR ADSLOG_MSGTYPE_LOG,
msgFmtStr := 'Hello %s',
strArg := 'world');
msgCtrlMask
ADSLOG_MSGTYPE_HINT
ADSLOG_MSGTYPE_WARN
ADSLOG_MSGTYPE_ERROR
OR
ADSLOG_MSGTYPE_MSGBOX
ADSLOG_MSGTYPE_LOG
%s
in order to format it with the arguments provided in strArg
msgFmtStr
We need to put TwinCAT into run-mode. But before we do that, we need to activate the current configuration, to make sure we are going to run the code we are currently working on.
Before you can actually run the code, you need to have a TwinCAT license activated.
With TwinCAT 3, developing software is free as Beckhoff's licensing model is entirely based on the runtime system. This means you only need to generate a license for the target PLC.