You are on page 1of 739

New Automation Technology

TwinCAT 3

TwinCAT 3 | eXtended Automation Technology 1


New Automation Technology
PC-based Control

IPC I/O Motion Automation

TwinCAT 3 | eXtended Automation Technology 2


TwinCAT 3
Contents

1. Introduction
2. eXtended Automation (XA)
3. OOP / UML
4. TcCOM
5. Documentation

TwinCAT 3 | eXtended Automation Technology 3


TwinCAT 3
PC-based Control – Milestones

1988

S1000
PLC/NC on
PC (DOS)

TwinCAT 3 | eXtended Automation Technology 4


TwinCAT 3
PC-based Control – Milestones

1988 1993

S1000 S2000
PLC/NC on PLC/NC/CNC
PC (DOS) on PC

TwinCAT 3 | eXtended Automation Technology 5


TwinCAT 3
PC-based Control – Milestones

1988 1993 1996

S1000 S2000 TwinCAT


PLC/NC on PLC/NC/CNC IEC 61131
PC (DOS) on PC PLC real-time
under
Windows NT

TwinCAT 3 | eXtended Automation Technology 6


TwinCAT 3
PC-based Control – Milestones

1988 1993 1996 2010

S1000 S2000 TwinCAT TwinCAT 3


PLC/NC on PLC/NC/CNC IEC 61131
PC (DOS) on PC PLC real-time
under
Windows NT

TwinCAT 3 | eXtended Automation Technology 7


TwinCAT 3
Motivation

Beckhoff PC-based Control:


Setting New Standards in Automation

PC-Hardware

Feldbus
Base I/O TwinSAFE PLC Control Control Connectivity
(PID)
TwinCAT-
Software

Motion NC PTP NC I CNC Robotics Measurement


Technology

TwinCAT 3 | eXtended Automation Technology 8


TwinCAT 3
Motivation

 integration of PLC, Motion and HMI into one software on one CPU:
 minimised hardware
 faster cycle times due to no hardware interfaces
 reduced interface complexity
 better diagnosis
 PC Control offers an “open” control system
 abstraction as a principle
 functions in software & independent from hardware
 scalable performance and cost by selection of standard CPUs
 powerful operating systems add IT functions to automation solutions
 automation and IT world share the same benefits:
 performance increase
 cost decrease

TwinCAT 3 | eXtended Automation Technology 9


TwinCAT 3
Contents

1. Introduction
2. eXtended Automation (XA)
3. OOP / UML
4. TcCOM
5. Documentation

TwinCAT 3 | eXtended Automation Technology 10


TwinCAT 3
eXtended Automation (XA)

 Architecture (XAA)
 Engineering (XAE)
 System Manager
 PLC
 Motion Control
 C/C++ programming
 Matlab® integration
 C#/.NET programming
 Runtime (XAR)

TwinCAT 3 | eXtended Automation Technology 11


eXtended Automation
Architecture (XAA)

eXtended Automation Technology (XAT)


 More than standard automation

eXtended Automation Engineering (XAE)


 Visual Studio® for programming in IEC 61131-3, C/C++
 Visual Studio® for configuring the complete system
(integrated TwinCAT System Manager)

eXtended Automation Runtime (XAR)


 Executes modules in real-time
 Supports multi-core CPUs
 Supports 64-bit operating systems

TwinCAT 3 | eXtended Automation Technology 12


eXtended Automation
Architecture (XAA)

PC System

Windows 32/64 bit

TwinCAT 3 Engineering Environment based on Visual Studio®

System Manager Programming


- Configuration - IEC 61131-3
- objectoriented extensions eXtended
- C/C++
Automation Engineering (XAE)

TwinCAT Transport Layer - ADS

TwinCAT 3 Runtime

Real-time Kernel
TcCOM

TcCOM

TcCOM

TcCOM

PLC
PLC Safety
PLC NC
PLC CPLC
Module
eXtended
Automation Runtime (XAR)
TcCOM

TcCOM

TcCOM

TcCOM

CNC Simulink ® C++ PLC


PLC PLC PLC PLC
Module Module

TwinCAT Automation Device Driver - ADD

Fieldbus

TwinCAT 3 | eXtended Automation Technology 13


eXtended Automation
Engineering (XAE)

TwinCAT 3 | eXtended Automation Technology 14


eXtended Automation Engineering
Features

 TwinCAT 3 – extended, modular engineering tool


 one programming environment, one project file, one debug environment
 integrated TwinCAT System Manager
 programming according to IEC 61131-3 3rd edition
(including NEW object orientation extensions)
 usage of C and C++ for real-time programming
 link to Matlab®/Simulink®
 runs all TwinCAT 2 PLC projects without change or migration of TwinCAT 2
projects (conversion)
 based on Microsoft Visual Studio® 2010

TwinCAT 3 | eXtended Automation Technology 15


eXtended Automation Engineering
Scalable functionality

TwinCAT 3 Standard TwinCAT 3 Engineering Environment

 using the Microsoft Visual Studio® shell System Manager


Configuration
Programming

– I/O
 for PLC programmers and users of – PLC
IEC 61131 Object-
– MC
existing modules – NC
oriented
extensions
– CNC
 configuring, setting up and diagnosis – Safety
– others

 debugging PLC IEC Compiler

TwinCAT Transport Layer – ADS

TwinCAT 3 Runtime

TwinCAT 3 | eXtended Automation Technology 16


eXtended Automation Engineering
Scalable functionality
Third-party
TwinCAT 3 Integrated TwinCAT 3 Engineering Environment based on Visual Studio®
Matlab®/
Simulink programming
tool

System Manager Programming


 Integration into Microsoft Visual Configuration
– I/O
Non
real-time
Real-time
– PLC
Studio® 2010 – C/C++
C#.NET IEC 61131 Object- C/C++
Simulink
Coder
C/C++

– MC oriented
– NC extensions

 for PLC and C/C++ programmers – CNC


– Safety
– others IEC Compiler Microsoft C Compiler
 configuring, setting up and diagnosis
 module generation (C/C++ or
TwinCAT Transport Layer – ADS
Matlab®/Simulink®)
TwinCAT 3 Runtime
 debugging PLC, C/C++,
Matlab®/Simulink®
Caption:

code generation

debugging

upload of TC modules

TwinCAT 3 | eXtended Automation Technology 17


eXtended Automation Engineering
Workbench integration

TwinCAT 3 framework = Microsoft Visual Studio® 2010


 usage of the most common programming environment
 maintained by a company
 extendable via plug-ins
 link to common source control software
 usage of C and C++ for programming automation devices
 usage of .NET languages for non-real-time applications
(e.g. HMI)
 improved help system

TwinCAT 3 | eXtended Automation Technology 18


eXtended Automation Engineering
Free choice of the programming language
Simultaneous programming according to IEC 61131 and C++

TwinCAT 3 | eXtended Automation Technology 19


eXtended Automation Engineering
TwinCAT I/O – Integrated System Manager

 programming, configuration and


diagnosis in one tool
 continuous engineering since 1996
 uniform task management
 parameterisation of TwinCAT modules
 creation and administration of
mappings between the process images
 simulation of I/Os and axis

TwinCAT 3 | eXtended Automation Technology 20


eXtended Automation Engineering
TwinCAT I/O – Integrated System Manager

System configuration

Motion control configuration

PLC configuration

Safety PLC configuration

C++ module configuration

I/O configuration

TwinCAT 3 | eXtended Automation Technology 21


eXtended Automation Engineering
TwinCAT I/O – Integrated System Manager

Mapping of process images


 open for all common fieldbuses
 support of all PC hardware interfaces
 easy commissioning and diagnosis
 assignment of logical and physical process
images
 Changes of the bus system do not require a
change of the PLC code.

TwinCAT process images

Virtual Inputs Outputs


process
images

Physical Inputs Outputs Inputs Outputs Inputs Outputs


process
images Fieldbus 1 Fieldbus 2 Fieldbus 3
TwinCAT 3 | eXtended Automation Technology 22
eXtended Automation Engineering
TwinCAT 3 PLC

Multiple PLC projects:


 number of possible tasks: 65,000 (instead of 4 x 4 in TwinCAT 2)
 number of PLC projects: only limited by memory (instead of 4 in TwinCAT 2)

Programming:
 languages of the IEC 61131-3 (IL, ST, FBD, LD, SFC) + CFC
 usage of the object-oriented extensions of the 3rd edition of the IEC 61131
 call and data exchange of modules written in C/C++ and Matlab®/Simulink®
 multiple import and export interfaces
 no direct addressing necessary

Commissioning/maintenance:
 source code up- and download
 online change
 full debugging functionality (breakpoints, monitoring, flow control,…)

TwinCAT 3 | eXtended Automation Technology 23


eXtended Automation Engineering
TwinCAT 3 PLC

Shared tree structure for hard- and software


Programming language-dependent toolbox

Shared output window of all languages


TwinCAT 3 | eXtended Automation Technology 24
eXtended Automation Engineering
TwinCAT 3 PLC

Object-orientation by the IEC 61131-3 3rd edition

Benefits of the object-oriented extensions


 increased readability of the code by encapsulation algorithms into methods
 increased maintainability
 modularisation, structuring of the code
 increased reusability
 abstract programming by using interfaces
 increased extensibility and adaptability
 construction of inheritance hierarchies
 increased extensibility and adaptability

Consistent usage of the object-oriented extensions enables:


 increased software quality
 decreased time for programming and maintenance

TwinCAT 3 | eXtended Automation Technology 25


eXtended Automation Engineering
Object-orientation by the IEC 61131-3 3rd edition
Language features 2nd edition 3rd edition C++ Java C#
IEC 61131-3 IEC 61131-3
Multi-language support + + - - -
Mixed programming OO/proc. - + + - -
Classes ~ (FB) + + + +
Methods ~ (actions) + + + +
Interfaces - + - + +
Partial abstract classes - - + + +
Polymorphism - + +/- + +
Reference semantics - + (interfaces) - + +
Constructor/destructor - + + + +
Properties - + - - +
Visibility ~ (variables) ~ (variables) + + +
Dyn. memory (“new”) - - (in TwinCAT 3) + + +
TwinCAT 3 | eXtended Automation Technology 26
eXtended Automation Engineering
What does it look like in TwinCAT 3?

 declaration of a function block

 call of a method

Usage of the object-oriented extensions:


 is possible in all IEC languages
 is independent from the used hardware
 is not mandatory!

TwinCAT 3 | eXtended Automation Technology 27


eXtended Automation Engineering
TwinCAT 3 Motion Control – Continuity

 scalable solutions (stepper,…, servo drive)


 several abstraction layers
 PLC/SCADA/HMI access always identical objects,
independent of axis type and fieldbus
 conversion from mechanical to electronical system
(electronic cam, electronic gear, electronic clutch, electronic
camshaft, “flying saw”)

Benefits:
 more flexibility in used technique (stepper, servo drive,…)
 more flexibility in changes to the products
 shorter time of delivery and development time
 shorter time for commissioning because of the lack of
mechanical parts
 decreasing costs

TwinCAT 3 | eXtended Automation Technology 28


eXtended Automation Engineering
TwinCAT 3 Motion Control – Abstraction Layer
Soft SPS
Layer
Soft Motion

+
PLC
Pos Ctrl Limit
Layer

- +
+
SP Velo Preset Scale & Limit

Pos Meas.
Fieldbus
Layer
Drives
Layer

TwinCAT 3 | eXtended Automation Technology 29


eXtended Automation Engineering
TwinCAT 3 Motion Control – From PTP to Robot Control

Functionality

NC PTP NC I CNC Robotics

Point-to-Point- Interpolated motion Complete CNC Interpolated motion


movement with 3 axes and functionality for robotic control
5 additional axes
– gearing – interpolated – support for a wide
– camming – programming movement for rande of kinematic
– superposition according to DIN 66025 up to 32 axes systems
– flying saw – technological features per channel – optional torque
– straightforward – various pre-control
utilisation through transformations
function blocks from
the PLC

TwinCAT 3 | eXtended Automation Technology 30


eXtended Automation Engineering
C/C++ Programming Languages

 reuse of existing C/C++ code


 cooperation of C/C++ and PLC code
 real-time applications for all platforms (CE, XP,…)
 opens new areas – not standard PLC users
 well-known programming language
 standardised (C: ISO/IEC 9899 TC3, C++: IEC 14882)
 generation of Automation Device Drivers (ADD) enables to
implement own drivers (e.g. fieldbus drivers)
 Beckhoff SDK provides the functionality (like PLC libraries) for
 ADS
 Motion
 File I/O

TwinCAT 3 | eXtended Automation Technology 31


eXtended Automation Engineering
C/C++ Programming Languages

Application areas
 image processing
 robotics
 measurement technology
 …

TwinCAT 3 | eXtended Automation Technology 32


eXtended Automation Engineering
C/C++ Programming Languages

Method CycleUpdate: – is called cyclically Pointer to logical input/output image

TwinCAT 3 | eXtended Automation Technology 33


eXtended Automation Engineering
C/C++ Programming Languages

VS2010 standard debugger:


 monitoring/modification of variables only with Breakpoint

TwinCAT 3 | eXtended Automation Technology 34


eXtended Automation Engineering
C/C++ Programming Languages

VS2010 Beckhoff debugger:


 connection to C++ target (selection of target system)

by “Attach to process” or “Start new instance”

TwinCAT 3 | eXtended Automation Technology 35


eXtended Automation Engineering
C/C++ Programming Languages

VS2010 Beckhoff debugger:


 monitoring/modification of
variables without Breakpoint
(analog to PLC without
Breakpoint)

TwinCAT 3 | eXtended Automation Technology 36


eXtended Automation Engineering
Matlab®/Simulink® integration

Matlab®/Simulink® integration
 well-known in the scientific and measurement environment
 great variety of toolboxes (e.g. Fuzzy)
 creation, simulation and optimisation of control circuits
 debug interface between Simulink® and TwinCAT

Code generation
 design in Simulink®
 automatic generation of C code by the Simulink CoderTM
 compilation with Visual Studio® C Compiler
 parameterisation in the TwinCAT System Manager
 download and execution in the TwinCAT 3 Runtime

TwinCAT 3 | eXtended Automation Technology 37


eXtended Automation Engineering
Matlab®/Simulink® integration

TwinCAT 3 | eXtended Automation Technology 38


