TwinCAT Basic Training
TwinCAT Basic Training
AUTOMATION TECHNOLOGY
(TwinCAT)
EXERCISES BASIC TRAINING
1
Contents
Contents…………………………………………………………………………………………………………………………………………….2
TwinCAT 2:
TwinCAT 3
2
PLC Exercise 1: Auto Scanning of Hardware
1) Start TwinCAT System Manager
2) Create a new TSM file. Click File >> New
3) Select Local Target. Click [Choose Target]
4) Ensure TwinCAT in Config Mode. Click Actions >> Set/Reset TwinCAT to Config Mode
5) Scan Devices. Right click on I/O device, select “Scan Devices”
6) Scan Boxes to auto-detect couplers and IO terminals.
7) Activate Free Run to perform I/O check
8) Now Test all individual I/O points
9) Save the TSM file into Desktop\Exercise folder
1) In System Manager, right click on “PLC Configuration” and select “Append PLC project”
2) Select project information file *.TPY
3) Select desired I/O process image and link to corresponding PLC Variables.
3
Din0 EL1012, Channel 1, Input
Din1 EL1012, Channel 2, Input
DOut0 EL2004, Channel 1, Output
DOut1 EL2004, Channel 2, Output
AIn0 EL3102, AI Standard Channel 1, Value
AOut0 EL4102, Channel 1, Output
4
5) Call the Blinker function block in Main Program
5
PLC Exercise 6: Configuring Auto-startup Boot Project setting
1) In the System Manager, select “System configuration”. Click on the “Boot Settings” tab.
6
PLC Exercise 7: Downloading Source Code
1) Project >> Options…
7
PLC Exercise 9: Uploading System Manager file from Target System
1) File >> Open from Target
8
PLC Exercise 11: Auto Scanning of Hardware
1) Start TwinCAT3 XAE. Click START>> All Programs >> Beckhoff >> TwinCAT3 >> TwinCAT XAE.
2) Create a new XAE project. Click File >> New >> Project
3) Select “TwinCAT XAE Project (XML Format)” template
4) Enter the Project name : “Tc3Exercise”
5) Choose “Local” as Target System
6) Ensure TwinCAT in Config Mode. TWINCAT >> Restart TWINCAT (Config Mode)
9
7) Scan Devices. Right click on I/O device, select “Scan”
10
4) Declare global variables for I/O. You may use the Auto Declare wizard to assist you. Click
EDIT >> AUTO DECLARE
VAR_GLOBAL
bDin1 AT %I*: BOOL;
bDin2 AT %I*: BOOL;
bDin3 AT %I*: BOOL;
bDin4 AT %I*: BOOL;
END_VAR
Recommend to follow Programming Convention for creating IEC61131-3
(http://infosys.beckhoff.com/english.php?content=../content/1033/tcplclibsoverview/html/
tcplclibsprogrammingconventions.htm&id=13132)
11
PLC Exercise 13: Linking the Variables and Activate Configuration
1) Linking the Variables. Right click on the Channel1 Input of EL1012, select “Change Link”
2) Select desired I/O process image and link to corresponding PLC Variables.
3) Activate the Configuration. Click TWINCAT >> Activate Configuration. Enter the Security
code if prompted.
12
PLC Exercise 15: Creating Function Block
1) Add Function Block under POUs (Program Organization Units). Right click on the POUs
folder, select Add >> POU.
3) Browse into the Toolbox, insert TON (Timer with On-delay) into the network rung.
13
4) Enter the variables name into the “???”
5) Right click on the ET (Elapse Time) output of TON, select “Set output connection”.
6) Complete the FB accordingly
7) In the variable declaration of MAIN, define fbFlash1 function block using Auto Declare
14
8) Call the fbFlash1 function block in the MAIN program using Input Assistant [F2]
15
PLC Exercise 16: Configuring Auto Start Boot Project
1) Right click on the Exercise1, select “Autostart Boot Project”
2) Double click on the System Node. In the Settings tab, check “Run Mode (Enable)” radio
button. Then, click “Apply” button.
3) When prompted with the User name and password. Username: Administrator, Default
Password : 1
4) Activate Configuration
5) Login to the PLC. Click PLC >> Login
6) Start the PLC program. Click PLC >> Start.
16
2) To upload the Source code, click File >> Open >> Open Project From Target.
17
PLC Exercise 19: Establishing a remote connection
1) Double click on “SYSTEM-Configuration”.
18
4) If Host name or IP address is known, this can be entered directly. Otherwise, perform a
“Broadcast Search”.
5) After selection of a device from the list, the route can be added
19
6) Select the Target sytem
20
Support, Service, Training:
21