eXtended Automation Engineering
.NET Programming Languages (e.g. C#)

 well-known programming languages


 standardised C# (ISO/IEC 23270)
 creates intermediate code (Common Intermediate Language – CIL)

benefits:
 efficient engineering with higher abstraction level
 widely accepted
 “Garbage collection” takes care on memory.
 could now be handled as part of one integrated solution

restrictions:
 Garbage collector is not suitable for real-time applications.

TwinCAT 3 | eXtended Automation Technology 39


eXtended Automation Engineering
C#/.NET programming

HMI/
Windows processes

PLC module

C++ module

Real-time Code

TwinCAT 3 | eXtended Automation Technology 40


eXtended Automation
Runtime (XAR)

TwinCAT 3 | eXtended Automation Technology 41


eXtended Automation
Runtime (XAR)

TwinCAT 3 | eXtended Automation Technology 42


eXtended Automation Runtime
Modular runtime

 dynamic environment for the execution TwinCAT Transport Layer - ADS


TC Configuration Debugging
and administration of TwinCAT 3 TwinCAT Object Manager
modules

TcCOM
TcCOM
Task PLC Call C++
 administration of runtime modules (with Module

TcCOM
Task
PLC
NC
TwinCAT Object Manager)

TcCOM

TcCOM
Task PLC
C++ Call PLC
C
 defined interfaces (e.g. TwinCAT Module Module

TcCOM
Component Object Model –TcCOM) PLC
Simulink ®

TwinCAT Real-time Kernel


Task
Module
and v model

TcCOM
TcCOM
Task PLC
CNC PLC
Simulink ®

Call Module

TcCOM
PLC
PLC
Task

TcCOM
Task PLC
Safety

TwinCAT 3 Runtime

TwinCAT Automation Device Driver - ADD

Fieldbus

TwinCAT 3 | eXtended Automation Technology 43


eXtended Automation Runtime
Modular runtime interface

 separation of encapsulated functionality into modules


 extension of the base system by own drivers (Automation Device
Drivers – ADD) e.g. fieldbus drivers
 scalability: modules can contain simple functions, complex
algorithms and real-time tasks or complete projects
 reusability of modules
 cooperation of modules written in
 IEC 61131-3
 C/C++
 Matlab®-generated modules

TwinCAT 3 | eXtended Automation Technology 44


eXtended Automation Runtime
Modular runtime interface for modules

 standardised TwinCAT Module

Module Description
 easy to use
State Machine
 included state machine
ITComObject Interface

Interfaces Parameter Interfaces


Pointers

Contexts
Data Areas Data Area

Categories Pointers

ADS Port

TwinCAT 3 | eXtended Automation Technology 45


eXtended Automation Runtime
TwinCAT Module State Machine

INIT

Parameter
IP PI

PREOP

Parameter
PS SP

SAFEOP

SO OS

OP

TwinCAT 3 | eXtended Automation Technology 46


eXtended Automation Runtime
Multicore support

TwinCAT 3 | eXtended Automation Technology 47


eXtended Automation Runtime
Support of multi-core systems

 distribution of projects to cores (e.g.


Multi-core CPU

Core 0 Core 1 Core 2 Core 3 Core ...


PLC, NC, Motion Control and HMI run Windows PLC Control User HMI PLC Runtime 0 PLC Runtime 1 NC Runtime 1

on different cores) Apps


Task 0 Task 1

 scalable base time for each core Windows


Drivers
ADS ADS ADS ADS ADS

 scalable CPU usage for each core


ADS Router Engine

L2 Shared Cache

ADS Router Message Queues

System Memory

TwinCAT 3 | eXtended Automation Technology 48


eXtended Automation Runtime
Support of multi-core systems

Enables cores for real-time usage Defines the CPU-usage limit


Defines the base time for a core

Assignment of a task to a CPU

TwinCAT 3 | eXtended Automation Technology 49


eXtended Automation Runtime
Benchmark of TwinCAT 3 Multicore

Testcase hardware: Execution time for 1000 PLC commands (µs)


 Intel®Core i7 950
Core0 Core1 Core2 Core3
 4 physical core CPU at 3.07 GHz bool 0.887 0.894 0.898 0.895
 Nvidia 9800 graphic adapter byte 0.672 0.682 0.681 0.688
word 0.613 0.614 0.626 0.617
dword 0.575 0.583 0.583 0.583
Testcase software:
sint 3.463 3.472 3.473 3.474
 4 PLC runtime systems int 3.473 3.484 3.482 3.482
 each PLC runtime mapped to one CPU core dint 3.487 3.497 3.491 3.496
real 1.813 1.822 1.818 1.820
 all PLC runtimes execute identical
lreal 4.761 4.769 4.770 4.769
benchmark software

Result:
 TwinCAT Multicore technology increases PLC power, linear
related to the number of CPU cores
 PC Control enables future CPU development for automation
applications
TwinCAT 3 | eXtended Automation Technology 50
TwinCAT 3
Contents

1. Introduction
2. eXtended Automation (XA)
3. OOP / UML
4. TcCOM
5. Documentation

TwinCAT 3 | eXtended Automation Technology 51


TwinCAT 3
UML – Unified Modeling Language

TwinCAT 3 | eXtended Automation Technology 52


eXtended Automation Engineering
Object-orientation by the IEC 61131-3 3rd edition
Language features 2nd edition 3rd edition C++ Java C#
IEC 61131-3 IEC 61131-3
Multi-language support + + - - -
Mixed programming OO/proc. - + + - -
Classes ~ (FB) + + + +
Methods ~ (actions) + + + +
Interfaces - + - + +
Partial abstract classes - - + + +
Polymorphism - + +/- + +
Reference semantics - + (interfaces) - + +
Constructor/destructor - + + + +
Properties - + - - +
Visibility ~ (variables) ~ (variables) + + +
Dyn. memory (“new”) - - (in TwinCAT 3) + + +
TwinCAT 3 | eXtended Automation Technology 53
TwinCAT 3
Contents

1. Introduction
2. eXtended Automation (XA)
3. OOP / UML
4. TcCOM
5. Documentation

TwinCAT 3 | eXtended Automation Technology 54


TwinCAT 3
TcCOM – TwinCAT Component Object Model

TwinCAT 3 | eXtended Automation Technology 55


eXtended Automation Runtime
Modular runtime interface for modules

 standardised TwinCAT Module

Module Description
 easy to use
State Machine
 included state machine
ITComObject Interface

Interfaces Parameter Interfaces


Pointers

Contexts
Data Areas Data Area

Categories Pointers

ADS Port

TwinCAT 3 | eXtended Automation Technology 56


eXtended Automation Runtime
TwinCAT Module State Machine

INIT

Parameter
IP PI

PREOP

Parameter
PS SP

SAFEOP

SO OS

OP

TwinCAT 3 | eXtended Automation Technology 57


eXtended Automation Runtime
C++

TwinCAT 3 | eXtended Automation Technology 58


eXtended Automation Engineering
Matlab®/Simulink® integration

TwinCAT 3 | eXtended Automation Technology 59


TwinCAT 3
Contents

1. Introduction
2. eXtended Automation (XA)
3. OOP / UML
4. TcCOM
5. Documentation

TwinCAT 3 | eXtended Automation Technology 60


TwinCAT 3
Documentation

 Online –
 http://twincat3.infosys.beckhoff.com/

 MS Help

TwinCAT 3 | eXtended Automation Technology 61


TwinCAT 3
Documentation

 MS Help

TwinCAT 3 | eXtended Automation Technology 62


TwinCAT 3
Documentation

 MS Help

TwinCAT 3 | eXtended Automation Technology 63


TwinCAT 3
Documentation

 MS Help

TwinCAT 3 | eXtended Automation Technology 64


TwinCAT 3
Documentation

 MS Help – Online Incremental Updates

TwinCAT 3 | eXtended Automation Technology 65


Beckhoff | New Automation Technology
TwinCAT 3

For further information see


Product DVD

or:
www.beckhoff.com/TwinCAT3

TwinCAT 3 | eXtended Automation Technology 66


New Automation Technology
Beckhoff Training
Beckhoff
TwinCAT Installation

 Downloading from the web


 XAE vs XAR
Beckhoff
Downloading TwinCAT 3

 www.Beckhoff.com
 Select ‘Download’
Beckhoff
Downloading TwinCAT 3

 In the Software section, select ‘TwinCAT 3’


Beckhoff
Downloading TwinCAT 3

 Select ‘TE1xxx | Engineering’


Beckhoff
Downloading TwinCAT 3

 Select ‘TwinCAT 3.1 eXtended Automation Engineering’


Beckhoff
Downloading TwinCAT 3

 Click ‘Start Download’


Beckhoff
Downloading TwinCAT 3

 Click ‘Create new account’


Beckhoff
Downloading TwinCAT 3

 Fill in the registration form


 Click ‘Register’
Beckhoff
Downloading TwinCAT 3
Beckhoff
Downloading TwinCAT 3
Beckhoff
Downloading TwinCAT 3

 Enter your ‘Login’ information


 Click ‘Login’
Beckhoff
Downloading TwinCAT 3

 Click the name of the file you wish to Download


 Save the File
Beckhoff
Downloading TwinCAT 3

 The name of the Install file will include the Version and Build number
Beckhoff
Installing TwinCAT 3

 Right-Click on the file and select ‘Run as Administrator’


Beckhoff
Installing TwinCAT 3

 Click ‘Yes’
Beckhoff
Installing TwinCAT 3

 The installation process will now start


Beckhoff
Installing TwinCAT 3

 Click ‘Next’
Beckhoff
Installing TwinCAT 3

 Accept the License Agreement


 Click ‘Next’
Beckhoff
Installing TwinCAT 3

 Enter a Name and Organization


 This information will appear later in the software
Beckhoff
Installing TwinCAT 3

 Select ‘Custom’
 Click ‘Next’
Beckhoff
Installing TwinCAT 3

 XAR – eXtended Automation Run-Time


 Used for CXs and other Run-Time only devices
 XAE – eXtended Automation Engineering
 Used for Development
Beckhoff
Installing TwinCAT 3

 Select the items you wish to install


 Click ‘Next’
 By Default everything is selected to be installed to the local hard drive
Beckhoff
Installing TwinCAT 3

 By default TwinCAT will install the Shell for Visual Studio 2010
 Select your environment and click ‘Next’
Beckhoff
Installing TwinCAT 3

 Configuration of the install is complete


 Click ‘Next’ to install TwinCAT 3
Beckhoff
Installing TwinCAT 3

 Installation in progress
Beckhoff
Installing TwinCAT 3

 Click ‘Finish’
Beckhoff
Installing TwinCAT 3

 You must restart your computer after the install


Beckhoff
Installing TwinCAT 3

 The TwinCAT 3 icon is now displayed in the Windows Task Bar


How to – Install TwinCAT3 documentation

1. About the TwinCAT3 documentation

The following article describes how to install the TwinCAT3 documentation. Cause TwinCAT3 is
using the Visual Studio 2010 shell as a workbench, its helpfile is based on the new Microsoft Help
System (MHS) replacing the existing HTML/CHM helpfiles. MHS is an end-to-end help system for
content which is either served from an online source or installed locally. This system enables users
to view help-content via their favorite web browser or with a software called “Microsoft Help
Viewer”.

Installation of TwinCAT3 documentation is a two-step procedure:

a. Once only: Install the basic TwinCAT3 package (see Chapter 3)


b. On demand: Let TwinCAT3 check if updates could be downloaded automatically (see chapter 4)

2. System requirements

Before installation of TwinCAT3 Documentation check the following system requirements:

 Install TwinCAT3 XAE (Engineering) or Visual Studio 2010


 Important:
In both cases, you need to install SP1 for Visual Studio 2010 - otherwise the help file will not be
shown properly.
http://www.microsoft.com/download/en/details.aspx?id=23691

 An Internet connection is required if the documentation’s content should be updated


automatically. (see Chapter 0)

3. Installation

Please note that the installation has separate setup files for x64 and x86 systems.

URL:
http://download.beckhoff.com/download/Software/TwinCAT/TwinCAT3/InfoSystem/

X86: TC3-InfoSys-x86-en.exe
X64: TC3-InfoSys-x64-en.exe

Beckhoff Automation GmbH, Eiserstraße 5, 33415 Verl Tel: 05246 / 963-0, Fax 05246/ 963-198
Execute the corresponding Setup file with Administrator rights by performing the following steps:

 Right-click the Setup-file and select “Run as Administrator”.


 After the setup has been initialized, follow the installation instructions.
 Answer the question regarding the Help Library Manager with „Yes“

When the setup is finished, you can open the TwinCAT3 documentation directly from within
TwinCAT XAE.

 Start TwinCAT XAE or Visual Studio 2010


 Inside a TwinCAT3 project just click “F1” for help

As alternative open the menu „Help“ and select „View Help“, which will open the Microsoft Help
Viewer.

 Navigate to “Beckhoff Information System” to view the documentation

Beckhoff Automation GmbH, Eiserstraße 5, 33415 Verl Tel: 05246 / 963-0, Fax 05246/ 963-198
4. Updating documentation

You can update the documentation’s content directly from within TwinCAT XAE. Please perform the
following steps to update the documentation:

 Start TwinCAT XAE or Visual Studio 2010


 Open the menu „Help“ and select „Manage Help Settings”

 Click on “Check for updates online”

 The system will automatically check for updates and will notify you if an update is available.
Please make sure that your IT infrastructure (Firewall, Proxy-Server, etc.) allows the system to
connect to http://twincat3.infosys.beckhoff.com.
 If an update is available, click on the corresponding button to update the documentation’s
content and confirm with “Yes” to trust our files.

Beckhoff Automation GmbH, Eiserstraße 5, 33415 Verl Tel: 05246 / 963-0, Fax 05246/ 963-198
TwinCAT News
Agenda

TwinCAT 3

 Deliverables

 Naming

 Pricing

 Ordering

 Licensing

 Availability

1/7/2013 1
TwinCAT3: Product information (sales)
Deliverables Products: Overview

Deliverables

1/7/2013 2
TwinCAT3: Product information (sales)
Deliverables Products: Overview

TwinCAT3 product categories

 „TE“ TwinCAT3 XAE : Engineering

 „TC“ TwinCAT3 XAR : Runtime level

 „TF“ TwinCAT3 Function (previous „Supplement“)

1/7/2013 3
TwinCAT3: Product information (sales)
Deliverables Products: Engineering

Categories TwinCAT 3 deliverables

 Setup “TwinCAT3-Full”

 Full installation for fresh engineering PC


 Provides Microsoft Visual Studio Shell
But also integrates into existing VS201x shell
 Integrated System Manager / IEC 61131-3
 Integrated Safety PLC editor
 Integrated C/C++ and Matlab modules
Note: full VS201x required for programming / debugging

 Setup “TwinCAT3-XAE”

 Provides Rune-time only components


 No engineering environment
Engineering will be done remotely

1/7/2013 4
TwinCAT3: Product information (sales)
Deliverables Products: Engineering Setup

TwinCAT 3 XAE installation

Visual Studio 2010 available No Visual Studio available

 TwinCAT 3 “Integrated” into VS2010  TwinCAT 3 “Standard”


 Integration into the Microsoft Visual Studio contains royalty free VS2010-Shell
TwinCAT as new template like C# / C++  Provides Microsoft Visual Studio Shell
 Integrated System Manager / IEC 61131-3  Integrated System Manager / IEC 61131-3
 Integrated Safety PLC  Integrated Safety PLC
 C and C++ programming / debugging  Integrated C/C++ and Matlab modules
 Link to Matlab Simulink (no programming / debugging)
 C# /.NET programming for (none real time)
applications in the same environment

07.01.2013 5
TwinCAT3: Product information (sales)
Deliverables Products: Trial versions

Trial versions:

TwinCAT3:

 7-Day trial can always be re-activated by customer


 some products have limited functionalities during trial
 CAM Design (no storage)
 IEC61850: only two nodes for connectivity

07.01.2013 6
TwinCAT3: Product information (sales)
TwinCAT3: Naming

Naming

1/7/2013 7
TwinCAT3: Product information (sales)
TwinCAT3: Naming Engineering

TwinCAT 3 XAE (Engineering)  Product: TE 1000-0000

 Content:
 Plug-In Systemmanager
 Plug-In PLC-Editor
 Royalty-free VS2010 shell
just container – nothing to implement C/C++/C#

 Price:
 Royalty-free, full-featured base package
 7 day time-limited runtime
repeatable by customer without Beckhoff activity

 Note:
 Engineering tools are not free in general
Fees i.e. required for:
 CAM Design Tool, ECAD Import /
SimulationManager / Scope++ / Valve Diagram

 CAM Design Tool can not save results in royalty


free version (functional limitations)
1/7/2013 8
TwinCAT3: Product information (sales)
TwinCAT3: Naming Run-time

TwinCAT 3 XAR (Run-time levels) : „Best of both worlds“

TwinCAT2: Keep well-known level from TwinCAT2 like levels IO / PLC / NC-PTP / NCI / CNC

TwinCAT3: add bundled runtime PLC/C++ or PLC/C++/Matlab


 modular single items for new extensions
 C++ can be combined with all functions
 previous royalty-free TwinCAT2 level „CP“ is renamed to „ADS“ – also royalty-free

1/7/2013 9
TwinCAT3: Product information (sales)
TwinCAT3: Naming Functions

Functions  TwinCAT3 „Functions“


Functional extension of
TF 4100 Controller Toolbox  TC3-XAE (engineering)
 TC3-XAR (run-time)
TF 4xxx

TF 4110 Temperature Controller


...  Categories (derived from analog terminals)

 „EL/KL1xxx“System
 „EL/KL3xxx“Measurement
TF 5000 NCPTP  „EL/KL4xxx“Control
 „EL/KL5xxx“Motion
TF 5xxx

TF 5050 NC Camming  „EL/KL6xxx“Connectivity


TF 5060 NC-Fifo axis
 Sample:
 TF-1140-0xxx Management Server
...

 TF-3600-0xxx Condition Monitoring


 TF-4100-0xxx Controller Toolbox
TF 6000 ADS  TF-5000-0xxx NC-PTP10
 TF-5010-0xxx NC-PTP25
TF 6xxx

TF 6100 OPC UA  TF-5020-0xxx NC-PTP25+


 TF-5100-0xxx NC I (incl. PTP)
TF 6310 TCPIP
 TF-5200-0xxx CNC
 TF-6100-0xxx OPC UA
...

1/7/2013 10
TwinCAT3: Product information (sales)
TwinCAT3: Naming

General scheme of naming

TX abbb-cdpp-vvvv

T TwinCAT
X Base System
C=TwinCAT3 Run-time
F= Function
E=Engineering

a Class (e.g. System / Measurement / Control / Motion / Connectivity)


bbb Unique product key
-
cd Reserved
pp Platform (mix of OS and CPU)
-
vvvv Build number
will allow customers to order specific „historical“ product version
TwinCAT and Function products
1/7/2013 11
TwinCAT3: Product information (sales)
TwinCAT3: Pricing

Pricing

1/7/2013 12
TwinCAT3: Product information (sales)
TwinCAT3: Pricing - Platforms

TwinCAT3 module pricing depends on the performance of the IPC platform


Categories of platforms: (mix of O/S and CPU)

1/7/2013 13
TwinCAT3: Product information (sales)
TwinCAT3: Price according to product and platform

Pricelist is a simple matrix „Productname / Platform“

 Price depends on platform

Sample CX1020 is platform 50


CX50x0 is platform 40

1/7/2013 14
TwinCAT3: Product information (sales)
TwinCAT3: Licensing

Licensing

1/7/2013 15
TwinCAT3: Product information (sales)
TwinCAT3: Licensing – Handling: where to find

TwinCAT3:

 License handling inside System Manager area

07.01.2013 16
TwinCAT3: Product information (sales)
TwinCAT3: Licensing - Trial

TwinCAT3: Trial license

 Customer can ALWAYS generate a „7 Days Trial License“ to continue job


 Also engineering PC does not need run time license – trial is fine

Enter valid
security
code will
enable „OK“

07.01.2013 17
TwinCAT3: Product information (sales)
TwinCAT3: Licensing

... Trial is done – customer is convinced....

How to get commercial license ?

07.01.2013 18
TwinCAT3: Product information (sales)
TwinCAT3: Licensing

TwinCAT3: SystemID / Registration unique for each IPC

1. Customer orders Beckhoff hardware with preinstalled TwinCAT


 TwinCAT already licensed inside HW
 nothing to take care of here – identical to TwinCAT2

or

1. Customer orders software product „TC1250 TC3 PLC/NC-PTP10“

07.01.2013 19
TwinCAT3: Product information (sales)
TwinCAT3: Licensing

TwinCAT3: SystemID / Registration unique for each IPC

1. Customer orders product „TC1250 TC3 PLC/NC-PTP10“ at HQ US


2. HQ US orders at HQ Verl
3. HQ Verl provides order confirmation e.g. VE0815 AND LICENSE ID
4. HQ US provides US order confirmation
AND certificat with „TwinCAT3 License ID“ to customer

Commercial part is done – also actions of HQ-US is done


Ordered products are available in HQ Verl database to be requested
Technical part ready to be startet

5. Customer installs TwinCAT3 on e.g. third party IPC machine


6. Customer sends License Req File of IPC and „License ID“ to email account
7. Beckhoff email account provides License Response File

Communication:
 By email only (no longer by phone / by fax)

07.01.2013 20
TwinCAT3: Product information (sales)
TwinCAT3: Licensing – certificate with „TC3 License ID“

TwinCAT3: „Beckhoff License ID“


will be provided to customer as result of commercial order
act as placeholder in HQ Verl database

07.01.2013 21
TwinCAT3: Product information (sales)
TwinCAT3: Licensing

TwinCAT3:

 SystemID unique for each IPC


 TwinCAT generates SystemID on it‘s own (Beckhoff PC and third party)
 TwinCAT generates HW Platform number

07.01.2013 22
TwinCAT3: Product information (sales)
TwinCAT3: Licensing

TwinCAT3:

 Select additionally components to be registered

07.01.2013 23
TwinCAT3: Product information (sales)
TwinCAT3: Licensing

TwinCAT3:

 Overview of licenses in this project

07.01.2013 24
TwinCAT3: Product information (sales)
TwinCAT3: Licensing

TwinCAT3:

 Overview on licenses and their expiration

07.01.2013 25
TwinCAT3: Product information (sales)
TwinCAT3: Licensing

TwinCAT3:

 Generate License Request file Mandatory (red)


Beckhoff
License ID
to find order in
database pool

Optional (green)
Customer
information
Will be included
into License
Response File

07.01.2013 26
TwinCAT3: Product information (sales)
TwinCAT3: Licensing

TwinCAT3:

 Generate License Request file

1. Step:

Generate
License Req File
1

07.01.2013 27
TwinCAT3: Product information (sales)
TwinCAT3: Licensing

TwinCAT3:

 Step 2: Save „License Request file“


Can be copied to USB stick and send later to license server

07.01.2013 28
TwinCAT3: Product information (sales)
TwinCAT3: Licensing

TwinCAT3:

 Step 2a Optional : Send License Request file to Beckhoff

07.01.2013 29
TwinCAT3: Product information (sales)
TwinCAT3: Licensing

TwinCAT3:

 Step 2a (Optional) : Send License Request file to tclicense@beckhoff.com


 Email contains license request file with all required
information – additionally the products are listed in email
body

07.01.2013 30
TwinCAT3: Product information (sales)
TwinCAT3: Licensing

TwinCAT3:

 Step 3: Activate License Response file

Activate
License Response
File...

07.01.2013 31
TwinCAT3: Product information (sales)
TwinCAT3: Licensing

TwinCAT3:

 Step 3: Activate License Response file

Activate
License Response
File...

...results in valid
licenses

07.01.2013 32
TwinCAT3: Product information (sales)
TwinCAT3: Licensing

TwinCAT3:

 Multiple license files can be activated (not only one file):

 Machine builder order „TC1200-00xx TC3 PLC“


 send license request file to license server
 activate license response file

Machine is delivered to End user

 End user of machine add connectivity


e.g. „TC6100 TC3 OPC-UA“ for MES/ERP connectivity
 send license request file for „TC6100 TC3 OPC-UA“
 activate license response file

07.01.2013 33
TwinCAT3: Product information (sales)
TwinCAT3: Licensing

Licensing for target deivices can be done easly remotely

Connection to
remote device will
automatic add license
Remote licenses Local licenses
dialog for remote device

07.01.2013 34
TwinCAT3: Product information (sales)
TwinCAT3: Licensing

TwinCAT3:

Licensing of remote devices

07.01.2013 35
TwinCAT3: Product information (sales)
TwinCAT3: Ordering

Current thinking:

TwinCAT3 licensing on CX-series

 No special order number with included TwinCAT3 level

 Instead order basic CX-devices with addon TwinCAT3 order numbers


Production line will install and pre-license the TwinCAT3 products

Order number for „clean image“ (basic CX-device without any TwinCAT)

 Like CX1020-0x20 : ....


 Like CX1030-0x20 : ....
 Like CX5010-xx20 : ....
 Like CX5020-xx20 : ....

 Add TwinCAT3 order numbers

07.01.2013 36
TwinCAT 3

Beckhoff TwinCAT 3
Starting a new project

 Select the TwinCAT Icon in the Windows System Tray

Beckhoff TwinCAT 3
Starting a new project

 Then select ‘TwinCAT XAE’

Beckhoff TwinCAT 3
Starting a new project

 If using TwinCAT 3 Standard this will


open the Visual Studio Shell.
 If using TwinCAT 3 Extended, this will
open Visual Studio.

Beckhoff TwinCAT 3
Starting a new project

 From the ‘File’ menu, select ‘New’, and then ‘Project’

Beckhoff TwinCAT 3
Starting a new project

 In the ‘New Project’


window, the left column
contains templates that can
be used for starting your
project. If using TwinCAT
Standard, the only Installed
Project will be ‘TwinCAT
Project’. TwinCAT XAE
Project is selected in the
middle by default.

Beckhoff TwinCAT 3
Starting a new project

 The name and location of the project can be changed at


the bottom.
 Press ‘OK’ to create the new project.

Beckhoff TwinCAT 3
Starting a new project

 The ‘Solution Explorer’ contains the tree view of your


Project. This is similar to the tree in the System Manager of
TwinCAT 2.

Beckhoff TwinCAT 3
TwinCAT 3

Beckhoff TwinCAT 3
Multiple CPU Cores

TWINCAT 3

Beckhoff TwinCAT 3
Multiple CPU Cores

 In the ‘Solution Explorer, under ‘System’, select ‘Real-Time’

Beckhoff TwinCAT 3
Multiple CPU Cores

 Use the ‘Read from Target’ button to read the number of


CPU cores on the target Computer

 The number of cores should match the Windows Task


Manager
Note: TwinCAT only counts real cores
Beckhoff TwinCAT 3
Multiple CPU Cores

 Check the ‘RT-CPU’ box to enable TwinCAT to use a specific


core.

Beckhoff TwinCAT 3
Multiple CPU Cores

 It is also possible to set the base time for task that will run
on this core.
 The CPU Limit when sharing the core with Windows is 80%

Beckhoff TwinCAT 3
Multiple CPU Cores

 In the ‘RT-CPU’ column use the drop down list to assign a


specific task to a specific core.
 These can be PLC, Motion, or C++ tasks.

Beckhoff TwinCAT 3
CPU Core Isolation

MULTIPLE CPU CORES

Beckhoff TwinCAT 3
Multiple CPU Cores

 Core Isolation allows for a CPU core to be hidden from


windows. This will allow TwinCAT to use 100% of the
isolated core.
 Click the ‘Set on Target’ button, adjust the Available CPUs
and click ‘Set’. A reboot is required.

Beckhoff TwinCAT 3
TwinCAT 3

Beckhoff TwinCAT 3
Visual Studio Shell

TWINCAT 3

Beckhoff TwinCAT 3
Visual Studio Shell

 Customizing the Integrated Development Environment


(IDE)
 The Visual Studio Shell provides a customizable interface
that allows the user to configure the environment to what
suites their needs best and can be modified as the needs
change

Beckhoff TwinCAT 3
Visual Studio Shell

 To reset the windows back to default, go to the ‘Window’


menu and select ‘Reset Window Layout’

Beckhoff TwinCAT 3
Visual Studio Shell

 Here, the environment has been adjusted for maximum use


of the screen for viewing code

Beckhoff TwinCAT 3
Visual Studio Shell

 Here, the environment has been adjusted for viewing two


programs at the same time

Beckhoff TwinCAT 3
Visual Studio Shell

 Here, the FBD toolbar is displayed on the left, which allows


for ‘Drag and Drop’ of the elements into the code window

Beckhoff TwinCAT 3
Visual Studio Shell

 Here, the FBD toolbar is floating and could be placed on a


second monitor

Beckhoff TwinCAT 3
Visual Studio Shell

 Here, on a large widescreen monitor several panes are


displayed at the same time

Beckhoff TwinCAT 3
Visual Studio Shell

 Click on the title of a pane and then drag the mouse


 Depending on which pane you grab you can place the pane anywhere
you like
 Here, the ‘Solution
Explorer’ was
grabbed by the top,
which will carry all
panes in this group
together

 It is also possible to grab the ‘Solution Explorer’ from the bottom and
separate it from the group
Beckhoff TwinCAT 3
Visual Studio Shell

 The panes on the left, right, and bottom are ‘Dockable’ and
can be ‘Pinned’ in place
 Here the ‘Toolbox’ is Docked and Hidden (middle)
 When the mouse crosses over the Title that pane is shown
(right)
 To ‘Pin’ the pane click on the ‘Push Pin’ symbol (left)

Beckhoff TwinCAT 3
Visual Studio Shell

Beckhoff TwinCAT 3
Visual Studio Shell – Tool Bars

 Tool Bars provide shortcuts to many common commands


 Visual Studio provides several Tool Bars that can be used
within TwinCAT
 In addition to these Beckhoff has created a few more that
provide shortcuts to specific commands within TwinCAT

Beckhoff TwinCAT 3
Visual Studio Shell – Tool Bars

 The Visual Studio Shell used by TwinCAT 3 contains some of


the Tool Bars from Visual Studio but not all of them.

Beckhoff TwinCAT 3
Visual Studio Shell – Tool Bars

 Right-Clicking in the Gray area of the existing toolbars will


display the ‘Toolbar Selection Menu’
 Toolbars with a check next to them are currently displayed
 Selecting a toolbar will toggle its display state

Beckhoff TwinCAT 3
Visual Studio Shell – Tool Bars

 The four dots (circled below) are a handle that can be used
to move the toolbar by clicking and dragging

Beckhoff TwinCAT 3
Visual Studio Shell – Tool Bars

 The down arrow can be used to customize a specific


toolbar

Beckhoff TwinCAT 3
Visual Studio Shell – Tool Bars

 Build
 Build Selection
(Shift+F6): Compiles the
current Project
 Build Solution (F6):
Compiles all Projects
within the Solution
Cancel (Ctrl+Break): Cancels
the current compile

Beckhoff TwinCAT 3
Visual Studio Shell – Tool Bars
 Debug
 Start (F5)
 Break All (Ctrl+Alt+Break)
 Stop Debugging (Shift+F5)
 Restart (Ctrl+Shift+F5)
 Show Next Statement
(Alt+Num*)
 Step Into (F11)
 Step Over (F10)
 Step Out (Shift+F11)
 Hexadecimal Display
 Show Threads in Source
 Breakpoints (Ctrl+Alt+B)
Beckhoff TwinCAT 3
Visual Studio Shell – Tool Bars

 TwinCAT PLC
 Active PLC Project – PLC Runtimes can be selected here
 Login
 Force Values
 Start  Unforce Values
 Stop  Write Values
 Logout  Reset Cold
 Step Into  Reset Origin
 Step Over
 Step Out
 Flow Control
 Single Cycle

Beckhoff TwinCAT 3
Visual Studio Shell – Tool Bars
 TwinCAT XAE Base
 Activate Configuration
 Restart TwinCAT System
 Restart TwinCAT (Config Mode)
 Reload Devices
 Scan
 Toggle Free Run State
 Show Online Data
 Show Sub Items
 Choose Target System - Remote Targets can be selected form here

Beckhoff TwinCAT 3
Visual Studio Shell – Tool Bars

 Customize
 From here existing Tool
bars can be modified or
New Tool Bars can be
created
 This allows for the
programmer to tailor the
programming
environment to their
exact needs

Beckhoff TwinCAT 3
Visual Studio Shell – Custom Short Cut Keys

 Visual Studio allows for the user to create their own custom
Short Cut Keys
 Most of the common TwinCAT 2 short cut keys already exist
in TwinCAT 3 however Ctrl+F7 to ‘Write Values’ does not

Beckhoff TwinCAT 3
Visual Studio Shell – Custom Short Cut Keys

 From the ‘Tools’ menu,


select ‘Options’

Beckhoff TwinCAT 3
Visual Studio Shell – Custom Short Cut Keys

 Expand the ‘Environment’ tree item and select ‘Keyboard’

Beckhoff TwinCAT 3
Visual Studio Shell – Custom Short Cut Keys

 In the ‘Show commands containing:’ box type in ‘write’


 The box below it will show the filtered results, Left-Click on
the command to select it

Beckhoff TwinCAT 3
Visual Studio Shell – Custom Short Cut Keys

 Left-Click in the ‘Press shortcut keys:’ box


 Now Hold the ‘Ctrl’ key and press ‘F7’

Beckhoff TwinCAT 3
Visual Studio Shell – Custom Short Cut Keys
 If using TwinCAT Extended with Visual Studio Professional, the
‘Shortcut currently used by:’ window will notify the user that this
keyboard shortcut is already mapped to the ‘Build.Compile’
command
 If using TwinCAT Standard without Visual Studio then this keyboard
shortcut is not currently being used
 Ultimately it is up to the user to decide which shortcuts will perform
what commands
 When the Assign button is clicked the shortcut keys will be mapped
to the command
 If the short cut keys were already used by another command the
previous command will be removed
Beckhoff TwinCAT 3
Visual Studio Shell – Custom Short Cut Keys

Beckhoff TwinCAT 3
Visual Studio Shell – Custom Short Cut Keys

 Use the Reset button to set all keyboard shortcuts back to default.

Beckhoff TwinCAT 3
TwinCAT 3

Beckhoff TwinCAT 3
Scanning Hardware

TWINCAT 3

Beckhoff TwinCAT 3
Adding Hardware

 From the ‘TwinCAT’ menu, select ‘Restart TwinCAT (Config


Mode)’

Beckhoff TwinCAT 3
Adding Hardware

 Confirm the command by clicking ‘OK’

Beckhoff TwinCAT 3
Adding Hardware

 In the ‘Solution Explorer’,


under ‘I/O’

 Right-click on ‘Devices’

 Select ‘Scan’

Beckhoff TwinCAT 3
Adding Hardware

 Confirm with ‘OK’

Beckhoff TwinCAT 3
Adding Hardware

 Found devices are listed, and can be added to the I/O


Configuration
 Select the ‘EtherCAT’ Master and then press ‘OK’

Beckhoff TwinCAT 3
Adding Hardware

 Press ‘Yes’ to ‘Scan for Boxes’


 Boxes will included I/O, Drives and other devices attached
to the Field bus controller

Beckhoff TwinCAT 3
Adding Hardware

 If a Beckhoff Servo controller is found, you will be asked if


you would like to scan for the motors attached to these
devices.

Note: Resolvers do not carry nameplate data, and therefore


can not be scanned in.
Beckhoff TwinCAT 3
Adding Hardware

 If an EtherCAT drive is found, you will be asked if you would


like to add the NC-Configuration, append the axes and link
them.

Beckhoff TwinCAT 3
Adding Hardware

 Press ‘Yes’ to ‘Activate Free Run’, this will allow for the
testing/updating of hardware without using a PLC program.

Note: Free Run is only allowed while in Config Mode

Beckhoff TwinCAT 3
Adding Hardware

 The hardware that was


found is now listed under
‘Devices’

Beckhoff TwinCAT 3
New Automation Technology
Beckhoff Training
Beckhoff
Testing IO

 Start a new project


 Place TwinCAT in Config Mode
 Scan Hardware
 Activate Free Run
 Verify Communication
 Test I/O
Beckhoff
Testing IO

 Click on the TwinCAT Icon and select TwinCAT XAE


Beckhoff
Testing IO

 From the File menu, select New -> Project


Beckhoff
Testing IO

 Select TwinCAT XAE Project


 Provide a Name, and Click ‘OK’
Beckhoff
Testing IO

 From the TwinCAT Menu, Select ‘Restart TwinCAT (Config Mode)’


Beckhoff
Testing IO

 Confirm the prompt by click ‘OK’


Beckhoff
Testing IO

 Click the triangle to expand ‘I/O’


 Right-Click on ‘Devices’ and select ‘Scan’
Beckhoff
Testing IO

 3rd party devices may not be found, click OK to acknowledge the HINT

 Note: Configuration files from 3rd party vendors should be place in the appropriate
fieldbus folder under C:\ TwinCAT \ IO \
Beckhoff
Testing IO

 Click Yes to scan for boxes. TwinCAT will now attempt to search for IO devices and
drives on all fieldbus networks.
Beckhoff
Testing IO

 TwinCAT will find all devices inside the PC that can be used as a fieldbus
controller. Select all fieldbus controllers you wish to use and click OK

 Note: If you are expecting an EtherCAT device that is not listed, but instead have a
RT-Ethernet device, then check the cabling from the PC to the first EtherCAT
device on the network
Beckhoff
Testing IO

 Click ‘No’ – we will not be using the motors in this lab.


Beckhoff
Testing IO

 Click ‘No’ – we will not be using the servos in this lab.


Beckhoff
Testing IO

 Click Yes to Activate Free Run


 This will update the I/O values and display them in the I/O section of the Project
Beckhoff
Testing IO

 The I/O section now displays the fieldbus controllers


and the I/O devices on the network
Beckhoff
Testing IO

 Double click on the EtherCAT controller then, the select the Online tab
 Verify all devices are in OP

Note: The EL7201 Servo


Terminals will not be in OP
unless TwinCAT is in Run
Mode
Beckhoff
Testing IO

 Expand the EK1200


 Select the EL1008
 Use the Online column to
verify the Inputs are
working correctly
Beckhoff
Testing IO

 Expand the EL1008, then expand a specific channel


 Select Input then the Online tab
 The graph will display the value of the input
Beckhoff
Testing IO

 Select the EL2008


 The output column displays the value of the outputs
Beckhoff
Testing IO

 Right click on an output and select Online Write ‘1’


Beckhoff
Testing IO

 The output now displays the status as a 1 and the output is energized
Beckhoff
Testing IO

 Expand the EL2008, then expand a specific channel


 Select Output then the Online tab
 The graph will display the value of the output, use the Write button to change the
value
Beckhoff
Testing IO

 In the ‘Set Value Dialog’ window you can use the ‘1’ button next to ‘Bool:’ or type a
‘1’ in the ‘Dec:’ box and click ‘OK’
Beckhoff
Testing IO

 Select the EL3002 to check the analog input


 The value is displayed in as an Integer
 0-10 Vdc is scaled to 0-32767 INT
Beckhoff
Testing IO

 Expand the EL3002 then expand AI Standard Channel 1 and select Value
 Select the Online tab and the value can be monitored
Beckhoff
Testing IO

 Select the EL4032


 The value is displayed in as an Integer
 0-10 Vdc is scaled to 0-32767 INT
Beckhoff
Testing IO

 Right click on the Analog Output and select ‘Online Write…’


Beckhoff
Testing IO

 Enter a value for the analog output


 The Dec value will range from 0 to 32767
 Hex from 0x0 to 0x7FFF
 The +/- 10 range uses the scaled value
 After entering a value click OK
Beckhoff
Testing IO

 The value is displayed in the Online Column


Beckhoff
Testing IO

 Expand the EL4032


 Expand AO Outputs Channel 1, select the Analog Output, then the Online tab
 The graph will display the value of the output, use the Write button to change the
value
TwinCAT 3

Beckhoff TwinCAT 3
Activating the Configuration

TWINCAT 3

Beckhoff TwinCAT 3
Activating the Configuration

 In TwinCAT the ‘Configuration’ refers to everything in the


Solution Explorer under the Project heading.
 The ‘Configuration’ includes not only the PLC, but also the
I/O, and the Motion Controller

Beckhoff TwinCAT 3
Activating the Configuration

 In order to Run the PLC, you must first ‘Activate the


Configuration’
 From the ‘TwinCAT’ Menu, select ‘Activate Configuration’

Beckhoff TwinCAT 3
Activating the Configuration

 If any Licenses are missing, click ‘Yes’ to generate a trial


license

Beckhoff TwinCAT 3
Activating the Configuration

 Enter the ‘Security Code’, and press ‘OK’

Beckhoff TwinCAT 3
Activating the Configuration

 The bottom of the License window now displays an


expiration date for the trial license

Beckhoff TwinCAT 3
Activating the Configuration

 Click ‘OK’ to confirm  Click ‘OK’ to Start TwinCAT


in Run Mode

Beckhoff TwinCAT 3
Activating the Configuration

 During this process you will see any Messages, Warnings, or


Errors, logged at the bottom of the screen

Beckhoff TwinCAT 3
Activating the Configuration

 The TwinCAT Icon should now be green, indicating that the


TwinCAT system is running.

Beckhoff TwinCAT 3
TwinCAT 3

Beckhoff TwinCAT 3
Adding the PLC Control

TWINCAT 3

Beckhoff TwinCAT 3
Adding the PLC Control

 In the ‘Solution Explorer’, right-click on ‘PLC’ and select


‘Add New Item’

Beckhoff TwinCAT 3
Adding the PLC Control

 The ‘Add New Item’ window will allow you to select a


‘Template’
 ‘Standard PLC Template’ is selected by Default
 Press ‘Add’ to continue

Note: The Empty PLC Project


is for creating user libraries

Beckhoff TwinCAT 3
Adding the PLC Control

 In the ‘Solution
Explorer’ you can see
that the PLC Project
has been added with
the minimum
amount of objects
required for the PLC
to operate.

Beckhoff TwinCAT 3
Adding the PLC Control

 The PLC can contain


multiple Run-Times
‘Machine1’
 Each Run-Time can
contain multiple
tasks

Beckhoff TwinCAT 3
Adding the PLC Control

 The folder system is


only a way to
organize the other
components of the
project.
 The folders do not
effect the operation
in any way.

Beckhoff TwinCAT 3
Adding the PLC Control

 The ‘References’
folder holds the
libraries to be used
by the Run-Time.
 The libraries seen
here are included by
default.

Beckhoff TwinCAT 3
Adding the PLC Control

 The DUTs folder is


intended to be used
to hold Data Unit
Types (also known as
User Defined
Variables).
 It is possible to create
subfolders for
separating Enums,
Structures, etc.
Beckhoff TwinCAT 3
Adding the PLC Control

 The GVLs folder is for


Global Variable Lists.
 Subfolders could be
created for IO, HMI,
Servos, physical
sections of the
machine…

Beckhoff TwinCAT 3
Adding the PLC Control

 The POUs folder


contains the actual
code.
 Sub folders for
Functions and
Function Blocks could
be created here, or
they could be placed
at the same level as
the POUs folder.
Beckhoff TwinCAT 3
Adding the PLC Control

 The VISUs folder is


for Visualizations.

Beckhoff TwinCAT 3
Adding the PLC Control

 The PlcTask is a short


cut to the PlcTask
under the ‘SYSTEM’
‘Tasks’.
 Here the Cycle Ticks
can be changed.

Beckhoff TwinCAT 3
Adding the PLC Control

 The PlcTask calls the


MAIN POU.
 Although it is
possible to call
multiple POUs
directly from a Task,
it is recommend to
call only one. Then
call the other POUs
from MAIN.
Beckhoff TwinCAT 3
Adding the PLC Control

 Machine1 Instance
will hold the variable
of the PLC that are
given %I and %Q
addresses.
 The variables will be
linked to and from
here to other
locations in the
Solution Explorer.
Beckhoff TwinCAT 3
TwinCAT 3

Beckhoff TwinCAT 3
Adding Code

TWINCAT 3

Beckhoff TwinCAT 3
Adding Code

 In the ‘Solution
Explorer’ under the
‘PLC’ double-click on
‘Main’ to open it.

Beckhoff TwinCAT 3
Adding Code

 In the ‘Declaration’ section of ‘MAIN’ place 3 variables


between ‘VAR’ and ‘END_VAR’

Beckhoff TwinCAT 3
Adding Code

 In the ‘Code’ window of ‘MAIN’ place the following line of


code on line 1
 a := b + c

Note: The error in the code is intentional.


Beckhoff TwinCAT 3
Adding Code

 From the ‘Build’ menu, select ‘Build Solution’

Note: Build only checks changes. Rebuild checks the entire


PLC project for errors.
Beckhoff TwinCAT 3
Adding Code

 The ‘Error List’ at the bottom should show ‘1 Error’


 The ‘Yellow’ background of ‘Error’, ‘Warnings’, and
‘Messages’ indicates which items are currently being
displayed.
 Click on ‘Messages’ to deselect it

Beckhoff TwinCAT 3
Adding Code

 Now only the ‘Errors’ are displayed. Double-click on the


‘Error’ and the cursor will be placed on that line of code.

Note: This error location appears to be misleading. The issue


is that the compiler reached the end of the POU without
finding the ; at the end of line 1, the end of the POU is Line 3.
Beckhoff TwinCAT 3
Adding Code

 Place a semicolon at the end of the line of code

Beckhoff TwinCAT 3
Adding Code

 Again, from the ‘Build’ menu, select ‘Build Solution’

Beckhoff TwinCAT 3
Adding Code

 Because there were no Errors, the bottom panel stayed on


the ‘Output’ window
 The ‘Output’ window contains logging information about
the ‘Build’ that was performed

Beckhoff TwinCAT 3
New Automation Technology
Beckhoff Training
Beckhoff
Variables

 Variable Types
 Declarations
 Variable Scope
 Initial Values
 Constants
Beckhoff

What is a Variable?
Beckhoff
Variables

 A Variable is a name given to a location in memory that stores a value


 A Variable has up to 5 properties
1. Name
2. Size (Defined by the Type)
3. Value
4. Memory Location
5. PLC Address
Beckhoff
Variables

 In accordance with IEC 61131-3 a variable name must adhere to the following rules
1. The variable must begin with a Letter or an Underscore
2. The variable can be followed by Letters, Underscores, or Numbers
 No distinction is made between Uppercase and Lowercase Letters

The following are not permitted


 Special characters can not be used (!@#$%^&*)
 Blanks or Spaces are not allowed
 Repeated or Sequential Underscores are not allowed Converyor__1
Beckhoff
Keywords

 Keywords are identifiers specified by IEC61131-3. They are thus fixed components
of the syntax and therefore may not be used for other purposes.

Examples
Standard operators AND, OR, NOT…
Standard types BOOL, INT, REAL...
Custom Types TYPE, STRUCT
Block types FUNCTION, FUNCTION_BLOCK, PROGRAM
Beckhoff
Comments

 The comments are delimited by character strings with (* or *) at the beginning and
at the end. Comments may be placed wherever spaces are also permitted.
Exception: within string literals.

(*Digital Input*)
bStart AT %IX0.0 :BOOL;(*Machine Start*)
(*Analog Input*)
TempK1 AT %IW10 (*Byte 10-11*) :WORD;
bStart AT %IX0.0 :BOOL; // Machine Start
(* bStop at %IX0.0 : BOOL; (*Machine Stop*) *)
Beckhoff
Comments

 If comments are placed on the line above or after the variable, then the comment
will appear in the tooltip when hoovering the mouse over the variable name.
Beckhoff
Variable Size

What type of data will the variable hold and


how big is the data?
Beckhoff
Elementary data types

Type Lower Upper Size (Bits) Prefix


BOOL FALSE TRUE 1 x
b
BYTE 8 by Bitstring
WORD 16 w Bitstring
DWORD 32 dw Bitstring
Beckhoff
Elementary data types

Type Lower Upper Size Prefix


(Bits)
SINT -127 127 8 si
USINT 0 255 8 usi
INT -32 768 32 767 16 i
UINT 0 65 535 16 ui
DINT -134 217 728 134 217 727 32 di
UDINT 0 4 294 967 295 32 udi
LINT -263 263 -1 64 li
ULINT 0 264 -1 64 uli
Beckhoff
Elementary data types

Type Lower Upper Size Prefix


(Bits)
TIME_OF_DAY TOD#0:0:0 TOD#23:59:59 32 tod

DATE D#1970-01-01 D#2106-2-7 32 date


D#YYYY-MM-DD
DT#1970-01-01-00:00:00 DT#2106-2-7-6:28:15
DATE_AND_TIME 32 dt

TIME T#0s T#49d17h2m47s 32 tim


295ms
Beckhoff
Elementary data types

Type Lower Upper Size Prefix


REAL -1.18*10-38 3.4*1038 32 Bits r
4 Byte
LREAL -2.22*10-308 1.798*10308 64 Bits lr
8 Byte
Beckhoff
String data type
Type Description Example Size Prefix
STRING String in ASCII ‘1234ABCDE‘ 80 +1 s
code. Standard
length 80 ‘ABCDE$R$L‘
characters.
‘ABCDE$0D$0A‘
Maximum length
255. Strings are
null-terminated

String length specifications


Example Assignment Result SIZEOF Result LEN
declaration
sVar : STRING; sVar:=‘ABC‘; 81 3
sVar1 :STRING(1); sVar := ‘X‘; 2 1
sVar: STRING(255); sVar:=‘ABC‘; 256 3
Beckhoff
String data type

Constants
$<2 Hex values> ASCII Code
$0D CR
$R $r CR
$L $l Line Feed
$N $n New Line
$T $t Tab
Beckhoff
String data type

Type Description Example Description Pre


fix
WSTRING String in Unicode “Обучение“ Level 0,Block ws
format 0x0400-0x4FFF
Cyrillic
“培训、讲座、研讨
会“
“Training, seminar” Level 0
Block 0x0000-
0x007F
Basic Latin
Beckhoff
Examples of Literals

Variable Type Examples


BOOL TRUE 2#1 16#1 1
FALSE 2#0 16#0 0
WORD, 2#1010111111111110 16#AFFE 45054
DWORD
INT 2#1000000000000001 16#8001 -32768
TIME t#1h t#60m t#3600000ms
d day
h hours t#0.5d t#12h t#43200000ms
m min
s sec t#30m18s90ms t#0.505025h t#1818090ms
ms ms

REAL 0.3333 3.333e-1


Beckhoff
Declaring a Variable

 All variables must be defined between VAR and END_VAR


 A variable possesses a name behind which a value (number, string, date, etc.) is
stored. Variables are characterised by the fact that their contents can be changed
at runtime.

Identifier Data type Initial value


The physical-logical storage
location of this variable is
bAlarm:BOOL:=TRUE; unknown to the user
(unlocated)
Beckhoff
Declaring a Variable

 It is possible when declaring a variable to link the name with an address that must
be explicitly specified.
 For the allocation of inputs and outputs of the hardware the incomplete location is
to be carried out with I* and Q*
Beckhoff
Declaring a Variable

 Hard coded addresses

These variables possess a clear address


(located)
In TwinCAT 3 incompletely located variables can be used for inputs and outputs
Applications for %M variables can be solved simply with Unions and direct
masking
Beckhoff
Address division

Examples:
IX10.7 IX10.6 IX10.5 IX10.4 IX10.3 IX10.2 IX10.1 IX10.0 Din0 AT%IX10.0 : BOOL;
IB10

IB1 IB0 Ain AT%IB0 : INT;


IW0 equivalent
Ain AT%IW0 : INT;

IX22.7 IX22.6 IX22.5 IX22.4 IX22.3 IX22.2 IX22.1 IX22.0


BitVar AT%IX22.1 : BOOL;

IB23 IB22 IB21 IB20 Posi AT%IB20 : UDINT;


IW22 IW20 equivalent
ID20
Posi AT%ID20 : UDINT;
Beckhoff
Variable Scope

Local variables are restricted Global variables are known


to the block or POU in which in each block or POU within
they were declared. a project.

Keywords
Keywords
VAR_GLOBAL ..
VAR ..
END_VAR
END_VAR
VAR_CONFIG ..
VAR_INPUT ..
END_VAR
END_VAR
VAR_IN_OUT ..
END_VAR
VAR_OUTPUT ..
END_VAR
Beckhoff
Variable Scope

 Global Variables can be read and written to from anywhere in the PLC program
 Local Variables can only be written to from within the POU where they are defined
 The local variable of any POU can be read by first accessing the POU instance that
the variable is defined in and then using the ‘.’ to access the local variables defined
within that POU
 Local variables cannot be written to from another POU
Beckhoff
Initial Values

 All Variables have the option of assigning an initial value


 This value will be written to memory when the PLC starts, after which the code of
the PLC will control the value
Beckhoff
Constants

 Variables defined as Constants cannot be written to by the PLC


 Constants are declared similar to initial values
 Use of the keyword ‘Constant’ at the beginning of the declaration section signals
the compiler that the variable is a constant.
TwinCAT 3

Beckhoff TwinCAT 3
Data Type Conversions

TWINCAT 3

Beckhoff TwinCAT 3
Data Type Conversion

 In the PLC it is possible to convert from any data type to


another data type

Beckhoff TwinCAT 3
Data Type Conversion

 The conversion functions are built in and are called in the


following format

 myOtherVar := datatype_to_datatype(myVar);

Beckhoff TwinCAT 3
Data Type Conversion

Beckhoff TwinCAT 3
Data Type Conversion

Beckhoff TwinCAT 3
Data Type Conversion

Beckhoff TwinCAT 3
Data Type Conversion

Beckhoff TwinCAT 3
Data Type Conversion

Beckhoff TwinCAT 3
Data Type Conversion

Beckhoff TwinCAT 3
Data Type Conversion

Beckhoff TwinCAT 3
Data Type Conversion

Beckhoff TwinCAT 3
TwinCAT 3

Beckhoff TwinCAT 3
Addressing Variables

TWINCAT 3

Beckhoff TwinCAT 3
Addressed Variables

 Addressed Variables in TwinCAT are freely configurable


 It is allowed, that addressed variables can be connected to
any hardware point, axis, or other location in the Solution.
 Variables that are assigned an address within the PLC are
‘Linked’ to items outside of the PLC, such as hardware,
axes, or other PLC taks.
 These addressed variables can defined in either a POU or in
a Global Variable List (GVL)

Beckhoff TwinCAT 3
POU Addressed Variables

 Once an addressed variable


has been declared in the
PLC, it will be added to the
‘Instance’

Beckhoff TwinCAT 3
GVL Addressed Variables

 To add ‘Global’ variables, ‘Right-Click on the GVLs folder


 Select ‘Add’, then click on ‘Global Variable List’

Beckhoff TwinCAT 3
GVL Addressed Variables

 Provide a unique and


descriptive name
 Click ‘Open’

Beckhoff TwinCAT 3
GVL Addressed Variables

 Provide a unique and


descriptive name
 Click ‘Open’

Beckhoff TwinCAT 3
GVL Addressed Variables

 Create the variables with their addresses

Beckhoff TwinCAT 3
Addressed Variables ‚Instance‘

 To create the ‘Instance’


 In the ‘Solution Explorer’,
Right-Click on the
‘Untitled1 Project’ and
select ‘Build’
 If there are any Errors a
new ‘Instance’ will not be
created, or the existing
‘Instance’ will not be
changed
Beckhoff TwinCAT 3
Linking Variables

ADDRESSED VARIABLES
‚INSTANCE‘

Beckhoff TwinCAT 3
Linking Variables

 A link is created between two similar variables in two


different tasks, so that their may share data.

Beckhoff TwinCAT 3
Linking Variables

 Double click on
GVL_IO.xStart
 On the ‘Variable’ tab click
‘Linked to…’ to open the
Attach Variable window

Note: If the Variable window was already open, the Attach


Variable window will open instead.
Beckhoff TwinCAT 3
Linking Variables

 The ‘Attach Variable’ window displays all possible locations


that the variable could be linked to.

Beckhoff TwinCAT 3
Linking Variables

 The filter settings on the right side will narrow the results

Beckhoff TwinCAT 3
Linking Variables

 Select the first Input under the EL1008 and click ‘OK’

Beckhoff TwinCAT 3
Linking Variables

 The icons of both variables now show the ‘Link’ symbol

Beckhoff TwinCAT 3
Linking Variables

 The ‘Variable’ Tab now shows the linking information in


the ‘Linked to…’ box

Beckhoff TwinCAT 3
Linking Variables

 The variable links are not implemented until an ‘Activate


Configuration’ command is executed.
 From the ‘TwinCAT’ menu select ‘Activate Configuration’

Beckhoff TwinCAT 3
Linking Variables

 Click ‘OK’ to proceed

 Click ‘OK’ to Restart TwinCAT in ‘Run Mode’

Beckhoff TwinCAT 3
Linking Variables

 Now that the hardware variable is linked to the PLC


variable, the PLC must be running for the hardware to
update
 Login and Run the PLC

Beckhoff TwinCAT 3
Linking Variables

 Select the PLC or the hardware variable and go to the


‘Online’ tab
 You can now watch the
value change

Beckhoff TwinCAT 3
New Automation Technology
Beckhoff Training
Beckhoff
Lamp Test
Beckhoff
Lamp Test – Power Rail

 The Power Rail is powered by an external source.


 The I/O cards receive power from the cards to their left
and then pass power to the cards on their right.

 Note: Not all cards use and/or pass the power rail.
Beckhoff
Lamp Test – Digital Input

 The push button will be wired from Connection Point 2 on the EL1002 through the
push button, and then back to Connection Point 1 on the EL1002.
 When the contacts are closed power is sent from the positive connection to the
input.
Beckhoff
Lamp Test – Digital Output

 The LED will be wired from Connection Point 3 on the EL2002 through the LED,
and then back to Connection Point 1 on the EL2002.
 When the output is turned on, the LED will illuminate.
Beckhoff
Lamp Test – Coupler Power

 The EtherCAT Coupler must be powered for communication to occur.

 Note: This power should be supplied separately from the power


rail.
Beckhoff
Lamp Test – EtherCAT Communication

 The EtherCAT Coupler is connected to a network port on the Controller by an


EtherCAT Cable
Beckhoff
Lamp Test - Overview

 The Controller will communicate


with the I/O through the coupler.
When the Input is true this will
be sent to the controller to be
processed by the PLC.
The PLC will then send a
command to the output to turn
on the LED.

 Note: The Coupler power and


power rail power are supplied separately.
Beckhoff
Lamp Test – EtherCAT Communication to Hardware

 Under I/O the EtherCAT Coupler can be


found
 I/O – Devices – Device 1 EtherCAT – Term
1 EK1200
 The I/O Terminals can be found under the
Coupler
Beckhoff
Lamp Test – PLC Communication to EtherCAT

 The Hardware is Linked


to the PLC Instance.
Beckhoff
Lamp Test – PLC Code

 In the PLC the variables are declared with addresses so that they may be linked to
the hardware
 When the code is run, xLight1 will have the same value as xSwitch1
Beckhoff
Lamp Test – FLOW

 Power passes from the supply through the power rail and to the Push Button, when
the button is pressed power is supplied to the input
Beckhoff
Lamp Test – FLOW

 When the EtherCAT update happens the status of the input will be given to the
EtherCAT packet
Beckhoff
Lamp Test – FLOW

 The EtherCAT card in the PC will pass the data directly to the PCs memory where it
can be read by TwinCAT
Beckhoff
Lamp Test – FLOW

 TwinCAT will then pass the data from the I/O


Configuration to the PLC Instance
Beckhoff
Lamp Test – FLOW

 The PLC will then process the code


Beckhoff
Lamp Test – FLOW

 TwinCAT will then pass the data from the PLC Instance
back to the I/O Configuration
Beckhoff
Lamp Test – FLOW

 The EtherCAT card in the PC will read the data directly from the PCs memory and
send out the EtherCAT packet over the network.
Beckhoff
Lamp Test – FLOW

 When the data reaches the Output card the output will be energized and the LED
will illuminate.
Beckhoff
Lamp Test – FLOW

 PB
 Input Card
 I/O Update
 I/O Configuration
 PLC Instance
 PLC Code
 PLC Instance
 I/O Configuration
 I/O Update
 Output Card
 LED
Beckhoff
Lamp Test – FLOW

 PB  Electricity and Data flow “downstream”

 Input Card  From the Push Button to the LED


 I/O Update  Along the path there are several places
 I/O Configuration where the signal can be tested and/or
monitored
 PLC Instance
 PLC Code  At the wiring connection of the card, in
 PLC Instance the I/O or PLC Instance and in the PLC
Code itself.
 I/O Configuration
 I/O Update
 Output Card
 LED
Beckhoff
Lamp Test – FLOW

 PB  When testing hardware it is possible to


“Write” and to “Force” data into the
 Input Card system
 I/O Update
 A “Write” is applied one time and then
 I/O Configuration control is given back to the system
 PLC Instance
 A “Force” in the PLC Instance or I/O is
 PLC Code
applied before each update of the I/O
 PLC Configuration or PLC task
 I/O Instance
 When Writing or Forcing the Flow of
 I/O Update data must be taken into consideration
 Output Card cont.
 LED
Beckhoff
Lamp Test – FLOW

 PB  If the Force is applied to an Input in the


I/O Configuration then everything
 Input Card downstream will react accordingly, just
 I/O Update as if the Push Button had been pressed
 I/O Configuration  However, if the Output in the PLC
 PLC Instance Configuration is Forced then only the
 PLC Code hardware will be effected. The PLC
 PLC Instance Code will have no idea that the output
has been energized.
 I/O Configuration
 I/O Update
 Output Card
 LED
Beckhoff
Lamp Test – Forces in the PLC

 When a variable is Forced inside the PLC, the Force is applied and then the PLC
Code is allowed to run as it normally would. The Force is then applied again at the
end of the PLC Scan.
 Here y has been Forced to a value of 1
 x is assigned a value of y + 1 or 2
Beckhoff
Lamp Test – Forces in the PLC

 Here y has also been forced to a value of 1


 However, the first line of code assigns a value of 2 to y
 This will result in x being assigned the value of 3
New Automation Technology
Beckhoff Training
Beckhoff
Analog Test

 The hardware shows the data type needed for the PLC variable to be linked to it.
Beckhoff
Analog Test

 Add the PLC variables for the Analog Input and Output
Beckhoff
Analog Test

 Write the code to assign the output to the input.


Beckhoff
Analog Test

 Right-Click on the Project and select ‘Rebuild’


Beckhoff
Analog Test

 If there are no errors, the variables will be place into the Instance
Beckhoff
Analog Test

 Link the Analog Input


 Right-Click on the variable in the Instance and select ‘Change Link’
Beckhoff
Analog Test

 Scroll down to the EL3002 and select the first ‘Value’


 Click ‘OK’

Note: If you hover the mouse of the variable, the tooltip will display the full path
including the channel number.
Beckhoff
Analog Test

 Link the Analog Output


 Right-Click on the variable in the Instance and select ‘Change Link’
Beckhoff
Analog Test

 Scroll down to the EL4032 and select ‘Analog Output’


 Click ‘OK’

Note: If you hover the mouse of the variable, the tooltip will display the full path
including the channel number.
Beckhoff
Analog Test

 After the variables have been Linked, from the TwinCAT select ‘Activate
Configuration’
Beckhoff
Analog Test

 Confirm the overwrite of the current configuration


Beckhoff
Analog Test

 Click ‘OK’ to restart TwinCAT in Run Mode


Beckhoff
Analog Test

 From the PLC menu, select ‘Login’


Beckhoff
Analog Test

 From the PLC menu, select ‘Start’


Beckhoff
Analog Test

 The values of the analog variables can now be seen


TwinCAT 3

Beckhoff TwinCAT 3
PLC Languages IEC61131-3 3rd Edition

TWINCAT 3

Beckhoff TwinCAT 3
PLC Languages

 ST – Structured Text
 FBD – Function Block Diagram
 LD – Ladder Diagram
 SFC – Sequential Function Chart
 IL – Instruction List

 CFC – Continuous Function Chart


 Not part of the IEC standard

Beckhoff TwinCAT 3
PLC Languages – Structured Text

 Structured Text is a high level language which has a similar


syntax to PASCAL
 ST is best for complex mathematical equations and
iterations (loops)

Beckhoff TwinCAT 3
PLC Languages – Function Block Diagram

 Function Block Diagram is based on viewing a system in


terms of the flow of signals between processing elements.
 FBD is very similar to an electronic circuit diagram.
 Typical use of FBD is to describe controls loops and logic.

Beckhoff TwinCAT 3
PLC Languages – Ladder Diagram

 Ladder Diagram is based on a technique used to design


logic using relays. A Ladder diagram always has a power rail
on the left side which supplies power to the contacts on
the rung.

Beckhoff TwinCAT 3
PLC Languages

 Sequential Function Chart is used in describing the


behavior of a system in terms of states and transitions.
 SFC allows the sequential aspects of a control program to
be described.

Beckhoff TwinCAT 3
PLC Languages – Instruction List

 Instruction List is a low level language which is similar in


structure to an assembly language

Beckhoff TwinCAT 3
PLC Languages Continuos Function Chart

 Continuous Function Chart is not a part of the IEC standard


but is included in TwinCAT
 CFC is similar to FBD, the difference is that FBD is separated
into rungs and CFC is all on one piece of paper. The order of
operation is designated by the block number.

Beckhoff TwinCAT 3
TwinCAT 3

Beckhoff TwinCAT 3
Languages Samples

TWINCAT 3

Beckhoff TwinCAT 3
Languages Samples

 A program that will monitor an Analog Value and energize


an output if the value is within a specific range.
 The output will be energized if the value is within range. A
range is defined as having an upper value and a lower
value.
 Therefore we have 2 conditions that determine if the
output is energized. The first condition is that the value is
greater than the low end of the range, and the second
condition is that the value is less than the upper end of the
range.

Beckhoff TwinCAT 3
Languages Samples

 If both conditions are TRUE then the output will be


energized.
 Condition1 is that the value of the analog input is greater
than the lower end of the Range. We will assume the lower
end of the range is defined as 0.
 Therefore Condition1 will be TRUE if the value is greater
than 0.

Beckhoff TwinCAT 3
Languages Samples

 Condition2 is that the value of the analog input is less than


the upper end of the Range. We will assume the upper end
of the range is defined as 10,000.
 Therefore Condition2 will be TRUE if the value is less than
10,000.

Beckhoff TwinCAT 3
Languages Samples

 Here is the Ladder Diagram (LD) code to solve the problem.

Beckhoff TwinCAT 3
Languages Samples

 Here is the Function Block Diagram (FBD) code to solve the


problem.

Beckhoff TwinCAT 3
Languages Samples

 Here is the Continuous Function Chart (CFC) code to solve


the problem.

Beckhoff TwinCAT 3
Languages Samples

 Here is the Instruction List (IL) code to solve the problem.

Beckhoff TwinCAT 3
Languages Samples

 Here is the Structured Text (ST) code to solve the problem.

Beckhoff TwinCAT 3
Languages Samples

 Here is another Structured Text (ST) code to solve the


problem.

Beckhoff TwinCAT 3
TwinCAT 3

Beckhoff TwinCAT 3
CASE Instruction

TWINCAT 3

Beckhoff TwinCAT 3
CASE Instruction

 A CASE instruction is used when making a decision based


on an integer value
 Typically a CASE instruction is used to control the state of
the machine, or of a sequential process

Beckhoff TwinCAT 3
CASE Instruction

 In the below example ‘iStep’ is the variable that will be


evaluated to determine which section of code to run

Beckhoff TwinCAT 3
CASE Instruction

 It is important to understand that only one step is executed


during a PLC cycle
 In Step 0 if xStep is TRUE the iStep will be incremented by a
value of 1.
 Step1 will not run until the next PLC cycle

Beckhoff TwinCAT 3
CASE Instruction

 When the CASE instruction is reached the value of iStep is


evaluated

Beckhoff TwinCAT 3
CASE Instruction

 When iStep is equal to 0 this code will be executed

Beckhoff TwinCAT 3
CASE Instruction

 When iStep is equal to 1 this code will be executed

Beckhoff TwinCAT 3
CASE Instruction

 When iStep is equal to 2 this code will be executed

Beckhoff TwinCAT 3
CASE Instruction

 When iStep is equal to any other value this code will be


executed

Beckhoff TwinCAT 3
CASE Instruction

 After the step is executed the code will continue after the
END_CASE

Beckhoff TwinCAT 3
CASE Instruction

 It is possible for steps to be combined


 When step numbers are separated by a , each number will
be evaluated individually
 When step numbers are separated using .. The range of
numbers will be evaluated

 Overlapping/Repeating step numbers will generate a


compile error
Beckhoff TwinCAT 3
CASE Instruction

 In the below example 0, 5, and 42 will have a common


execution

Beckhoff TwinCAT 3
CASE Instruction

 In the below example the values of 2,3 and 4 will have a


common execution

Beckhoff TwinCAT 3
TwinCAT 3

Beckhoff TwinCAT 3
Calling FBs with a CASE Instruction

TWINCAT 3

Beckhoff TwinCAT 3
Calling FBs with a CASE Instruction

 When calling Function Blocks from a CASE instruction it is


important to remember that only one step is run per PLC
cycle.

Beckhoff TwinCAT 3
Calling FBs with a CASE Instruction

 In the below code step 0 will Initialize the timer


 Step 1 sets the input to TRUE and sets iStep to a value of 2
 Step 2 is monitoring the output of the timer, however the
time itself is never being called and will no longer update

Beckhoff TwinCAT 3
Calling FBs with a CASE Instruction

 The function block instance along with the parentheses ()


must called in each step that uses the function block.

Beckhoff TwinCAT 3
Calling FBs with a CASE Instruction

 Another option is to call the function block from outside of


the CASE instruction
 In this example the timer is called every PLC cycle
 The steps in the CASE instruction simply control a variable
that is evaluated by the timer

Beckhoff TwinCAT 3
Calling FBs with a CASE Instruction

 Calling a Function Block outside of a CASE instruction is


slightly less efficient.
 When the Function Block is outside of a CASE instruction, it
is updated every PLC cycle.
 When the Function Block is only called from within a CASE
instruction then it will only be updated when the step is
active.
 Calling the Function Block from within a CASE instruction
requires careful programming practices to ensure that the
Function Block is updated properly.

Beckhoff TwinCAT 3
Calling FBs with a CASE Instruction

 When calling a Function Block from within a CASE


instruction it is important to call the FB in each step as
needed.

Beckhoff TwinCAT 3
Calling FBs with a CASE Instruction

 The Execute input of a


Function Block from the
Tc2_MC2.lib requires a
rising edge for proper
operation.

Beckhoff TwinCAT 3
Calling FBs with a CASE Instruction

 To ensure the rising edge


is handled properly the FB
is first called with a FALSE
at the Execute and then
again called with a TRUE
at the Execute.
 iStep is immediately and
unconditionally changed.

Beckhoff TwinCAT 3
Calling FBs with a CASE Instruction

 The FB is called again with


the Execute set to FALSE,
this calls the Function
Block so that it will be
updated in the step, and
also resets the Execute
 The FB is then monitored
for both an Error status
and a Done status.

Beckhoff TwinCAT 3
TwinCAT 3

Beckhoff TwinCAT 3
Boolean Selection with SEL and IF Instructions

TWINCAT 3

Beckhoff TwinCAT 3
Boolean Selection with SEL and IF Instructions

 Function Block Diagram provides a SEL (Select) Function to


allow for the selection of two items based on a Boolean
value.

Beckhoff TwinCAT 3
Boolean Selection with SEL and IF Instructions

 The Input ‘G’ will either be TRUE or False

Beckhoff TwinCAT 3
Boolean Selection with SEL and IF Instructions

 When ‘G’ is TRUE, the value at ‘IN1’ will be passed to the


output

Beckhoff TwinCAT 3
Boolean Selection with SEL and IF Instructions

 When ‘G’ is FALSE, the value at ‘IN0’ will be passed to the


output

Beckhoff TwinCAT 3
Boolean Selection with SEL and IF Instructions

 It is also possible to place expressions on the inputs on the


SEL block

Beckhoff TwinCAT 3
Boolean Selection with SEL and IF Instructions

 Structured Text provides the same functionality with the IF


Instruction

Beckhoff TwinCAT 3
Boolean Selection with SEL and IF Instructions

 The code between ‘IF’ and ‘THEN’ must result in a Boolean


value, either TRUE or FALSE

Beckhoff TwinCAT 3
Boolean Selection with SEL and IF Instructions

 If myBool is TRUE then the variable myTime will be


assigned a value of T#2s

 Else the variable myTime will be assigned a value of T#1s

Beckhoff TwinCAT 3
Boolean Selection with SEL and IF Instructions

 The expression that is evaluated by the IF instruction can


be any expression that results in a Boolean value

Beckhoff TwinCAT 3
Boolean Selection with SEL and IF Instructions

 The use of the ‘ELSIF’ instruction allows for the evaluation


of another expression when the first expression returns
FALSE.

Beckhoff TwinCAT 3
Boolean Selection with SEL and IF Instructions

 It is also possible to use multiple ‘ELSIF’ instructions

Beckhoff TwinCAT 3
TwinCAT 3

Beckhoff TwinCAT 3
Iterations with Loops

TWINCAT 3

Beckhoff TwinCAT 3
Iterations with Loops - FOR

 The ‘FOR’ loop is used to repeat a block of code, a specific


number of times
 The ‘FOR’ loop has a specific start and end point

Beckhoff TwinCAT 3
Iterations with Loops - FOR

 ‘i’ is the iteration variable and is of type ‘INT’


 In the below samples the ‘FOR’ loop will execute exactly 10
times within 1 PLC cycle

Beckhoff TwinCAT 3
Iterations with Loops - FOR

 The start and the end are defined by the programmer

Beckhoff TwinCAT 3
Iterations with Loops - FOR

 It is a common practice to use the iteration value as the


index value in an array
 This will loop through each index of the array and set it’s
value to zero.

Beckhoff TwinCAT 3
Iterations with Loops - FOR

 It is also possible to skip values in the iteration

Beckhoff TwinCAT 3
Iterations with Loops - FOR

 The start and end of the ‘FOR’ loop must be either literal
values or must be defined as a ‘CONSTANT’
 The value to skip by can be a standard variable

Beckhoff TwinCAT 3
Iterations with Loops - FOR

 When monitoring a ‘FOR’ loop online, the value of the


iteration variable will always be 1 more than the end value

Beckhoff TwinCAT 3
Iterations with Loops - While

 The ‘WHILE’ loop monitors a Boolean condition


 While the Boolean condition is TRUE, the block of code will
continuously repeat within the same PLC cycle

Note: values from outside the PLC task should never be a


condition of the ‘WHILE’ loop
Beckhoff TwinCAT 3
Iterations with Loops - While

 The ‘WHILE’ loop should be used with extreme caution!


 If the condition never results in a value of FALSE the WHILE
loop will run indefinitely

Note: values from outside the PLC task should never be a


condition of the ‘WHILE’ loop
Beckhoff TwinCAT 3
Iterations with Loops - While

 Typically the value being monitored by the ‘WHILE’


instruction will be altered by the code inside of the ‘WHILE’
loop

Note: values from outside the PLC task should never be a


condition of the ‘WHILE’ loop
Beckhoff TwinCAT 3
Iterations with Loops – Repeat Until

 The ‘REPEAT’ loop is similar to the ‘WHILE’ loop


 The difference is that the code in the loop is guaranteed to
run a minimum of 1 time

Note: values from outside the PLC task should never be a


condition of the ‘REPEAT’ loop
Beckhoff TwinCAT 3
Iterations with Loops – Repeat Until

 After the block of code is executed, then condition is


checked
 If the condition is TRUE then code will continue, if the
Condition is FALSE the code will ‘REPEAT’

Note: values from outside the PLC task should never be a


condition of the ‘REPEAT’ loop
Beckhoff TwinCAT 3
Iterations with Loops – EXIT

 It is possible to ‘EXIT’ a loop at any time

Beckhoff TwinCAT 3
TwinCAT 3

Beckhoff TwinCAT 3
LIMIT Function

TWINCAT 3

Beckhoff TwinCAT 3
LIMIT Function

 The LIMIT function provides the programmer with a way to


limit the value of an input to another function or function
block

Beckhoff TwinCAT 3
LIMIT Function

 This will allow the programmer to ensure proper operation


even if the user enters a number that is out of range

Beckhoff TwinCAT 3
TwinCAT 3

Beckhoff TwinCAT 3
Logging in to the PLC

TWINCAT 3

Beckhoff TwinCAT 3
Logging in to the PLC

 From the ‘PLC’ menu, select ‘Login’

Beckhoff TwinCAT 3
Logging in to the PLC

 Confirm that you would like to Create the Run-Time and


load the code

Beckhoff TwinCAT 3
Logging in to the PLC

 From the ‘PLC’ menu, select ‘Start’

Beckhoff TwinCAT 3
Logging in to the PLC

 In the ‘Solution Explorer’


under ‘PLC’ expand ‘POUs’
and then double-click on
‘MAIN (PRG)’

Beckhoff TwinCAT 3
Logging in to the PLC

 ‘MAIN’ is opened in the ‘Code’ window


 The TAB at the top indicates that it is ‘Online’
 Double-click in the ‘Prepared value’ column and type in a
value for either ‘b’ or ‘c’
 Press ‘Enter’

Beckhoff TwinCAT 3
Logging in to the PLC

 From the ‘PLC’ menu,


select ‘Write values to all
online applications’

Beckhoff TwinCAT 3
Logging in to the PLC

 The ‘Prepared value’ is now placed in the ‘Value’


 If the value of ‘a’ does not update, check that the ‘PLC’ is
running

Beckhoff TwinCAT 3
Logging in to the PLC

 Online mode information - status of the PLC modules:


 = Engineering Environment is in Offline Mode and
the PLC module is in not Run Mode or there is no
connection to the target
= Engineering Environment is in Online Mode but
the PLC module is not in Run Mode
= Engineering Environment is in Offline Mode but
the PLC module is in Run Mode
= Engineering Environment is in Online Mode and
the PLC module is in Run Mode
Beckhoff TwinCAT 3
TwinCAT 3

Beckhoff TwinCAT 3
Making Changes to the Code

TWINCAT 3

Beckhoff TwinCAT 3
Making changes to the Code

 To make changes to the PLC you must be Offline.


 In the ‘PLC’ menu, click ‘Logout’

Beckhoff TwinCAT 3
Making changes to the Code

 In ‘Main’ change the command from + to –

Beckhoff TwinCAT 3
Making changes to the Code

 Again, from the ‘Build’ menu, select ‘Rebuild Solution’

Beckhoff TwinCAT 3
Making changes to the Code

 From the ‘PLC’ menu select ‘Login’

Beckhoff TwinCAT 3
Making changes to the Code

 When preforming a ‘Login’ the following options will be


provided.

Beckhoff TwinCAT 3
Making changes to the Code

 Login with online change : This option is selected


per default. So if you confirm the dialog with OK , the
modifications will be loaded and immediately shown in
the online view (monitoring) of the respective
object(s).

Beckhoff TwinCAT 3
Making changes to the Code

 Login with download : Activate this option if the


application project should be loaded and initialized
completely. This will Stop the PLC execution.

 Login without any change : Activate this option in


order to keep the program running on the controller
unchanged. Afterwards an explicit download might be
done, thus loading the complete application project, or
at the next re-login you will be asked again whether an
online change should be done.
Beckhoff TwinCAT 3
New Automation Technology
Beckhoff Training
Programs

Program PRG
 Called by a task: (one program can call another)
 Calls: Programs, Funtion Blocks, and Functions
 Local variable: static, i.e. the local data are available again in the next cycle.
 Inputs: usually 0, but VAR_INPUT possible
 Outputs: usually 0, but VAR_OUTPUT possible
 Transfer by reference: VAR_IN_OUT possible
 Monitoring: Local data are immediately visible in the online mode of the PLC control
 Use: Main programs, Main, Manual, Automatic, Unwind, Rewind, Sorter, etc.
Programs

ST FBD IL LD
New Automation Technology
Beckhoff Training
Beckhoff
Calling Programs

 Right-Click on the POUs folder, select ‘Add’, then click ‘POU…’


Beckhoff
Calling Programs

 Give the POU a unique name


 Set the Type to ‘Program’
 Select ‘Structured Text’ as the Implementation
language
 Click ‘Open’
Beckhoff
Calling Programs

 Double – Click on ‘MAIN’


 Place the cursor in the body of ‘MAIN’ and press the ‘F2’ key
Beckhoff
Calling Programs

 In the ‘Input Assistant’ select ‘Module Calls’


 Expand ‘Untitled1’, and POUs
 Select ‘P_Manual’, Click ‘OK’
Beckhoff
Calling Programs

 ‘P_Manual’ is now called from ‘MAIN’


New Automation Technology
Beckhoff Training
Beckhoff
Functions

 A Function is a re-useable piece of code that will process the defined inputs and
return a single result
 AND, OR, SQRT, SIN, COS, GT, LE are all examples of Functions
 The programmer can also create their own Functions that normally involve more
complicated tasks, such as converting a temperature value from Celsius to
Fahrenheit or scaling an analog input value from 0-32767 to 0-10

 Note: Functions have no memory space and therefore they do not retain any values
from one PLC scan to the next. Each function starts new each PLC scan.
Beckhoff
Functions

Function: FUN
 Called by Programs, Function Blocks and other Functions
 Calls: Functions
 Local variable: temporary, i.e. the local data are available only for the
processing time of the function. Afterwards this data area is used by other
functions.
 Inputs: 1,2,3........ VAR_INPUT
 Outputs: precisely 1!, but structure variable possible. The name of the output
is the name of the function.
 Transfer by reference: 1,2,3........ VAR_IN_OUT ,
 Monitoring: In the online mode of the PLC control only “???” are visible for the
local variables, since this data area is used by all functions in the cycle and
monitoring (debug) takes place only at the cycle limits. Remedy: program
development with breakpoints
 Use: algorithms where the result is available after a run. Scaling, comparison,
etc.
Beckhoff
Functions

ST FBD

IL LD
New Automation Technology
Beckhoff Training
Beckhoff
Adding a new Function

 To add a Function, ‘Right-Click’ on the ‘POUs’ folder


 Then Select ‘Add’ -> ‘POU’
Beckhoff
Adding a new Function

 In the ‘Add POU’ Dialog window


 Change the ‘Name’ to ‘F_Square’
 Select the ‘Radio’ Button for ‘Function’
 Type in ‘LREAL’ for the ‘Return Type’
 Set the Implementation Language to
‘Structured Text’
 Click the ‘Open’ button
Beckhoff
Adding a new Function

 You should now see the following


Beckhoff
Parts of a Function

 Declaration
 Code
 Use
Beckhoff
Parts of a Function : Declaration

 The Declaration of a Function contains 4 parts


 The Name of the Function
 The Return type of the Function
 The Variables to be passed into the Function
 The local variables used by the Function
Beckhoff
Parts of a Function : Declaration

 The Name of the Function


 Following the Beckhoff coding convention, the name of the Function starts with
F_
 The same IEC rules for naming of variables apply to the naming of Functions
 Following the Name of the Function is the Return Type
 A Function can only Return one variable
Beckhoff
Parts of a Function : Declaration

 The Variables to be passed into the Function


 In the below example lrTempInCelsius is the name of the Variable that is being
passed into the function
Beckhoff
Parts of a Function : Code

 Write to the name of the Function to return the result of the function
Beckhoff
Use of a Function

 myNumber is declared as an LREAL with an initial value of 2.0


 mySquaredNumber is declared as an LREAL with no initial value
 In the code the Function
F_Squared is called and
myNumber is passed into it.
 The result of the Function
is then stored in mySquaredNumber .
New Automation Technology
Beckhoff Training
Beckhoff
Adding a new Function

 To add a Function, ‘Right-Click’ on the ‘POUs’ folder


 Then Select ‘Add’ -> ‘POU’
Beckhoff
Adding a new Function

 In the ‘Add POU’ Dialog window


 Change the ‘Name’ to ‘F_CtoF’
 Select the ‘Radio’ Button for ‘Function’
 Type in ‘LREAL’ for the ‘Return Type’
 Set the Implementation Language to
‘Structured Text’
 Click the ‘Open’ button
Beckhoff
Adding a new Function

 You should now see the following


Beckhoff
Parts of a Function

 Declaration
 Code
 Use
Beckhoff
Parts of a Function : Declaration

 The Declaration of a Function contains 4 parts


 The Name of the Function
 The Return type of the Function
 The Variables to be passed into the Function
 The local variables used by the Function
Beckhoff
Parts of a Function : Declaration

 The Name of the Function


 Following the Beckhoff coding convention, the name of the Function starts with
F_
 The same IEC rules for naming of variables apply to the naming of Functions
 Following the Name of the Function is the Return Type
 A Function can only Return one variable
Beckhoff
Parts of a Function : Declaration

 The Variables to be passed into the Function


 In the below example lrTempInCelsius is the name of the Variable that is being
passed into the function
Beckhoff
Parts of a Function : Code

 The working code of the Function


 Tf := 9/5 * Tc + 32
 The name of the Function is used as the Return value of the Function
 The literal values of 9, 5 and 32 all have a decimal point to signify them as
REAL numbers and not INTEGERs
Beckhoff
Use of a Function

 lrTempC is declared as an LREAL with an initial value of 100


 lrTempF is declared as an LREAL with no initial value
 In the code the Function
F_CtoF is called and
lrTempC is passed into it.
 The result of the Function
is then stored in lrTempF.
Beckhoff
Parts of a Function : Summary
TwinCAT 3

Beckhoff TwinCAT 3
Linear scaling with a ratio

TWINCAT 3

Beckhoff TwinCAT 3
Linear scaling with a ratio

 Assignment:
 Create a function that will scale a value between
0 and 32767 to a value between 0.0 and 100.0

 Thoughts:
 Because both scales start at 0 we can simply divide the
maximum scale-to value by the maximum scale-from
value 100.0/32767
 This will give us a ratio that we can multiply by the input
and it will give us the scaled value

Beckhoff TwinCAT 3
Linear scaling with a ratio

 The formula will be

 Ratio := MaxOuput / MaxInput;


 ScaledValue := InputValue * Ratio;

Beckhoff TwinCAT 3
Linear scaling with a ratio

Answer

Beckhoff TwinCAT 3
Linear scaling with a ratio

 Declaration

Beckhoff TwinCAT 3
Linear scaling with a ratio

 Code

Beckhoff TwinCAT 3
Linear scaling with a ratio

 Use

Beckhoff TwinCAT 3
TwinCAT 3

Beckhoff TwinCAT 3
Linear scaling using an equation

TWINCAT 3

Beckhoff TwinCAT 3
Linear scaling using an equation

 Assignment
 Create a function that will scale a value between any
two numbers to a value between any two other
numbers

Beckhoff TwinCAT 3
Linear scaling using an equation

 Thoughts
 This is similar to converting temperature from one scale
to another. The numbers can go both positive and
negative. For any given value on 1 scale there is exactly
1 possible value on the other scale
 32 degrees F = 0 degress C
 212 degress F = 100 degrees C

Beckhoff TwinCAT 3
Linear scaling using an equation

 Thoughts
 Think of the Celsius scale as the X-Axis and the
Fahrenheit scale as the Y-Axis
 The formula to convert from Celsius to Fahrenheit is:
TempF = 9/5 * TempC + 32
 The +32 is the offset of the line,
because it does not cross the
Y-Axis at 0

Beckhoff TwinCAT 3
Linear scaling using an equation

 Thoughts
 The 9/5 comes from the step required to get from one
position on the line to the next
 For each increase of 9 degrees Fahrenheit. You must
increase 5 degrees in Celsius

Beckhoff TwinCAT 3
Linear scaling using an equation

 Thoughts
 An increase on the Y-Axis is referred to as a Rise, an
increase on the X-Axis is called a Run

Beckhoff TwinCAT 3
Linear scaling using an equation

 Thoughts
 So we have a Rise of 9 and a Run of 5. This can be
calculated using 2 known positions 100,212 and 0,32
 The difference in the values will give us the change in
Step.
212-32 / 100-0 = 180/100 = 9/5
Step = (y2-y1) / (x2-x1)

Beckhoff TwinCAT 3
Linear scaling using an equation

 Thoughts
 Because the Step is actually a ratio it is referred to as the
Slope of the Line, in the formula we will use the letter
m.
 The formula needed to do our conversion is
y = mx + b
where:
m = (y2-y1) / (x2-x1)
x = value to be converted (TempC)
b = 32, the Y-Intercept

Beckhoff TwinCAT 3
Linear scaling using an equation

 Thoughts
 y = 9/5 * TempC + 32
 TempF = 9/5 * TempC + 32

Beckhoff TwinCAT 3
Linear scaling using an equation

 Thoughts
 Using this formula we can now convert from any scale to
any other scale
 y=mx+b
 m=(y2-y1)/(x2-x1)
 b=y1-(x1*m)

Beckhoff TwinCAT 3
Linear scaling using an equation

Answer

Beckhoff TwinCAT 3
Linear scaling using an equation

 Declaration

Beckhoff TwinCAT 3
Linear scaling using an equation

 Code

Beckhoff TwinCAT 3
Linear scaling using an equation

 Use

Beckhoff TwinCAT 3
New Automation Technology
Beckhoff Training
Beckhoff
Function Blocks

 A Function Block is a re-useable piece of code that can have multiple inputs and
multiple outputs. Function Blocks are instantiated, therefore each time a Function
Block is used it must be assigned a unique instance name. Each instance receives
its own space in memory and therefore will retain its values from one PLC scan to
the next.
 TON, CTU, R_Trig, FB_FileOpen, ADSREAD, these are just a few examples of
Function Blocks
 The programmer can also create their own Function Blocks to perform a variety of
tasks.
Beckhoff
Function Block

Function block FB
 Called by: Programs or other FBs
 Calls: Funtion Blocks, Functions
 Local variable: static, i.e. the local data are available again in the next cycle. Each
FB call has its own local data.
 Inputs: 0,1,2,3…VAR_INPUT
 Outputs: 0,1,2,3.. VAR_OUTPUT
 Transfer by reference: 0,1,2,3.. VAR_IN_OUT
 Monitoring: In the online mode of the PLC control the instance of the call concerned
must first be specified. The local data are then visible for each call.
 Use: multiple-used modules, each of which requires its own data area. Timers,
Counters, Axis Commands, Alarms, etc.
Beckhoff
Function Block

ST FBD

IL LD
New Automation Technology
Beckhoff Training
Beckhoff
Adding a new Function Block

 To add a Function Block, ‘Right-Click’ on the ‘POUs’ folder


 Then Select ‘Add’ -> ‘POU’
Beckhoff
Adding a new Function Block

 In the ‘Add POU’ Dialog window


 Change the ‘Name’ to ‘FB_Pulse’
 Select the ‘Radio’ Button for ‘Function Block’
 Set the Implementation Language to ‘Structured
Text’
 Click the ‘Open’ button

Note: Extends, Implements, and Access Specifier


are used with OOP and should be left empty
Beckhoff
Adding a new Function Block

 You should now see the following


Beckhoff
Parts of a Function Block

 Declaration
 Code
 Use
Beckhoff
Parts of a Function Block : Declaration

 The Declaration of a Function Block contains 4 parts


 The Name of the Function Block
 The Variables to be passed into the Function Block
 The Variables to be passed out of the Function Block
 The Variables that are internal to the Function Block
 The Body/Code of the Function Block
Beckhoff
Parts of a Function Block : Declaration

 The Name of the Function Block


 Following the Beckhoff coding convention, the name of the Function Block
starts with FB_
 The same IEC rules for naming of variables apply to the naming of Function
Blocks
Beckhoff
Parts of a Function Block : Declaration

 The Variables to be passed into the Function Block


 Below the Enable, Time On, and Time Off values are being passed into the
Function Block
Beckhoff
Parts of a Function Block : Declaration

 The Variables to be passed out of the Function Block


 Below the Output variable ‘bPulse’ has been added
Beckhoff
Parts of a Function Block : Declaration

 The Variables that are internal to the Function Block


 Below the two timers to be used have been instantiated
 fbTON is of type TON
 fbTOF is of type TOF
Beckhoff
Parts of a Function Block: Code

 The working Code of the Function Block


 Below the two timers are called with their instance name
 The := symbol signifies that a value of the variable is being passed into the FB and
the => symbol signifies that a value of the variable is being passed out of the FB
Beckhoff
Parts of a Function Block: Code

 The IN of fbTON is TRUE if bEnable is TRUE and fbTOF.Q is FALSE


 What is fbTOF.Q?
 Any the . symbol is used it signifies that the variable on the right exists inside of the
variable on the left.
 Q is an output of a TOF, therefore calling the instance name fbTOF followed by .
will allow access to the variables that are declared inside of fbTOF
Beckhoff
Parts of a Function Block: Code

 Also notice that fbTON.Q is passed into fbTOF, this will cause the two timers to
toggle based on the values of tTimeOff and tTimeOn
 Finally the output of fbTOF is passed to bPulse. bPulse is the output of FB_Pulse
 This could have been done with the following
 bPulse := fbTOF.Q;
Beckhoff
Parts of a Function Block: Use

 fbPulse1 is of type FB_Pulse fbPulse1 is an instance of FB_Pulse


 bSwitch is passed into the bEnable input of fbPulse1
 tTimeOn and tTimeOff are assigned literal values in the proper TIME format
 bPulse is passed out of fbPulse1 into bLight
Beckhoff
Parts of a Function Block: Summary
TwinCAT 3

Beckhoff TwinCAT 3
Library Manager

TWINCAT 3

Beckhoff TwinCAT 3
Beckhoff
Libraries

 Libraries contain Functions and Function Blocks that can be used within a program.
 TwinCAT includes many libraries for many common tasks.
 Libraries can be written by the programmer and re-used on multiple projects.
 The Functions and Function Blocks in the libraries cannot be opened from the PLC
program that is using them.
 All Libraries are pre-compiled.
Library Manager

 The Library Manager can be accessed in the Solution Explorer under the PLC
Project

Beckhoff TwinCAT 3
Library Manager

 By Default the Library Manager contains the Standard and System Libraries from
TwinCAT 2 (Note: These libraries have been converted to work within TwinCAT 3)
 Tc3_Interfaces and Tc3_Module are additional libraries that can be used for
communicating with TcCom objects and other new features in TwinCAT 3
 Note: Tc3_Module is required in order to be able to compile a project

 A library contains a Name, a Company, an effective Version and a default


Namespace. These values are set in the project information dialog of each library.

Beckhoff TwinCAT 3
Library Manager - Versions

 Managed Libraries
 In general the libraries are added to the library manager with an specific version.
(e.g. v3.2.0.0)
 The project will always use this set of libraries although newer versions of some
libraries could exist in the library repository. The project can automatically use the
newest version of a library too.
 To use libraries unmanaged, Click on a library in the Library Manager, select the
Properties button at the top of the library manager, and set the version to 'Newest
version always'.
 In this dialog it is also possible to specify another specific version.

Beckhoff TwinCAT 3
Library Manager - Versions

 Managed Libraries
 Select a Library and Click Properties

Beckhoff TwinCAT 3
Library Manager - Versions

 Managed Libraries
 Specific Versions or Newest Version always can be selected here

Beckhoff TwinCAT 3
Library Manager – Adding a Library

 Use the ‘Add Library’ button to add a library to the project


 Note: Libraries are added to the project, not the solution, if more than one PLC
project exists inside of a solution, then each PLC project will have its own libraries.

Beckhoff TwinCAT 3
Library Manager – Adding a Library

 Use the ‘Add Library’ button to add a library to the project


 Note: Libraries are added to the project, not the solution, if more than one PLC
project exists inside of a solution, then each PLC project will have its own libraries.
 Click on the ‘Advanced…’ button in the bottom left corner

Beckhoff TwinCAT 3
Library Manager – Adding a Library

 When Display all versions is checked, the library manager will show previous
versions of the libraries (if there are any).

Beckhoff TwinCAT 3
Library Manager – Adding a Library

 From the Library Repository it is possible to add additional folder locations, and
copy library files into the default folder

Beckhoff TwinCAT 3
Library Manager – Adding a Library

 Add an additional location

Beckhoff TwinCAT 3
Library Manager – Adding a Library

 Move libraries to the default location

Beckhoff TwinCAT 3
Library Manager – Adding a Library

 The ‘Find’ button will allow for searching for an item inside of all libraries

Beckhoff TwinCAT 3
Library Manager – Adding a Library

 Type in the search word and wait for the results


 Select the desired item and press ‘Open’
 The library will now be selected in the previous window

Beckhoff TwinCAT 3
Library Manager – Adding a Library

 The ‘Details’ button will provide specific information about the selected item.

Beckhoff TwinCAT 3
New Automation Technology
Beckhoff Training
Beckhoff
Flow Control

 Flow control allows you to see which lines of code are being executed
 In the below sample we can see that lines 2 and 5 are being executed, as indicated
by the green highlights

Flow Control Off Flow Control On


Beckhoff
Flow Control

 Flow Control is part of the TwinCAT PLC Toolbar


New Automation Technology
Beckhoff Training
Beckhoff
Searching

 Go To Definition
 Find All References
 Find
Beckhoff
Go To Definition

 To find the Declaration of a Variable, Highlight the text, then Right-Click


 Select ‘Go To Definition’ from the context menu
Beckhoff
Go To Definition

 This will open the file where the declaration is and Highlight the Variable
 If a Variable is defined in more than one location, the search tool will find the
correct definition based on the use of the variable
Beckhoff
Go To Definition

 This can also be used on the instance and/or the implementation of a Function
Block
 The Definition of fbTOF in the Code window is on Line 12 in the local declaration
window.
Beckhoff
Go To Definition

 The definition of TOF is found in the Library Manager


Beckhoff
Go To Definition

 Using ‘Go To Definition on the declaration of an instance will open the


implementation of a user defined Function Block
Beckhoff
Find All References

 Using ‘Find All References’ will open a new window displaying the search results
Beckhoff
Find All References

 Using ‘Find All References’ will open a new window displaying the search results
 This window will display the declaration of the variable and also where the variable
is read and written in the program
Beckhoff
Find All References

 This search will find multiple declarations if they exist.


Beckhoff
Find All References

 This search will find multiple declarations if they exist

 The results can be filtered using the ‘Scope’ drop down list
Beckhoff
Find All References

 Double-Clicking on a result in the ‘Cross Reference List’ will open the code and
Highlight the text
Beckhoff
Find

 Find is part of the ‘Standard Tool Bar’


Beckhoff
Find

 You can type in part of a variable name and press the ‘Enter’ key
 Each time you press the ‘Enter’ key the next result will be Highlighted

 Using the Find tool in this manner will only search the current file
Beckhoff
Find

 Using the Icon will open the ‘Find and Replace’ window
Beckhoff
Find

 Using the Icon will open the ‘Find and Replace’ window
 The ‘Look in:’ drop down list will allow for searching of more than just the current file
New Automation Technology
Beckhoff Training
Beckhoff
Boot Project

 The TwinCAT Boot Project is used on a production machine as the PLC code to be
run when TwinCAT starts.
 The Boot Project in TwinCAT3 is Automatically created when the Configuration is
“Activated”
 The default location for the Boot Project is C:\TwinCAT\3.1\Boot
Beckhoff
Boot Project

 The “Autostart” for the boot project can be found by selecting the name of the PLC
Project in the “Solution Explorer”
Beckhoff
Boot Project

 Before activating the configuration the folder is empty, after a “Blank Configuration”
has been added the follow files and folders are created.
Beckhoff
Boot Project

 Adding a PLC project and then Activating the Configuration provides the following
Beckhoff
Boot Project

 A Right-Click on the Project Name in the Solution Explorer will provide a context
menu that allows for “Activate Boot Project…” this way you can create a boot
project without effecting the I/O configuration.
 There is also the option to Enable and Disable the Autostart of the boot project from
here
Beckhoff
Boot Project - Encryption

 The option to Encrypt the boot project exists in a drop down list and can be
accessed by selecting the project name in the solution explorer
Beckhoff
Boot Project - Encryption

 The Boot folder holds a zip file that contains the files to recreate the project, all of
these files can be opened by adding them as an existing item.
 The PLC folder contains the information of the actual Boot Project.
Beckhoff
Boot Project - Encryption

 Removing the PLC folder from C:\TwinCAT\3.1\Boot will remove the boot project.
 If Encryption is enabled, these are the files that are encrypted.
 Encryption is done with Standard AES encryption.
 An encrypted boot project can only be run on its Target System; therefore moving
an encrypted Boot folder from one CX to another will no longer function.
New Automation Technology
TwinCAT 3 Scope

IPC I/O Motion Automation


TwinCAT 3 Scope
Overview

 A charting and analysis tool for the TwinCAT world


 Variables from the TwinCAT system can be recorded and displayed graphically
 Sampling rates can be adjusted individually for each channel
 Recordings in the µs range and long-term recordings over several days are
possible

 Scope View for the display of the signals


 Scope Server for the recording of the values
 Possibility to connect to servers distributed in the field from a central View

 Due to its integration into Visual Studio, it is possible to use TwinCAT Projects and
Scope View projects in a single solution
TwinCAT 3 Scope
Agenda

 Scope History
 Installation
 Features
 General Features
 Product Levels
 Scope Details
 Lab
TwinCAT 3 Scope
Scope History – Scope 1

Always installed with TwinCAT 2


TwinCAT 3 Scope
Scope History – Scope 2

An approved engineering tool…

• New style
• 2 Components View and Server
• Long time records
• Auto scaling
• More trigger functionality
• Constant development
TwinCAT 3 Scope
Scope History – Scope 2

The functional principle

Scope 2 View

Scope 2 Scope 2 Scope 2


Server Server Server
Device 1 Device 2 Device n
TwinCAT 3 Scope
Scope History – TwinCAT 3 Scope

A consistent stage of development…


TwinCAT Scope 2 Visual Studio + TwinCAT 3

= TwinCAT 3 Scope:

Integrated into Microsoft


Visual Studio
TwinCAT 3 Scope
Agenda

 Scope History
 Installation
 Features
 General Features
 Product Levels
 Scope Details
 Lab
TwinCAT 3 Scope
Installation

What if you do not have Visual Studio but want to use the Scope?

TwinCAT 3 Scope Installation

Visual Studio 2010 available


No Visual Studio available

 TwinCAT 3 Scope “Integrated” into  TwinCAT 3 Scope


VS2010 contains royalty free VS2010-Shell
 Integration into the Microsoft Visual Studio  Provides Microsoft Visual Studio Shell
TwinCAT 3 Scope as new template like C# / C++  Usable as Standalone Scope
 C# /.NET programming for Scope Control
applications in the same environment
TwinCAT 3 Scope
Installation Requirements

 OS
 Windows XP, Windows XP Embedded, Windows Embedded Standard 2009,
Windows 7

 .Net Framework
 The .NET Framework 4.0 is required

 TwinCAT
 Minimum is TwinCAT 3 ADS
TwinCAT 3 Scope
Installation

 TwinCAT 3 Scope Base is installed with TwinCAT 3 XAE


 Further product levels and features are enabled by licensing
 Scope can also be downloaded for use outside of TwinCAT 3 Engineering
 Download Scope View
 Both Full and an Update version are available
 After accepting the license agreement, please provide customer information
TwinCAT 3 Scope
Installation

 Complete – Normal install with both Server and View

 Custom – Options for TF3300 Scope Server (2KB) and/or TE130X Scope View
(3KB)
TwinCAT 3 Scope
Licensing

 Licensing for Scope View is the same as all other TC3 Functions
TwinCAT 3 Scope
Agenda

 Scope History
 Installation
 Features
 General Features
 Product Levels
 Scope Details
 Lab
TwinCAT 3 Scope
Features

 Integration as an individual project


 Can exist in parallel to TwinCAT in one solution
 Creates synergies between the TC-products
 Hierarchy like in TwinCAT Scope 2
TwinCAT 3 Scope
Features

Easy selection of channels with the Target Browser

 Integrated into Visual Studio as an individual Tool-Window


 Multiselect and Drag & Drop are possible
 Filter settings for variables
TwinCAT 3 Scope
Features

Selection of variables over the variable-declaration in the TwinCAT PLC Control


TwinCAT 3 Scope
Features

Multiselect in the Solution-Explorer

 Common changes can be implemented faster


 Changes that are not possible are shown grayed out
 Scope-comprehensive
TwinCAT 3 Scope
Features

Easy Engineering because of Docking-Windows


TwinCAT 3 Scope
Agenda

 Scope History
 Installation
 Features
 General Features
 Product Levels
 Scope Details
 Lab
TwinCAT 3 Scope
General Scope Features

Long time records are possible

 File store option in Scope properties


 Depending on system resources
 Depending on the amount of channels, sampling rate and record time

Solid data after storing as .svd file


TwinCAT 3 Scope
General Scope Features

Analysis during the record

It is possible to stop one


chart for your analysis
and the recording goes
on!
TwinCAT 3 Scope
General Scope Features

Cursor and Marks

Activation of X- and Y- Cursors


during the recording
TwinCAT 3 Scope
General Scope Features

Different zoom and panning functions

Zoom and panning functions:


-Zoom X-Axis
-Zoom Y-Axis
-Zoom Default Display Width
-Zoom Max Out
-Panning X Direction
-Panning X and Y Direction
TwinCAT 3 Scope
General Scope Features

Trigger controlled records

 Start Record
 Stop Record
 Stop Display
 Restart Display
 Start Subsave
 Stop Subsave
 Execute Report
TwinCAT 3 Scope
Agenda

 Scope History
 Installation
 Features
 General Features
 Product Level
 Scope Details
 Lab
TwinCAT 3 Scope
Product Level

TwinCAT 3 Scope Base


 Integrated into TwinCAT Engineering (TE1000) Setup
 View and local Server
 Machine start-up
 No license required

TwinCAT 3 Scope View Professional


 TE1300 with extended functions: long term records, Subsaves, .NET Control
Integration
 Process control
 Subject to license terms

TwinCAT 3 Scope Server


 Remote Server
 Activates the extended functions of Professional
 Subject to license terms
TwinCAT 3 Scope
View vs Server

 Scope View
 is a TwinCAT engineering product and supplies the graphic interface for the
configuration of recordings and the display of signal curves. The View is
available in different product levels, Base and Professional

 Scope Server
 is a TwinCAT 3 function and supplies the software for the data recording,
which is installed on distributed target devices or on the local target device.
The Server sends the recorded data to the View

Note: Both components must be available in the system in order to be able to use the
Scope.
TwinCAT 3 Scope
View vs Server

 The TwinCAT Scope View communicates over ADS with the Scope Servers
distributed in the system. The local Server, which is located with the View on a
system, can be used for the recording of local variables. However, it is also used
whenever saved Scope data files are opened in the View. The View displays the
signal curves and is used for the configuration of recordings.
TwinCAT 3 Scope
Agenda

 Scope History
 Installation
 Features
 General Features
 Product Levels
 Scope Details
 Configuration
 Lab
TwinCAT 3 Scope
Configuration

 Not only are signal curves represented in the TwinCAT Scope View; recording
configurations are also created. The architecture is reflected in the tree structure
within the Measurement Project in the Solution Explorer.

 Measurement Scope Project:


The main level, in which several Scopes can be
inserted. The Scopes within a project can be
controlled independently of one another.
 Standard Scope Project:
A Scope always stands for a recording
configuration. This means that all elements inserted
below it are subject to the same recording settings.
If you click on a Scope, the setting options such as
recording duration and ring buffer are displayed in
the Visual Studio Property window.
TwinCAT 3 Scope
Configuration

 Chart:
Several charts can exist in parallel in a Scope. They are the actual display area in
the view and provide the time base. Each chart has its own toolbar for changing the
display. The color and axis settings can be made in the Property window.

 Axis:
A chart can have several axes. An axis provides the
range of values for the connected channels.
Amongst others, the automatic or free scaling can
be set in the Property window.
 Cursor:
Cursors are hierarchically assigned to the charts. X
and Y cursors can be added within a chart. In the
Cursor Tool window you can see amongst other
things the current values of the signal/cursor
interface and also differences to other cursors. Any
desired number of X and Y cursors can be set.
TwinCAT 3 Scope
Configuration

 Trigger:
Triggers are assigned to the Scopes in the tree structure of the Scope View. The
trigger action, e.g. Stop Record, can be set in the Property window of the trigger
group. The underlying triggers can be logically linked to a trigger condition. The
variable selection also takes place here in the Property window.
TwinCAT 3 Scope
Agenda

 Scope History
 Installation
 Features
 General Features
 Product Levels
 Scope Details
 Window
 Lab
TwinCAT 3 Scope
Window

 The interfaces for the


control of the Scope View
are divided into several
individual windows (Tool
windows) and their position
and size are freely
configurable.

Note: To reset the window


layout from the ‘Window’
menu select ‘Reset Window
Layout’
TwinCAT 3 Scope
Window

 Solution Explorer
 Display of the project structure within a solution.
TwinCAT 3 Scope
Window

 Cursor
 Display of the values present at the X/Y-cursor.
TwinCAT 3 Scope
Window

 Error List
 List of errors, warnings and messages. Each scope project lists the generated
messages independently here. The messages for the respectively selected
Scope can be deleted via the context menu item "Clear Error List".
TwinCAT 3 Scope
Window

 Target Browser
 With the target browser you can be add Scope configuration channels via their
symbol names.
TwinCAT 3 Scope
Window

 Properties
 The settings of the respective element that is marked
in the Solution Explorer can be modified here.
TwinCAT 3 Scope
Window

 Scope View Control


 Display of the individual charts. The
charts can be displayed next to
each other or in overlapping tabs
within the control, exactly like all
other windows.
TwinCAT 3 Scope
Agenda

 Scope History
 Installation
 Features
 General Features
 Product Levels
 Scope Details
 Project Types
 Lab
TwinCAT 3 Scope
Project Types

 Empty Measurement Project


 Scope configurations (.sv2 | .tcscope) or scope data (.svd) can subsequently
be inserted here.
TwinCAT 3 Scope
Project Types

 Measurement Scope Project


 Contains a Scope instance as well as a pre-configured chart and an axis.
TwinCAT 3 Scope
Project Types

 Measurement Scope Project with Reporting


 See "Measurement Scope Project" + a ready-made printing template for
printing charts.
TwinCAT 3 Scope
Project Types

 Measurement Scope NC Project


 Contains a Scope instance that has been specially pre-configured for
working with axes.
TwinCAT 3 Scope
Agenda

 Scope History
 Installation
 Features
 General Features
 Product Levels
 Scope Details
 Scope Menu
 Lab
TwinCAT 3 Scope
Scope Menu

 Target Browser
 Opens the target browser for variable
selection from local or remote servers

 Cursor Window
 Opens the cursor window.
TwinCAT 3 Scope
Scope Menu

 Send Project By E-Mail...


 Context menu of the Scope instance to be
sent - > Send Project By Email
If the Scope is to contain data (Scope State:
Reply), then you can select whether the data
should also be sent.

 Clear Error List


 Deletes all entries (Error | Warning | Message)
of the currently active Scope from the error
list.
TwinCAT 3 Scope
Scope Menu

 Change Ads Symbol...


 Dialog for the replacement of character
strings. The symbol names of all channels
located below the selected element are edited.

 Change Index Group...


 Dialog for incrementing / decrementing the
Index Group / Index Offset. The acquisitions of
all channels located below the selected
element are edited.
TwinCAT 3 Scope
Scope Menu

 New Chart
 Creates a new chart within the Scope.

 New Axis
 Creates a new axis within the chart. If the
selected element is not a chart, then a new
chart is additionally created.

 New Empty Channel


 Creates a new channel within the axis. If no
axis is selected, then a new axis is additionally
created.
TwinCAT 3 Scope
Scope Menu

 Delete
 Deletes the element currently selected in the
Solution Explorer.
TwinCAT 3 Scope
Scope Menu

 Export to CSV
 Export data to a CSV file

 Export to Binary
 Export data to a Binary file
TwinCAT 3 Scope
Scope Menu

 Save Data
 After stopping the recording, the current data
including the configuration can be saved in a
.svd file.
 The generated Scope data file (.svd) can be
added directly to the Measurement Project or
saved in a directory of your choice via the
directory selection dialog.
TwinCAT 3 Scope
Scope Menu

 Scope Messages
 Some frequently occurring message boxes in
the scope are equipped with a checkbox
"Remember my answer and don't ask again!"
so that the question is not repeated the next
time. This makes the handling of the program
individually adjustable for each user. If a
message box has been deactivated, it can be
activated again here.
TwinCAT 3 Scope
Scope Menu

 Local Scope Server...


 Opens the configuration interface of the Scope
Server.

 Options...
 Opens the Visual Studio Options window and
selects the Scope entry.
TwinCAT 3 Scope
Agenda

 Scope History
 Installation
 Features
 General Features
 Product Levels
 Scope Details
 Toolbar
 Lab
TwinCAT 3 Scope
Toolbar

 The default Measurement toolbar includes commands to Start and Stop recording.
 Other commands can be added by selecting the down arrow and then customize.
TwinCAT 3 Scope
Agenda

 Scope History
 Installation
 Features
 General Features
 Product Levels
 Scope Details
 Properties
 Lab
TwinCAT 3 Scope
Properties

 Each item in the Solution Explorer (Scope, Chart, Axis, and Channel) has it’s own
properties window.
TwinCAT 3 Scope
Properties

 Project properties include:


 File Name and File Path
 Record Time Days:Hours:Minutes:Seconds
TwinCAT 3 Scope
Properties

 Project properties include:


 File Store specifies whether the server should temporarily save the data in a
local file or whether it should keep the data only in the RAM. The selection
should be selected depending on the amount of the data to be recorded and
the recording device. That way the access time is better if only the RAM is
used. In case of larger quantities of data, however, it is usually necessary to
use the file store.
TwinCAT 3 Scope
Properties

 Project properties include:


 Start Record selects whether the recording should start on actuation of the
recording button (client start) or on receipt of a trigger event (trigger start).
TwinCAT 3 Scope
Properties

 Project properties include:


 Ring Buffer defines how a server is to react on reaching the end of the
recording time.
TwinCAT 3 Scope
Properties

 Ring Buffer active: the recording is not stopped; instead, the oldest data in
the memory are overwritten. The consequence is that the start time of the
recording increases. The recording is only stopped when the stop button is
actuated.
 Ring Buffer inactive: the recording is stopped on reaching the end of the
recording time. The recording can be terminated prematurely via the stop
button.
TwinCAT 3 Scope
Properties

 Chart properties include:


 Auto Start – Live display when recording
is started
 Default Display Time – Width of time to
display on the chart
 Time Bar – Displays the time values
across the bottom of the chart
TwinCAT 3 Scope
Properties

 Chart properties include:


 Tool Bar – Toggles the chart tool bar
which provides display controls for
viewing specific time periods and
zooming.
 It is also possible to start and stop the
display, which does not affect the
recording of the data.
TwinCAT 3 Scope
Properties

 Chart properties include:


 Border and Chart colors selections can
be made from either the color pallet tool
or directly with an RGB value
TwinCAT 3 Scope
Properties

 Chart properties include:


 Use X-Axis Grid: The X-subdivisions in
the chart can be switched on or off here.
 Use X-Axis SubGrid: Auxiliary lines for
the finer X-subdivision of the main grid
can be shown or hidden here.
TwinCAT 3 Scope
Properties

 Chart properties include:


 X-Grid Color: The color of the grid.
 X-Grind Line Width: Line width of the
grid in pixels.
 X-SubGrid Divisions: Number of areas
into which the main grid is subdivided by
auxiliary lines.
TwinCAT 3 Scope
Properties

 Chart properties include:


 Ticks: The number of subdivisions.
 X-Axis Color: The color of the X-axis.
 X-Axis Line Width: Line width of the axis
in pixels.
TwinCAT 3 Scope
Properties

 Chart properties include:


 Scale on Zoom: If this option is selected,
the chart instructs all axes (X and Y) to
perform auto scaling after a zoom or
panning action. As a result the selected
range may be expanded.
TwinCAT 3 Scope
Properties

 Chart properties include:


 Stacked Y-axes: With this setting you
can select whether the axes of a chart are
to be positioned next to each other in
order to display the values of the added
channels within the same area or whether
the axes are to be displayed above one
another in order to obtain a separate
display area for each.
TwinCAT 3 Scope
Properties

 Chart properties include:


 Y-Zoom: The behavior of a chart when
zooming can be set via the Y-Zoom. If the
option is set, you can navigate in the data
of a chart in the Y-direction as well. This
includes both zooming and panning
(shifting the display with the mouse).
TwinCAT 3 Scope
Properties

 Axis properties include:


 Comment: A free comment can be saved
here.
 Show Name: Defines whether the name
of the chart is shown in the graph.
TwinCAT 3 Scope
Properties

 Axis properties include:


 Grid Color: The color of the grid.
 Grid Line Width: Line width of the grid in
pixels.
TwinCAT 3 Scope
Properties

 Axis properties include:


 SubGrid Divisions: Number of areas into
which the main grid is subdivided by
auxiliary lines.
In the case of logarithmic scaling the
auxiliary lines for subdivision are shown
only in the set number if the range of
values per tick is precisely one decade.
Otherwise the displayed auxiliary line
shows the decades not displayed in the
main grid.
TwinCAT 3 Scope
Properties

 Axis properties include:


 Use Grid: The Y-subdivisions of the axis
can be shown or hidden here.
 Use SubGrid: Auxiliary lines for the finer
Y-subdivision of the main grid can be
shown or hidden here. Auxiliary lines
have no axis labelling.
TwinCAT 3 Scope
Properties

 Axis properties include:


 Auto Scale: If Auto Scale is active, each
axis is scaled such that the last-known
minimum and maximum of all connected
channels lie within the display range.
TwinCAT 3 Scope
Properties

 Axis properties include:


 Axis Max: If Auto Scale is inactive, the
maximum value can be edited directly.
 Axis Min: If Auto Scale is inactive, the
minimum value can be edited directly.
 Logarithmic: Switches between
logarithmic and linear scaling of the axes.
TwinCAT 3 Scope
Properties

 Axis properties include:


 Color: The color of the axis.
 Line Width: The line width in pixels.
TwinCAT 3 Scope
Properties

 Axis properties include:


 Ticks: Maximum number of subdivisions.
If there is not enough space for the
selected number of ticks, these are
automatically reduced in the chart.
In the case of logarithmic scaling the
number of ticks depends on the displayed
range of values and can thus deviate from
the settings.
 Visible: Specifies whether the axis is
shown or hidden in the chart.
TwinCAT 3 Scope
Properties

 Channel properties include:


 Array Length: If the connected symbol is
an array type, then the length of the array
is displayed here.
 Data-Type: The Data Type field sets the
data type of the signal. The Symbol Size
field is filled in accordingly.
TwinCAT 3 Scope
Properties

 Channel properties include:


 Disabled: The channel can be
deactivated in order to prevent it being
recorded. However, it is retained when
saving the configuration.
TwinCAT 3 Scope
Properties

 Channel properties include:


 Sample State: The signal to be recorded
can be sampled at the most with the
speed of the task to which it is connected,
(TaskSampleTime). However, a free
(larger) sample rate can also be set (Free
Sample). The maximum provided for here
is 5000 ms.
 Sample Time: If Free Sample is selected
the sample time can be entered here.
TwinCAT 3 Scope
Properties

 Channel properties include:


 Symbol based: Via the "symbol based"
option you can set whether a channel is to
be created via its symbol name or with
free acquisition.
TwinCAT 3 Scope
Properties

 Channel properties include:


 Symbol Index Group / Offset: The Index
Group and the Index Offset clearly define
the position of the signal in the task. They
can be edited by adding the prefix "0x" in
hexadecimal notation or without a prefix in
decimal notation. The display is always in
hexadecimal.
TwinCAT 3 Scope
Properties

 Channel properties include:


 Symbol Name: If a symbol name is
assigned for a signal, this can be entered
here. If "Symbol based" is inactive, the
connection parameters can be entered
manually.
 Symbol Size: Shows the size of the
variables in bytes. It depends on the data
type and therefore cannot be edited.
TwinCAT 3 Scope
Properties

 Channel properties include:


 Target Port: The port of the task to be
connected.
 Target System: The routes entered in the
System Manager can be selected from
the target system list.
TwinCAT 3 Scope
Properties

 Channel properties include:


 Use Local Server: The "Use local server"
option enables data to be recorded from
systems on which no Scope Server is
installed. In this case the local server
takes over the task of the remote server.
TwinCAT 3 Scope
Properties

 Channel properties include:


 Comment: A free comment can be saved
here. If applicable the comment will be
adopted from the connected ADS symbol.
 Visible: Here you can set whether the
channel should be displayed in the chart.
TwinCAT 3 Scope
Properties

 Channel properties include:


 Antialias: This option decides how the
lines will be drawn. Antialias is "nicer" but
requires considerably more computing.
This has an effect in particular if there are
many channels with large movements.
 Line Color: The color of the graph.
 Line Width: The line width of the graph.
The line width 1 requires least computing.
TwinCAT 3 Scope
Properties

 Channel properties include:


 Mark Color: The color of the base
markings.
 Marks: Selection of the visibility of
markings -> On (permanently visible) |
Auto (dependent on the zoom level) | Off
(markings switched off).
 Mark Size: The size of the base
markings.
TwinCAT 3 Scope
Properties

 Channel properties include:


 Bit Mask: In the Bit Mask field a value
can be entered with which the display
value is masked, provided it is not of the
type floating point. This means that the
value of the channel is ANDed with the
binary value of the mask. This helps you,
for example, to observe individual bits of a
status byte.
 Offset: A free offset can be added to the
function value of the channel in the offset
field.
TwinCAT 3 Scope
Properties

 Channel properties include:


 Scale Factor: The display value of a
channel can be changed with the scale
factor. This is useful, for example, if you
wish to display angle signals in degrees
instead of radians. With a scaling factor of
k = 360 / (2*Pi) = 57.296, therefore,
degrees would be displayed instead of
radians.
TwinCAT 3 Scope
Properties

 Channel properties include:


 Time Shift: The Time shift option enables
you to shift the graph along the time axis.
This can be useful, for example, if you
wish to compensate a known bus runtime.
TwinCAT 3 Scope
Properties

 Multiple Selection
 Some parameters are often
modified for several or all
elements. To do this you can mark
several elements via the Solution
Explorer and edit the settings of
all marked elements at the same
time. Data that differ between the
selected elements are
represented as empty fields.
 To make multiple selections, keep
the <Ctrl> key pressed during the
selection. In the case of
successive elements you can
select the first element, keep the
<Shift> key pressed and then
select the last element in order to
mark all elements in between.
TwinCAT 3 Scope
Agenda

 Scope History
 Installation
 Features
 General Features
 Product Levels
 Scope Details
 Target Browser
 Lab
TwinCAT 3 Scope
Target Browser

 With the target browser you can add Scope configuration channels via their symbol
names. The target browser is divided into two halves. The first shows a tree with
the first entry: ROUTES. Below that all devices registered in the System Manager
are shown. The color of the target indicates the system state: red = not reachable
(stop mode), blue = config. mode, green = system in run mode.
TwinCAT 3 Scope
Target Browser

 The second half shows a detailed list of the sub items of the selected element of
the tree structure.
TwinCAT 3 Scope
Target Browser

 In the list structure one or more channels can now be selected and added to the
configuration with a double click or by a right mouse click-> "Add symbol" ("Add
Subsymbols" ) or by one of the buttons in the toolbar.
 In addition, selected elements can be inserted by drag & drop to any place within
the configuration.
 If a folder, an Ads Bigtype or an array is selected that contains sub-symbols, the
"Add Subsymbols" option adds a channel for each sub symbol. The "Add symbol"
option inserts only one channel with the information of the selected symbol.
TwinCAT 3 Scope
Target Browser

 When selecting ‘Add Subsymbols’ for an NC Axis, a


predefined list of variables for that axis will be added to the
Scope
TwinCAT 3 Scope
Target Browser

 If a target computer is selected in the tree or list structure, the connected tasks
become visible. These are marked in color: green = PLC task, blue = NC task, red
= other.
 If a task is not displayed, then a selection menu can be called using the Enable
Server Ports option that displays the limitation to certain tasks.
TwinCAT 3 Scope
Agenda

 Scope History
 Installation
 Features
 General Features
 Product Levels
 Scope Details
 Cursor
 Lab
TwinCAT 3 Scope
Cursor

 Cursor
 A chart cursor can be added and changed via the cursor module.
TwinCAT 3 Scope
Cursor

 The cursor module (listed in each chart element as "cursor") offers the following
setting options:

 Delta Values: If several cursors are used in one direction the differences can be
displayed if Delta Types is activated.
 Hex Values: Hexadecimal notation of the average values of the individual
channels.
TwinCAT 3 Scope
Cursor

 Each X/Y-cursor within the cursor module offers its own setting options
 Color: Color of the cursor.
 Comment: A comment can be saved here.
 Line Width: Line width of the cursor in pixels.
TwinCAT 3 Scope
Cursor

 The values are displayed in the cursor window


 Right-Click on ‘Scope Project’ and select
‘Cursor Window’
TwinCAT 3 Scope
Cursor

 Status Times
 The times belonging to an added X-cursor
are displayed here in three formats.
 Absolute Position: Corresponds to the
actually registered time.
 Record Position: Time value of the cursor
since the beginning of the recording.
 Chart Position: Time value of the cursor
within the recording.
TwinCAT 3 Scope
Cursor

 Channel
 The average values of the individual
channels are displayed with the respective
X-cursor in the Channel field. The
displayed average values are, like the
display, compromised to pixel width. You
can zoom into the recording in order to
indicate the intermediate values.
TwinCAT 3 Scope
Cursor

 Axis
 The values of the Y-cursors on the
respective axes are indicated in the lowest
field.
TwinCAT 3 Scope
Agenda

 Scope History
 Installation
 Features
 General Features
 Product Levels
 Scope Details
 Trigger
 Lab
TwinCAT 3 Scope
Trigger

 Different trigger functions can be added to the Scope configuration.


 In order to enable the simplest possible and free combination of individual trigger
conditions and actions, these are combined into trigger groups.
TwinCAT 3 Scope
Trigger

 Trigger groups and trigger sets can be added via the trigger context menu.
 Right-Click on ‘Trigger’ and select ‘New Trigger Group’
TwinCAT 3 Scope
Trigger

 Trigger Action
 Start Record: If this option is selected, the start record condition in the Scope
settings should be set to trigger start. Otherwise the Scope would start recording as
usual. With setting this action, therefore, a question box appears that carries out
this setting if necessary. If you actuate the record button in the menu bar, the
Scope connects itself as usual to the servers involved and starts to sift through the
connected channels, but without starting the actual recording. The recording begins
with the trigger time of the last trigger set condition.
TwinCAT 3 Scope
Trigger

 Trigger Action
 Stop Record: If the stop action is selected, the Scope should be operated in the
ring buffer mode. With setting this action, therefore, a question box appears that
carries out this setting if necessary. In the field below you can specify whether a
fixed time range should appear in the recording before and/or after the trigger
event. If pre-trigger is selected, trigger events before the expiry of this time are
ignored. If post-trigger is active, the recording runs for the specified time after
receipt of the trigger event.
TwinCAT 3 Scope
Trigger

 Trigger Action
 Stop Display: The stop display action stops all Scope charts that are in live mode
at the point of triggering. With the trigger position you can select how many percent
of the display shown (display width) are to be located before or behind the trigger
event (in the example: positive 0-crossing of the green signal at 10% of 2.5 s = 0.25
s). If the trigger condition is fulfilled again, the display jumps to this new event.
Pause can be actuated in the chart in order to prevent this retriggering.
TwinCAT 3 Scope
Trigger

 Trigger Action
 Restart Display: All charts paused due to a Stop Display trigger are resumed on
fulfilment of the trigger condition.
TwinCAT 3 Scope
Trigger

 Trigger Action
 Start Subsave: On the occurrence of this trigger event a background recording is
started with the current configuration. This sub save always runs in the ring buffer
mode (independent of the settings in the Scope settings). It is possible to start up to
5 sub saves simultaneously (via one or more trigger events). The maximum
memory capacity of the sub save can be specified in the 'Record Time' field. This
recording duration may also be longer than the recording duration of the basic
configuration (in this case ring buffer operation should also be selected).
TwinCAT 3 Scope
Trigger

 Trigger Action
 Stop Subsave: Following the Stop Subsave trigger event, the oldest sub save is
stopped and transferred to the View in the background. From here it is saved in a
.svd file via the specified path. The generated file name consists of the name of the
Scope in the basic configuration and an ID composed of the date and time, in
alphanumeric order.
TwinCAT 3 Scope
Trigger

 Each trigger set can be regarded as an independent trigger condition.


 The action report of the trigger group defines what happens when a trigger group is
triggered.
TwinCAT 3 Scope
Trigger

 The trigger set offers the following setting options:


 Channel: A channel is assigned to each set whose state is to be checked for the
selected trigger condition
 Combine: By selecting a logic operation these individual conditions can be placed
in relation to one another. Note here that AND operations are handled before OR
operations.
TwinCAT 3 Scope
Trigger

 The trigger set offers the following setting options:


 Hit: indicates whether the trigger set has been triggered ( ) or not ( ).
 Release: The release condition can be either a rising or falling edge.
 Threshold: The associated limit value.
TwinCAT 3 Scope
Trigger

 As soon as a trigger set is triggered, the icon in the Solution Explorer changes from
to
 All trigger sets remain set until the entire trigger group has triggered.
TwinCAT 3 Scope
Trigger

 Manual triggering of trigger set


 Triggers can be manually triggered for test purposes via the trigger set context
menu item "Manual Trigger Hit".
TwinCAT 3 Scope
Agenda

 Scope History
 Installation
 Features
 General Features
 Product Levels
 Scope Details
 Exporting Data
 Lab
TwinCAT 3 Scope
Exporting Data

 Recorded data can be saved in a scope data file (.svd). Alternatively data can be
exported in .csv, .txt or a binary format after stopping the current recording.
 Right-Click on ‘Scope’ and select ‘Export to CSV’ or ‘Export to Binary’
TwinCAT 3 Scope
Exporting Data

 Export to CSV:
Text export in order to be able to use the Scope data in other programs as well.
The generated file is held in the table format. The rows are separated by lines and
the columns by tabulators. The first rows contain information about the recording,
such as Scope name or start and the end time of the recording.
TwinCAT 3 Scope
Exporting Data

 Afterwards a definition range with the acquisition data follows for each channel.
TwinCAT 3 Scope
Exporting Data

 Finally a list with the recorded data follows for each channel. First the time value as
an offset of the start record time, then the corresponding data value.
TwinCAT 3 Scope
Exporting Data

 Export to Binary:
The binary data format is based on the text format, but contains no separators.
Instead the byte lengths of all variable data types (such as character strings) are
contained in the corresponding headers. All times are specified in the file time
format: 1tick = 100ns; origin is 1/1/1601 0h.
TwinCAT 3 Scope
Agenda

 Scope History
 Installation
 Features
 General Features
 Product Levels
 Scope Details
 .Net API
 Lab
TwinCAT 3 Scope
.Net API

 Integration of the ScopeViewControl in your own applications


 In order to achieve high ease of integration, the TwinCAT Scope is subdivided into
components. The separation of Scope View and Scope Server, for example, is
visible. Beyond that the Scope View is based on the ScopeViewControl, which is
similarly usable as an independent component. The ScopeViewControlLib
developed in .NET is available with the installation of TwinCAT 3.1 from version
4006. In this way simple integration is possible in C#, VB.Net or WPF applications.
TwinCAT 3 Scope
.Net API

 Requirements
 The ScopeViewControl requires .NET Framework 4.0.
 Click on the project with the right mouse button and select "Properties".
 The target framework ".NET Framework 4" must be selected under
"Application".
 The ".NET Framework 4 Client Profile" is not supported.

 Further information can be found in the TE13xx TwinCAT 3 Scope View


documentation
 TwinCAT 3 Scope View
TwinCAT 3 Scope
Agenda

 Scope History
 Installation
 Features
 General Features
 Product Levels
 Scope Details
 Lab
TwinCAT 3 Scope
Lab

 In order to allow a fast startup and to simplify work with the TwinCAT 3 Scope
software oscilloscope, the first steps are briefly described. We have consciously
avoided dealing with every detail. For example, trigger-controlled recordings and
the creation of reports are not subjects of this documentation.
TwinCAT 3 Scope
Lab

 1. Installation:
For basic understanding is important to know that a Scope Server is always
installed with a Scope View, since otherwise no saved data can be displayed locally
in the View. Conversely, the Scope component installation can also install the
Server without View on a target device.
 2. Licensing:
Regardless of whether the Scope View was installed by its own setup or by the
TwinCAT 3 XAE setup, the initially activated license is "Base" for View and Server.
You can find out here which functions are enabled with which license key.
TwinCAT 3 Scope
Lab

 3. New project:
The Scope View can be selected under Beckhoff in the Windows Start Menu.
TwinCAT 3 Scope
Lab

 The Visual Studio opens in its shell or in a full version if installed. You can choose
between various templates. For this demo please select ‘Measurement Scope
Project’ and click ‘OK’
TwinCAT 3 Scope
Lab

 In the Solution Explorer the starting point for the new Scope configuration
assembles itself automatically.
TwinCAT 3 Scope
Lab

 4. Selection of channels:
Variables or channels now have to be added to the generated configuration. These
can be selected via the target browser. When using for the first time it is possible
that this will not be directly visible as a window in Visual Studio. The target browser
can be selected in the context menu with a right-click on the Scope node.
TwinCAT 3 Scope
Lab

 Alternatively the target browser can also be selected via the Scope menu in Visual
Studio. Once the target browser has opened, the window can be docked in any
position in the user interface. It is possible to select the desired variables by
browsing into the respective target system.
TwinCAT 3 Scope
Lab

 The variables can be selected by multi-select and added to the configuration by


right-clicking on "Add symbol" or by drag & drop.
TwinCAT 3 Scope
Lab

 The selected channels are assigned to the last-selected axis. In this case only one
axis is present.
TwinCAT 3 Scope
Lab

 5. Recording:
Prior to a recording the basic recording settings must be made in the Scope
Properties. Standard is a ten-minute recording which is started manually and
automatically stopped after the respective time. The settings for all hierarchical
levels – Scope, Charts, Axis and Channel – as well as for trigger and cursor can be
made in the standard Property window of Visual Studio. A simple click on the
corresponding element in the Solution Explorer is sufficient, provided that the
Property window has already been opened first under View in Visual Studio.
TwinCAT 3 Scope
Lab

 If the standard settings are left as they are, the recording can be started. To this
end the Scope toolbar must be opened when using for the first time.
In Visual Studio > View > Toolbars > TwinCAT Measurement.

 The recording is started by clicking on the icon with the red recording symbol.
TwinCAT 3 Scope
Lab

 6. During the recording:


In order to improve the display of the channels in the View, charts and axes can be
added even during the recording in TwinCAT 3 Scope View and channels can be
shifted within the Scope.
 X and Y cursors can also be added and deleted at runtime.
 An important feature is the possibility to stop the display of the current recording
while the recording of the data continues to run in the background. Once the display
is stopped you can zoom into the data and analyze the signal curve with the
cursors at your leisure.
TwinCAT 3 Scope
Lab

 7. Stopping the recording and saving the data:


In this case the started recording is stopped automatically on expiry of the recording
time of ten minutes. Alternatively the recording can of course be ended manually at
any time via the stop button in the Scope toolbar. The recorded data are only
consistent if they are stored as a .svd file. Click on the Scope menu in Visual Studio
and select Save Data.
TwinCAT 3

Beckhoff TwinCAT 3
Remote Connections

TWINCAT 3

Beckhoff TwinCAT 3
Remote Connections

 In the ‘Solution Explorer’, select ‘System’

Beckhoff TwinCAT 3
Remote Connections

 On the ‘TwinCAT Project’ tab, click ‘Choose Target’

Beckhoff TwinCAT 3
Remote Connections

 In the ‘Choose Target System’ dialog box, click on ‘Search


(Ethernet)…’

Beckhoff TwinCAT 3
Remote Connections

 In the ‘Add Route Dialog’ dialog box, click on ‘Broadcast


Search’

Beckhoff TwinCAT 3
Remote Connections

 Select the Target Computer


 Set the Address Info to ‘IP Address’ and select ‘Add Route’

Beckhoff TwinCAT 3
Remote Connections

 Provide an Administrator level User name and Password


 Press ‘OK’

Beckhoff TwinCAT 3
Remote Connections

 An ‘X’ may or may not


appear in the
‘Connected’ column
 If there was no Error
given press the ‘Close’
button
 The 2 possible errors
are caused be either a
lost connection, or an
incorrect password
Beckhoff TwinCAT 3
Remote Connections

 In the ‘Choose Target System’ dialog box, select the target


system, then press ‘OK’

Beckhoff TwinCAT 3
Remote Connections

 On the ‘TwinCAT Project’ tab there are now tabs for both
‘Local’ and ‘Target’
 On the ‘Settings (Target)’ tab, the ‘Auto Boot’ and ‘Auto
Logon’ settings can be changed

Beckhoff TwinCAT 3
Remote Connections

 It is possible to open the project that is running on the


remote system
 You must first start with an empty solution explorer.
 Either close TwinCAT and reopen it, or go to the ‘File’
menu, and select ‘Close Solution’.

Beckhoff TwinCAT 3
Remote Connections

 In the ‘File’ menu


 Go to ‘Open’
 Then select ‘Open Project From Target’

Beckhoff TwinCAT 3
Remote Connections

 In the ‘Choose Target System’ dialog box, select the target


system, then press ‘OK’

Beckhoff TwinCAT 3
Remote Connections

 Select a Location to Save the project


Note: This is opening the project from the target device and
saving a local copy of it.

Beckhoff TwinCAT 3
Remote Connections

 The project will be added to the


‘Solution Explorer’

Beckhoff TwinCAT 3

You might also like