Beckhoff Training Series

TR1020 ± PLC Basic Day 1

12150 Nicollet Avenue South / Burnsville, MN 55337 / 877 TWIN-CAT (877 894-6228)

12150 Nicollet Avenue South / Burnsville, MN 55337 / 877 TWIN-CAT (877 894-6228)

2

©2008 Beckhoff Automation GmbH This document is not to be replicated in part or in whole, either electronically, by copy machine, photographically, or by scanning without the written consent of Beckhoff USA. Beckhoff Automation LLC 12150 Nicollet Avenue South Burnsville, MN 55337 877 894-6228 beckhoff.usa@beckhoff.com
Version: 080717

12150 Nicollet Avenue South / Burnsville, MN 55337 / 877 TWIN-CAT (877 894-6228)

3

Table of Contents
Introduction ........................................................................................................ 5
Beckhoff Automation .............................................................................................................. 5

Product overview ............................................................................................... 6
Tasks and how they work with each other. .............................................................................. 7

I/O ........................................................................................................................ 8
A Box (Unit)............................................................................................................................ 8 Bus Couplers.......................................................................................................................... 8 Bus Terminals ........................................................................................................................ 9

Installation of the TwinCAT Suite ................................................................... 10
Download and Install .............................................................................................................10 CD Install ..............................................................................................................................10 Licensing ...............................................................................................................................15

Tour of the TwinCAT Environment ................................................................. 16
Components..........................................................................................................................16 TwinCAT, making Windows a Real-Time Operating System ..................................................17 Real-Time Computing............................................................................................................17 Kernel ...................................................................................................................................17 Tick .......................................................................................................................................17 Latency .................................................................................................................................18

Configuring Hardware with TwinCAT System Manager ................................ 19
Lab 1: Append and Scan .......................................................................................................21 Working Directory ..................................................................................................................21 Hardware Configuration.........................................................................................................21

System Manager In-depth................................................................................ 24
Icon and Menu Item Descriptions...........................................................................................24 Menus ...................................................................................................................................25

Testing Configured Hardware ......................................................................... 29
Lab 2: Testing I/O ..................................................................................................................30

PLC programming with TwinCAT PLC Control.............................................. 33 TwinCAT PLC Control ...................................................................................... 35
Lab 3: TwinCAT PLC Control Familiarization .........................................................................36

Connecting the PLC Program to the Hardware ............................................. 40
Lab 4: Putting it all together ...................................................................................................40 Hardware Configuration.........................................................................................................40 Launching the PLC ................................................................................................................43

Documentation ................................................................................................. 45
Beckhoff Information System .................................................................................................45

Other resources................................................................................................ 47
www.beckhoff.com ................................................................................................................47 PC Control ............................................................................................................................47 Main Catalog .........................................................................................................................47 Products & Solutions .............................................................................................................47 General PLC Information .......................................................................................................47

Glossary ............................................................................................................ 48

12150 Nicollet Avenue South / Burnsville, MN 55337 / 877 TWIN-CAT (877 894-6228)

4

12150 Nicollet Avenue South / Burnsville, MN 55337 / 877 TWIN-CAT (877 894-6228)

5

Introduction
Beckhoff Automation
Beckhoff Automation provides advanced and open automation products based upon proven industrial technologies. Beckhoff customers can implement high performance control systems faster and at a lower overall cost than traditional PLC and motion control systems. Beckhoff¶s ³New Automation Technology´ product range includes PC based control software, industrial PCs, automation controllers, operator interface hardware, distributed I/O, industrial Ethernet products, servo drives and motors. Sales and service are handled directly, with no intermediaries involved to provide faster response and improved technical support. What is TwinCAT? The windows Control and Automation Technology. The TwinCAT suite was put together by Beckhoff Automation to be a complete development environment for writing, editing and debugging PLC programs. TwinCAT includes support for five industry standard programming languages plus a new variant of FBD. Any of these languages (or combination thereof) may be employed to complete your program. TwinCAT empowers beginner and advanced programmers alike through the use of libraries. Libraries contain support code that save the programmer research time. Code that normally would have been written from scratch now becomes a call to a specific library. TwinCAT has a built-in software PLC so programs can be tested without connecting to the actual hardware. Furthermore, another program called TwinCAT Scope View is included that offers a graphical analysis of the program¶s variables which can help with troubleshooting and fine-tuning a program, as well as aid in tuning servo systems. TwinCAT also allows for integration through the use of an interface system that makes it possible to interact with the PLC from other programming environments such as Microsoft Visual Studio .net using standard DLL and OCX architecture. TwinCAT can also be used to exchange data with other systems for example, values in an Oracle database can be called by TwinCAT and the resulting instruction sent over the network to yet another system for processing.

PROFIBUS DP/MC. SERCOS.12150 Nicollet Avenue South / Burnsville. convenient debugging Product overview .8 GHz) for 1. LD. flags area. CANopen. CE Real-time Beckhoff real-time kernel I/O System EtherCAT. Lightbus. FBD. SFC.000 PLC commands Programming IEC 61131-3: IL. ST. Ethernet and PC hardware Run-time System 4 multi-tasking PLCs each with 4 tasks in each PLC run-time system. number of variables only limited by the size of the user memory (max. MN 55337 / 877 TWIN-CAT (877 894-6228) 6 Software PLC TwinCAT PLC PC Hardware Standard PC/IPC hardware. no extras Operating Systems Windows NT/2000/XP. program size. POU size. development and run-time systems on one PC or separately (CE: only run-time) Memory Process image size. DeviceNet. NT/XP Embedded. 2 GB with NT/2000/XP) Cycle Time Adjustable from 50 µs Link-time 1 µs (Pentium® 4 2. Interbus. powerful library management.

MN 55337 / 877 TWIN-CAT (877 894-6228) 7 Tasks and how they work with each other. users are encourage to take classes in the two disciplines mentioned above to better grasp the concepts presented here. . Though someone with any level of knowledge will benefit from the instruction in this manual.12150 Nicollet Avenue South / Burnsville. NOTE: This manual assumes basic to intermediate knowledge of Windows based computers and basic programming knowledge.

refers to communication between a computer and its users. These devices and more act as liaisons between the computing device (computer or embedded CPU) and the machines. LC and BX always ends with 00 Example of a Low Cost PROFIBUS Bus Coupler.12150 Nicollet Avenue South / Burnsville. Generally speaking. BK ± no onboard processor.g. systems (database. BX ± eXtended. Model numbers are a two-letter code followed by a two-digit type code followed by a two-digit form code. RS232/RS485. Bus Couplers There are a number of different Bus Couplers. and whether the communications are synchronous or asynchronous. MN 55337 / 877 TWIN-CAT (877 894-6228) 8 I/O I/O. 91 ± Ethernet TCP/IP 95 ± USB Form codes: 00 ± Standard 10 ± Economy 20 ± Economy Plus 5x ± Compact (BC and BK only. This will be important in determining what I/O components and infrastructure will provide the best results given the infrastructure budget.) and other computing devices in your facility. You can use the catalog (described in the next section) to explore the different components available. In simplistic terms. a device receives Input and delivers Output. I/O components include Bus Couplers (Ethernet. . etc. Some number of Bus Terminals (dependent on the model of Bus Coupler and available extension hardware) and one end terminal. low ink alert). Fieldbus components basically describe how the controller connects to what is being controlled. etc. other computers (via a network) or attached hardware. needs a PC to function. latency. we usually are referring to fieldbus components when we talk about I/O. or Input/Output. But keep in mind that what is defined as Input or Output can change depending on what is being discussed and the particulars of the interaction. Letter codes: BC ± onboard processor. The terminals handle the individual inputs and outputs while the Bus Coupler handles communication between the terminals and between the Unit and the fieldbus. In the Beckhoff world.) and Bus Terminals (digital and analog input/output). for example a printer receives Input from a computer (what to print) but the computer can also receive Input from the printer (e. its storage devices. the program to control an assembly activity uses fieldbus components to ³talk´ to the assembly machinery. supporting different types of communication and other specifics. has extra communication ports. fiber optic. can run in isolation. PROFIBUS. LC ± Low Cost Type codes: 11 ± EtherCAT 2x ± Lightbus 3x ± PROFIBUS 4x ± Interbus 51 ± CANopen 52 ± DeviceNet 70 ± ControlNet 71 ± CC-Link 73 ± Modbus 74 ± Fipio 75 ± SERCOS 80 ± RS485 81 ± RS232 90. A Box (Unit) A unit consists of a Bus Coupler. Important aspects of I/O that will be discussed later are: throughput. BK9100 would describe a standard Ethernet Bus Coupler without onboard processor.

One place to begin thinking about appropriate components is the difference between KLxxxx (standard) Bus Terminals and ELxxxx (ultra high-speed) EtherCAT Bus Terminals. separating digital from analog I/O slices. terminals are color coded for quick identification: Yellow (XX1xxx) ± Digital Input Red (XX2xxx) ± Digital Output Green (XX3xxx) ± Analog Input Blue (XX4xxx) ± Analog Output (XX5xxx) ± Sensor (XX6xxx) ± Communication (XX7xxx) ± Power Terminal (XX9xxx) ± Power Terminal Two important Power Terminals are the KL9510 which breaks the power loop.12150 Nicollet Avenue South / Burnsville. So a standard. and the KL9010 Bus Terminal which closes the electrical loop and must be the very last slice (or the last slice of the last chained box). MN 55337 / 877 TWIN-CAT (877 894-6228) 9 Bus Terminals Terminals come in a number of varieties as well. . depending on the needs of the system. Regardless of the model. four channel. Model numbers are a two-letter series code followed by a single-digit type code followed by a two-digit sub-model code and ending with a single-digit channel code. digital input will have the model number of: KL1xx4.

y Find where the installer was saved (probably the desktop).exe. y Go into the TwinCAT folder and double click on Setup. y Double click on the file« Welcome ± Click the Next button and then follow the instructions on the next page. right click on the CD drive (it might be titled BECKHOFF) and select Explore.beckhoff. MN 55337 / 877 TWIN-CAT (877 894-6228) 10 Installation of the TwinCAT Suite The TwinCAT Suite is free to download but requires a serial number after 30 days. . This will help guarantee that your organization does not experience downtime. y You will receive an email from Beckhoff with a link. y Enter all the fields with a red arrow with real data and click the Register button.12150 Nicollet Avenue South / Burnsville. even during a holiday. Click the link to download TwinCAT. CD Install To install from the CD: y Insert the Beckhoff Software Products CD. The file should start with ³tcat_´ followed by the version number. Download and Install To download TwinCAT: y Go to www. y Close the browser which will automatically launch.com (enter this URL with the ³www´). y Click on TwinCAT (30 days version). y Go into My Computer. y Click on Download on the left hand side of the screen.

click the Yes button. . License Agreement ± after reading the entire agreement. MN 55337 / 877 TWIN-CAT (877 894-6228) 11 Choose Setup Language ± make sure English is highlighted and click the Next button. Welcome ± press the Next button.12150 Nicollet Avenue South / Burnsville.

select 30 days demo version (you can register later) and click the Next button. CP ± Contains the necessary components for the special functions (S-Keys. Select Installation Type ± for now. MN 55337 / 877 TWIN-CAT (877 894-6228) 12 Customer Information ± verify your information. If you have the serial number enter it here.) of the Beckhoff Control Panels. IO ± The (User Mode) Program can directly access the IO Devices. otherwise just click the Next button. NC PTP ± Enhances PLC with the NC/CNC functionality to control the PTP-Axis. etc.12150 Nicollet Avenue South / Burnsville. . PLC ± includes the IEC61131-3 Software Development kit. This Level does not include the PLC. Select Installation Level ± select the TwinCAT PLC radial button and click the Next button. you will be able to enter the serial number later. NC I ± Enhances PLC with the NC functionality for interpolated drives in 3D.

Can be installed with TwinCAT PLC or TwinCAT NC PTP (see Installation Levels above). TwinCAT EDS and GSD Files ± The EDS (DeviceNet) and GSD (characteristic master device file. Choose Destination Location ± click the Next button. and click the Next button. MN 55337 / 877 TWIN-CAT (877 894-6228) 13 Select Features ± select the first four components as shown. Profibus) makes all the settings available to the user for the configuration of the system. TwinCAT Remote Manager ± Support for managing several different versions of the TwinCAT system manager and of TwinCAT PLC control. Select Program Folder ± click the Next button. . TwinCAT IO ± Allows the direct access to IO via a DLL. TwinCAT Scope View ± Diagnostic tool (see Scope View section near the end of this manual). TwinCAT Cam Server ± Fast Cam Server.12150 Nicollet Avenue South / Burnsville.

Click the Next button. MN 55337 / 877 TWIN-CAT (877 894-6228) 14 Information System ± after the installation of TwinCAT. Choose Destination Location ± click the Next button. Select Features ± deselect Deutsch if you want to save space and click the Next button. .12150 Nicollet Avenue South / Burnsville. InstallShield Wizard Complete ± it is recommended that you select Yes and click the Finish button to restart the computer and complete the installation. the TwinCAT Information System is automatically installed.

12150 Nicollet Avenue South / Burnsville. feel free to call 877 TWIN-CAT (877 894-6228) for assistance. copy it and paste it into an email. MN 55337 / 877 TWIN-CAT (877 894-6228) 15 Licensing TwinCAT must be licensed by entering a Registration Key or it will expire and cease to run 30 days after installation. This can be copied and pasted in the Registration field. Select the ID. Add your P. Select the Registration tab.O. To find your System ID. The System ID should be in the System ID field. First. . Within 24 hours (not necessarily including weekends and holidays) you should receive back a new Registration Key. click on the TwinCAT icon in the system tray and select Properties. If you have any questions. find and record your System ID. number from purchasing the software (if you have it) and send it to your Inside Sales representative.

3. select Programs (or All Programs). Click the Start button. double click on the C: drive (might be different if a different drive was specified during installation). TwinCAT System Manager and TwinCAT PLC Control are the two programs that will be used the most. TwinCAT PLC Control is where the program is written and TwinCAT System Manager is where the hardware connections are configured. The TwinCAT programs can be launched in a number of ways: 1. TwinCAT PLC Control is the programming environment. .12150 Nicollet Avenue South / Burnsville. TwinCAT System Manager is used to configure the hardware and ultimately to attach or download the PLC program to the hardware. It is also used to connect to a training/test station so that programmers can practice and test how the program interacts with inputs and outputs. Double click on TwinCAT: a. TwinCAT System Manager is found in the Io folder and is called: TCatSysManager. 2. TwinCAT PLC Control is found in the PLC folder and is called: TCatPlcCtrl. This is where the actual PLC program is written.exe As mentioned in number 3 above.exe b. Double click on My Computer on the desktop (sometimes found by clicking the Start button). MN 55337 / 877 TWIN-CAT (877 894-6228) 16 Tour of the TwinCAT Environment Components There two main components to creating a PLC program in TwinCAT: TwinCAT PLC Control and TwinCAT System Manager. A third component. select TwinCAT System and select the program needed. the TwinCAT System Service acts as the liaison between the program and the connected hardware on a PC that is being used as the controller. Click the TwinCAT icon in the system tray then select the application needed.

This is because Microsoft¶s kernel is built for compatibility and TwinCAT is built for perfect timing. When TwinCAT is installed. four tasks can be run in order. Next we will look at what is required of a computer system to achieve this and TwinCAT¶s role. Tick The smallest clock unit considered by a computer is called a tick (sometimes referred to as a runtime). allocating space within each tick for TwinCAT operations before handing control back to Windows. Furthermore. MN 55337 / 877 TWIN-CAT (877 894-6228) 17 TwinCAT. Almost every automation application has at least a safety aspect and many have the potential for very expensive mistakes. PCs respond when they get around to it. Microsoft¶s kernel is taken over by TwinCAT. If more than one task is running but one task does not finish or does not even start. the initial state of the system must always be exactly predictable. This can be described as always getting the expected result given the exact same input. If the task isn¶t done. Another concept that is related here is deterministic computing. By default. it is resumed at the beginning of the next tick from where it had stopped. at minimum. This allows the PC to operate in a deterministic. whenever you do anything on a computer. And within each task. the RAM and the processor are accessed. it runs first at the beginning of the next tick. Normally the Windows OS decides what to do in each tick. Within each portion of each tick governed by TwinCAT. Within each tick (see below).12150 Nicollet Avenue South / Burnsville. TwinCAT reserves 80% of each tick but this can be configured up to 90% in the Realtime Settings. in a real-time system. Real-Time Computing Real-time computing basically means that there is a deadline to when the system responds after a request. the kernel handles these access requests. Within each runtime. but is usually described in milliseconds. When TwinCAT is installed. TwinCAT regulates how system resources are allocated. Kernel The kernel is the part of a computer¶s operating system that links hardware to software. Conversely. . no matter what the program. making Windows a Real-Time Operating System The importance of precise timing cannot be stressed enough in automation. Leaving the control of a system up to the unpredictability of Windows could be catastrophic. a number of Projects (determined by the processor) can be run in alphabetical order. TwinCAT always gives control back to Windows at the end of the tick. real-time way. RAM and other variables. For this to happen. Beckhoff¶s patented RT (real-time) kernel is capable of surviving crashes and ³blue screens´ since it runs outside of the Windows operating system. up to four runtimes can be run in order. In other words. The actual length of the tick is dependent on processor speed. it takes over control. the system must process the request in a given timeframe. Normally. TwinCAT effectively turns a Windows computer into a real-time computer.

12150 Nicollet Avenue South / Burnsville. Latency Latency describes the time it takes the system to respond to a request. Then click on the TwinCAT icon again and select Realtime Settings. The actual latency is displayed dynamically in the Realtime Setup (see Tick above). MN 55337 / 877 TWIN-CAT (877 894-6228) 18 To change the settings the Realtime System must be running. Click on the TwinCAT icon in the system tray and select Start. some latency is unavoidable. In the lower left-hand corner is the Actual System latency field that continuously updates as it monitors the computer processor. This is showing how late the central system tick arrived. . Even though every attempt is made to control the behavior of the system.

PLC . This is a generic list and does not necessarily reflect what interfaces might actually exist. Devices are grouped by type which can be expanded to show specific devices. Different options will be listed depending on what was installed. When looking at the left pane of the System Manager window. a list of devices that can be inserted appears.12150 Nicollet Avenue South / Burnsville.Configuration ± Describes how the system will run.Configuration ± Describes what hardware is attached and specifies communication parameters. If using an older version. Everything from I/O . but the common configurations are: SYSTEM . These instructions are for version 2. . the system must be in Config Mode before an interface can be appended.8 and up. only one device can be selected at a time.Configuration is software related. I/O . Since hardware constitutes I/O. MN 55337 / 877 TWIN-CAT (877 894-6228) 19 Configuring Hardware with TwinCAT System Manager Two operations are performed when attempting to identify and configure hardware connected to the computer being used for programming and/or acting as the PLC: Append and Scan. Everything above I/O .Configuration ± Describes how the PLC program will run. Each interface has to be added separately and will be listed under I/O Devices under I/O . please contact your support person for help.Configuration on down is hardware related. Though there may be multiple interfaces attached to the computer. When System Manager is told to append a device. particularly how it will run autonomously.Configuration. Also. appending and scanning is dealt with using the I/O Configuration portion of TwinCAT System Manager and specifically with the I/O Devices subcategory. since this is a configuration activity. Scan is used to find hardware that is attached. Append is used when no hardware is attached. especially run-time settings.

input and output. If an actual existing and functioning interface is scanned. are not generally displayed.Configuration is really only concerned with I/O. some Bus Terminals also called ³slices´. It¶s critical to know what mode TwinCAT is in during development. Run Mode This is the mode that is required for running the PLC. Free Run This is a special mode for testing connections in System Manager. TwinCAT System Tray icon TwinCAT System Manager TwinCAT PLC Control Flashes between and . such as those that deal with electrical termination. The mode can always be identified by the icon in the system tray and sometimes in the message in the lower right corner of the application: Config Mode This is the mode that is required for development. For this reason. then that interface can be scanned to discover what hardware is attached. a list of boxes will be displayed. I/O .12150 Nicollet Avenue South / Burnsville. System Manager then displays the selected box(es) under the device that was appended under I/O Devices under I/O . This list is specific and shows only the hardware detected via that interface. Stopped Neither development nor operations can be performed.Configuration. Changing This should only be visible for an instant between state changes. MN 55337 / 877 TWIN-CAT (877 894-6228) 20 Once the interface is added to the list of I/O Devices. that is. The selected box can then be added to System Manager.

Working Directory Here you will make a folder on the Desktop in which you will save all the files from the subsequent labs: 1. 3b. Click on the TwinCAT icon in the system tray. Start a new configuration by clicking the New button (Ctrl+N). 4. . Select System Manager. clicking the No button if asked to save. Type your name and hit the Enter key on the keyboard. bring your mouse down to New and select Folder.12150 Nicollet Avenue South / Burnsville. 3a. MN 55337 / 877 TWIN-CAT (877 894-6228) 21 Lab 1: Append and Scan Purpose: In this lab. You will also see the representation of the attached hardware in System Manager and how it is different from the physical hardware as described above. Enter Config mode by clicking the Set/Reset TwinCAT to Config Mode button (Shift+F4). Close any applications. 2. Right click on the desktop. you will be using TwinCAT System Manager to identify the hardware attached to the computer. Hardware Configuration 3.

Click the Ok button. If Append Device is grayed out. 7. MN 55337 / 877 TWIN-CAT (877 894-6228) 22 4a.Configuration 6. Right-click on I/O Devices and select Append Device ? The purpose of appending is to be able to configure hardware when offline or if the Fieldbus being configured is unavailable. Click the Config Mode button (see step 2 above) or (shift-F4). click on the next to I/O . Click on the next to Ethernet then select Virtual Ethernet Interface. . 7a.12150 Nicollet Avenue South / Burnsville. 5. then the system is not in config mode. If necessary. Click on the OK button to Restart TwinCAT System in Config Mode.

9a. 9. . Right click on Device 1 (Virtual-Ethernet) and select Scan Boxes. Click on the next to BK9000-7 (will be the same device name as discovered in step 7 above). Click the OK button. Click on the check box next to BK9000-7 (exact number might be different) to select. For System Manager to find attached devices.12150 Nicollet Avenue South / Burnsville. ? Only controllable elements need be displayed. you may have to either turn off Windows Firewall or open ports bf02 and bf03. such as power terminators are unprogrammable so there is no need having them clutter up the System Manager. Contact support help if necessary. Other elements. MN 55337 / 877 TWIN-CAT (877 894-6228) 23 8. Notice that all the input and output slices are listed but not all the other types of slices existing in the box. 10.

/ Minimizes and maximizes the System Manager window. The menu bar comprises the following six menus: File.8 and 2. The name of the currently active TwinCAT System Manager project is displayed in the header (or as "Untitled".12150 Nicollet Avenue South / Burnsville. Some menu items and buttons were added with TwinCAT 2.´ The normal Windows control elements also appear in the right-hand corner of the title bar:  Moves the System Manager to the task bar without closing the project. MN 55337 / 877 TWIN-CAT (877 894-6228) 24 System Manager In-depth Icon and Menu Item Descriptions The control elements. if a new project has not yet been saved with a name). not all menu items are active at all times. Edit. . more precisely the menu bar and the toolbar of the TwinCAT System Manager are described below. View.9. the toolbar icons are displayed next to their corresponding menu item. Note: As the TwinCAT System Manager is context-sensitive. Where present. Options and Help. In the example above. Actions. the project is named ³Test. 7 Exits (closes) the TwinCAT System Manager application.

Edit Menu Edit Menu This menu works just like a Menu of the same name in MS WORD.xml".8 was known as "Save to Registry. Pressing .) The other items are self explanatory. and Save¶ when we want to solidify a new project and its TPY file creation (TwinCAT Chant ± Name. like MS WORD for example. Build. Activate Configuration This menu item. MN 55337 / 877 TWIN-CAT (877 894-6228) 25 Menus File Menu The File Menu Behaves just like most any Windows based application. These ³actions´ take the declared and adjusted I/O and make them ³turned-on´ and useful.12150 Nicollet Avenue South / Burnsville. Generate Mappings Creates assignment between two process images. We can Save As«¶ when we name a new project." saved the configuration into the Windows Registry. Save. Check Configuration Checks the current configuration for plausibility. Actions Menu Action make things happen to the System Manager you are trying to configure. which until TwinCAT v2. now saves the current configuration into a XML file which is located under \TwinCAT\Boot and has the file name "CurrentConfig.

This function can be also executed from the Command Line without opening the System Manager. This functionality is also available through the Command Line interface without opening the System Manager.12150 Nicollet Avenue South / Burnsville. MN 55337 / 877 TWIN-CAT (877 894-6228) 26 this button initiates the saving of the file and activates the configuration by a TwinCAT system (re)start. During this procedure. an eventually configured PLC Bootproject is loaded and started if the necessary ³Auto Boot´ box is checked (see also: TwinCAT System -> User Interface -> TwinCAT System Control). Set/Reset TwinCAT to Run Mode Starts/restarts the local TwinCAT system with the currently activated configuration (see also: ³Activate Configuration´). .

Read Target Server Versions Reads the current TwinCAT server versions available on the prior selected target system. Import XML Description Imports the configuration data of a previously saved XML Description file into the current System Manager configuration. You can change colors and the fonts among other attributes. Choose Target System With this item you can select the appropriate target system with which to adapt the configuration (see also: ³Set/Reset TwinCAT to Config Mode´). for the configuration of the Beckhoff CX1000 series because this type of devices has usually no local TwinCAT System Manager tool for configuration (see also: ³Choose Target System´). Check PLC Project Changes When selected.g. MN 55337 / 877 TWIN-CAT (877 894-6228) 27 Set/Reset TwinCAT to Config Mode Starts/restarts the remote TwinCAT configuration. Check Variable Links Validates the current mapping information. Update Bus Coupler/IP Link Firmware Updates the Firmware of Beckhoff Bus Couplers or Fieldbus Boxes through serial COM port. causes a message box to appear when saving configuration changes to PLC projects. This functionality is needed e.12150 Nicollet Avenue South / Burnsville. View Menu This menu selections adjusts the way the screen looks and allows you to see what is happening in the project Options Menu The Options menu and its associated icons and entries will allow you to change the look and feel of the screens you use. Access Bus Coupler/IP Link Register The user can access any available register on a Bus Coupler or Fieldbus Box module via COM port or TCP/IP address after entering the necessary information in the dialog. Reload Devices Rescans the I/O configuration at the selected target system and displays it in the System Manager tree view. . Export XML Description Saves the configuration data of the currently highlighted tree item as a XML Description file to disk. Language Opens the selection menu to select one of the localizations supported by the TwinCAT System Manager. This message box requests the PLC Configuration to be re-loaded in.

If missing. Search Devices If in the System Manager TreeView on the left-hand side ³I/O Devices´ (below I/O Configuration) is marked. Find Opens device search dialog within the System Manager. Bus Terminals or IP-Link extension modules.9 it is necessary for this feature and the target system to be in ³Config Mode´ to search for devices (the current mode is shown in the lower right corner of the System Manager Main Window ± see page 20). Other buttons on the tool bar These are the remaining buttons not yet defined. About TwinCAT System Manager Calls up information about the currently installed version of the TwinCAT System Manager.g. Help is a part of the TwinCAT Information System (InfoSys). Hint: With TwinCAT 2. with this button a device scan procedure is started. . Toggle Free Run State After enabling this button. Full expand tree below selected item After pushing this button. e.12150 Nicollet Avenue South / Burnsville. MN 55337 / 877 TWIN-CAT (877 894-6228) 28 Help Menu Help Topics Opens the TwinCAT System Manager Help files. the entry marked in the TreeView will be shown in the fully expanded view. Meaning. found I/O devices can be set to Free-Run mode. if those are found. and if the target system is currently in Config Mode. you may need to manually install the InfoSys. It starts with searching available I/O devices and. ³Reload Devices´ has to be executed once before the I/O drivers for the device can be set to Free-Run state. I/O channels of Bus Terminals can be set (written) to a certain status without having any PLC project or other triggering task active. Hint: If the target system has been in Run-Mode before. continuous with attached ³boxes´ and if applicable.

Once the hardware is ³seen´ by TwinCAT System Manger by way of appending and scanning. It has already been discussed how System Manager is configured in Config Mode. individual slices can then be queried and acted upon. This is displayed in a built-in scope within System Manager.12150 Nicollet Avenue South / Burnsville. MN 55337 / 877 TWIN-CAT (877 894-6228) 29 Testing Configured Hardware TwinCAT System Manager can also be used to test the attached hardware to ensure that everything is configured correctly and functioning. The terminals are separated into the different channels that are available for communication. The channels contain the direction of communication available to that terminal. This process mimics how the box will react when connected to a PLC. This mode empowers System Manager to operate like a real-time PLC where inputs and outputs are controlled manually instead of via a PLC program. Watching an input on a particular slice while its associated. simulating an output using System Manager will result in a response in the physical hardware. Likewise. a sub-mode of Config Mode is Free Run Mode which allows for checking inputs and outputs. inputs will be captured and outputs will be forced. Basically. . physical input is tripped will result in an on-screen response.

start by clicking on the next to Term 2 then click on the next to Channel 1.12150 Nicollet Avenue South / Burnsville. this can be one of the steps in troubleshooting a system. 1. Returning to your previous lab bench. Select Input. 1a. Click on the Online tab. . Enter Free Run mode by clicking the Toggle Free Run State button (Ctrl+F5). MN 55337 / 877 TWIN-CAT (877 894-6228) 30 Lab 2: Testing I/O Purpose: In this lab you will learn to manually check the hardware connections. Besides ensuring that the hardware is functioning before applying a program. 3. 2.

Click the Write button. The scope in TwinCAT System Manager should respond. 4a. Click the 1 button. . 3b. 3d. Select Output 5. 4. Also notice that a LED on the Digital Input slice (yellow) has illuminated. Flip the first switch on the demo box to Off. MN 55337 / 877 TWIN-CAT (877 894-6228) 31 3a. Click on the next to Term 3 then click on the next to Channel 1.12150 Nicollet Avenue South / Burnsville. 5a. Flip the first switch on the demo box to On (your demo box might look somewhat different). 3c.

Click on the Save in field. Type First_Project in the File name field. . click on Desktop and it should be listed there. MN 55337 / 877 TWIN-CAT (877 894-6228) 32 5b. 6a. Otherwise. Select the folder you made in the beginning of Lab 1. 6b. Click the Write button again. Click the 0 (zero) button. Also notice that a LED on the Digital Output slice (red) has illuminated. 6c. 9a. 9. it should be at the bottom of the pull down menu. Click the Save button. 6. Check the demo box for light 1. Notice the scope in TwinCAT System Manager. Click the Save button. 7.12150 Nicollet Avenue South / Burnsville. 8.

it is the least documented language of the IEC standard.12150 Nicollet Avenue South / Burnsville. There is a proposal to improve IL so a future version might make it a better choice. Function Block Diagram (FBD) AND A B C Ladder Diagram (LD) A B C -| |--|/|----------------( ) In the above figure. specifically ones used in the car industry. MN 55337 / 877 TWIN-CAT (877 894-6228) 33 PLC programming with TwinCAT PLC Control As part of the Beckhoff¶s commitment to providing one solution for all of your PLC needs. -Its main deficiencies are its lack of scalability and the variation of symbols used throughout the industry. The choice of programming language is dependent on: y the programmers¶ background y the problem at hand y the level of describing the problem y the structure of the control system y the interface to other people / departments IL (Instruction List) ± is a low level language with a structure similar to a simple machine assembler. LD (Ladder Diagram) ± aka RLL (Relay Ladder Logic) is representative of electrical wiring diagrams. Though it can be used to write tight code for simple yet critical operations. ST (Structured Text) ± is a high level language with some similarities to PASCAL and BASIC. all four languages describe the same simple program part. It is structured as a series of steps which intuitively describe sequences of operations. Subsequently it is easy for people familiar with simple electrical systems and is well accepted by electricians and plant technicians. FBD (Function Block Diagram) ± is a graphical language which effectively depicts a system in terms of the flow of signals between processing elements and is very similar to signal flows illustrated in electronic circuit diagrams. SFC (Sequential Function Chart) ± is a graphical language developed largely by a French standards group called Grafcet. . because of this. TwinCAT PLC Control offers a programming environment with all the features and support necessary to meet the requirements of any PLC application. This includes five IEC standard programming languages plus a new variation on FBD called CFC which is not yet a standard: Instruction List (IL) LD A ANDN B ST C Structured Text (ST) C:= A AND NOT B. it might not be the best choice for beginner programmers.

MN 55337 / 877 TWIN-CAT (877 894-6228) 34 CFC (Continuous Function Chart) ± is a variation of FBD not yet a part of the IEC standard. logging tools and the Library Manager (which lists available objects in any attached libraries). In the Top Down approach. A POU basically contains variables and the use of those variables. In addition to the display of FBD. you start programming your application at the bottom. PLC Control allows for any number of the languages to be used in the completion of a Project. but also include hardware configuration tools. This not only allows the programmer to select the best method to design a system. declare your variables. plus libraries which are collections of the afore mentioned objects which can speed the writing of new code and give the Project added power such as connecting to third party hardware. . Whichever you choose. the above description will become clearer and more useful. in the Bottom Up approach. but allows that programmer to switch between tools as the specific operations within that system demand. And resources are elements that multiple POUs may work with. Understanding the specifics of how TwinCAT programs are structured is not necessary to complete this training course. most common are global variables. the development environment will help you through the whole process.12150 Nicollet Avenue South / Burnsville. A Project can contain three kinds of objects: Program Organizational Units (POUs). As one begins creating more complex programs. Alternatively. and so on. data types and resources. CFC also shows the resource and task assignments. Data types are additional types of information that the variables designated in the POU(s) can be declared to contain. A complete TwinCAT program is called a Project. Top-down vs. bottom-up Top Down Common Elements Programming Languages Bottom Up The standard allows two ways of developing your program: top down and bottom up. you specify your whole application and divide it into sub parts. for instance via derived functions and function blocks.

. As assignments are made. feedback is displayed here. Detected problems with the program will be identified here. There will be an Editor Window for each object in your Project and each Editor Window will conform to the language used for that object. Data types. Object Organizer ± This is where all the objects of the Project are listed. In the LD example shown. There is a tab for each of the three types of objects: POUs. There may also be a tab for Visualizations where interactive graphic representations of inputs and outputs can be made. Messages ± As the program is compiled (built) and run.12150 Nicollet Avenue South / Burnsville. the Declaration Editor automatically updates to show the change. there is a Code Editor that also includes a Declaration Editor: Declaration Editor ± This is where the variables can be manually assigned though generally coding is done in the Code Editor where auto declaration does the work which is displayed in the Declaration Editor. In Run mode. In the LD example above. Code Editor ± This is the main area for writing the code. and Resources. the ladder rungs are displayed. Variables such as inputs and outputs can be added with a point and click methodology. this pane will also show the states of the variables. MN 55337 / 877 TWIN-CAT (877 894-6228) 35 TwinCAT PLC Control TwinCAT PLC Control is separated into four frames: Declaration Editor Code Editor Object Organizer Editor Windows Message Window Editor Windows ± This where the code is written.

This section is not intended to be even an introductory programming course. it is merely to acquaint you with the functionality of TwinCAT and basic procedure to start a project. Click on the TwinCAT icon in the system tray. Select PC. 1b. 2. Go under the File menu to New. you will be creating a simple PLC program. 4. Right click in the Code section of the programming window. 1a.12150 Nicollet Avenue South / Burnsville. 3a. Click the OK button. . Select LD under Language of the POU. MN 55337 / 877 TWIN-CAT (877 894-6228) 36 Lab 3: TwinCAT PLC Control Familiarization Purpose: In this lab. Click on the OK button. Select PLC Control. 3. 1. Click the OK button when presented with the Could not open project/library alert (this will only appear if this is the first time ever that TwinCAT was used to make a program on this system). 5. Select Contact (Ctrl+K). 1c. 2a.

Type My First Contact in the Comment field. If instead you see a blinking line between ?s. 9. MN 55337 / 877 TWIN-CAT (877 894-6228) 37 6. 6a. capital ³I´. .12150 Nicollet Avenue South / Burnsville. Type %I* (percent sign. 7a. asterisk) in the Address field. 8. 8b. Type b_100. Click the red ???. 7. than double click the ???. The ??? should highlight. The Declaration area should update to reflect the changes. Hit the Enter key on the keyboard. 8a. Click the OK button.

The Declaration area should update to reflect the changes. . (³Q´ is used as ³O´ might be misread as a zero. Type My First Output in the Comment field. 12. Type b_200. 10a. they should be blue. Go under the File menu to Save As. 13. MN 55337 / 877 TWIN-CAT (877 894-6228) 38 10. The ??? should already be selected. Hit the Enter key on the keyboard. Select Coil (Ctrl+L). click on the red ??? to select it 11a. 14. Right click in the Code section again.12150 Nicollet Avenue South / Burnsville.) 12a. 11b. Click the OK button. If not. 11. 12b. Type %Q* in the Address field. that is.

Otherwise. 17a. 16. There should be 0 (zero) errors reported at the bottom of the screen. click on Desktop and it should be listed there. there must be NO errors. The folder on the desktop should contain the following files.12150 Nicollet Avenue South / Burnsville. 16a. there was probably an Error in the program when building. 18. Click on the Save in field. 17. Type First_Program in the File name field. MN 55337 / 877 TWIN-CAT (877 894-6228) 39 15. Select the folder you made in steps 1 and 2. It¶s OK to have any number of warnings. Go under the Project menu to Build (Ctrl+F8).tpy file did not get created. . it should be at the bottom of the pull down menu. Remember that while there can be warnings. Go under the File menu to Save. Click the Save button. 18a. If the .

. Switch to Untitled . Hardware Configuration 1. MN 55337 / 877 TWIN-CAT (877 894-6228) 40 Connecting the PLC Program to the Hardware The System Manger is the bridge between a PLC program and the hardware being controlled. the wrong program was probably Appended. 3.12150 Nicollet Avenue South / Burnsville. Go under the File menu in PLC Control and select Save as to see where that version of the program was saved. Find the folder you made in steps 1 and 2. Select First_Program. 2.tpy and click the Open button. It also connects the hardware outputs to software outputs so the PLC programs can monitor and react to the changes in the hardware states. you will be building on the knowledge gained in the previous labs to take the program you wrote and the hardware you configured and get them to communicate together. Lab 4: Putting it all together Purpose: In this lab. Right click on PLC Configuration (scroll up in the left pane if necessary) and select Append PLC Project.TwinCAT System Manager using the Task Bar. It assigns which hardware input is controlled by which software input. If input(s) are not showing up.

3b. MN 55337 / 877 TWIN-CAT (877 894-6228) 41 3a. -The Input icon now has a little arrow on it indicating that it is linked to a control. 4. If necessary. 5. click on the s next to Term 3 and Channel 1. . click on the s next to Term 2 and Channel 1.12150 Nicollet Avenue South / Burnsville. Double click on Output. 5a. 4a. Click the OK button. Select MAIN. Double click on Input.b_100. If necessary.

Click on the OK button to Restart TwinCAT System in Run Mode. See page 18. MN 55337 / 877 TWIN-CAT (877 894-6228) 42 6. 7. 7a. Click the OK button. 6b. Select MAIN.12150 Nicollet Avenue South / Burnsville. There are three ways to activate a configuration: y The Activate button y Under the Actions menu and selecting Activate Configurations y Ctrl+Shift+F4 . Click the Save button (Ctrl+S). Click on the Yes button that Document is modified! 7b. 6a. -The system should now be in run mode and both System Manager and the TwinCAT icon in the system tray should reflect this. Click on the OK button to Activate Configuration. -Notice that the WDG LED on the Bus Coupler is lit solid and the ACT LED is flashing quickly. 7c.b_200. Click on the Activate configuration button.

When notified that The program has changed. The response should be FALSE for both the input and the output. 9a. 10a. MN 55337 / 877 TWIN-CAT (877 894-6228) 43 Launching the PLC 8. Switch to TwinCAT PLC Control using the Task Bar. click on the Yes button to Download the new program. Go under the Online menu and select Run (F5). Go under the Online menu and select Login (F11).12150 Nicollet Avenue South / Burnsville. . 9. 10.

Also notice that LEDs are lit on both the Digital Input slice (yellow) and the Digital Output slice (red).12150 Nicollet Avenue South / Burnsville. 11b. The first light on the demo box should also be lit. clicking the Yes button if asked to save. 11a. Exit out of both PLC Control and System Manager. . 11c. The response for both input and output should now be TRUE and the contact and the coil should now be blue. MN 55337 / 877 TWIN-CAT (877 894-6228) 44 11. 12. Flip the first switch on the demo box.

As a customer of Beckhoff. Beckhoff products and services and company information. Information System¶s greatest asset is in its help with troubleshooting.12150 Nicollet Avenue South / Burnsville. The TwinCAT information System is very useful for writing code. Arguably. click the Start button. When TwinCAT is installed the complete TwinCAT Information System is automatically installed. its use and interoperability. The Beckhoff Information System is a separate more complete product. It includes information about every Beckhoff product. using specific Beckhoff tools. MN 55337 / 877 TWIN-CAT (877 894-6228) 45 Documentation A number of sources of information are available when learning about. . all of this information will be at your disposal. Beckhoff Information System By far. then Programs (or All Programs) then BECKHOFF. Information System includes explicit details of programming and hardware elements. defining FB and understanding other such things. This includes error codes plus their causes and potential remedies. To access Information System. then Information System and finally the language of your choice. the most complete source of information is the Beckhoff Information System.

. MN 55337 / 877 TWIN-CAT (877 894-6228) 46 There are three main ways to find information in the Information System: Contents shows a tree of topics that can be browsed.12150 Nicollet Avenue South / Burnsville. Index takes a keyword and shows items specified as being related to that keyword.

It can also be read online at www. try clicking on the Contents tab to see where the selected page falls in the tree. PC Control This printed. Main Catalog This printed document contains all of Beckhoff¶s products and services and also includes some company information.pc-control. If you find something close to what you are looking for in a search. all of the publications of PC Control available at the time plus a second. monthly magazine. . new product announcements and general news.12150 Nicollet Avenue South / Burnsville.plcopen.beckhoff. MN 55337 / 877 TWIN-CAT (877 894-6228) 47 Search returns every page that contains the entered search term. General PLC Information For non-company specific information on the PLC standards.net/english. products and services. Main Catalog. contact information. installation CD of Beckhoff software products.org. training locations. At this site you will have access to company information. Other resources www. visit www. See the I/O section in this manual for a description of model numbering and color scheme. documentation. published by Beckhoff offers stories about companies that are benefiting from the incorporation of Beckhoff products plus tips. Products & Solutions This CD set includes a CD with the entire website. programming and more.com This is the official website of Beckhoff Automation. You can then browse from there to pinpoint the information you require. including news.

12150 Nicollet Avenue South / Burnsville. virtually in System Manager or physically on the box. PLC programming language. LD (Ladder Diagram). Can be performed programmatically in PLC Control. a block of code that is called by a program but remains separate. Force. Bus Terminal (aka slice). a Bus Coupler. It can also refer to the lab device used in training. Used when discussing deterministic timings and usually described in microseconds. the means by which the hardware information is connected to the software information. Library. the part of a computer operating system that manages the system's resources and the communication between hardware and software components. text based. Jitter. PLC programming language. K-Bus. PLC programming language. graphical.e. IEC 61131-3. the act of manually changing the state of an input or output. Deterministic computation. its storage devices. internal bus for communication and power between the coupler and Bus Terminals.001) of a second. 1000 ms equals one second. Can also be considered a component of task time when figuring response times. CFC (Continuous Function Chart). IL (Instruction List). Fieldbus. NC (Numerical Control). Kernel. IEC (International Electrotechnical Commission). a version of FBD that is not yet an IEC standard PLC programming language. graphical. given an initial state of a system. specifically Bus Couplers and Bus Terminals. connected directly to a machine to repeatedly make a single item. connected to a machine to repeatedly make items and whose program can be updated or replaced to change production. a collection of POUs (generally Functions and Function Blocks) often grouped together by task. normally used in reference to DIN rails (also called top-hat rails) which are used to mount control equipment. that aids in development. Millisecond. other computers (via a network) or attached hardware. DLL (dynamic-link library). Bus Controller or a Fieldbus Box. very small timing fluctuations. 1000 (0. DIN (Deutsches Institut für Normung). an industrial network system for real-time distributed control. the global standard for common industrial control programming. an interface that utilizes a Message router to communicate between ADS devices over TCP/IP. CNC (Computer Numerical Control). I/O (Input/Output). I. an IEC standard. inside equipment racks. the world standards organization for electrical and electronic international standards. communication between a computer and its users. an IEC standard. an IEC standard. Mainly used when linking a th . predecessor of CNC. Link. MN 55337 / 877 TWIN-CAT (877 894-6228) 48 Glossary ADS (Automation Device Specification). FBD (Function Block Diagram). the part of the box that handles I/O and sometimes added communication and specific electrical requirements. Box. OCX. a DLL that contains one or more ActiveX controls. generally written in higher-level languages. the system will always produce the same final state when given the same input.

TwinCAT (The Windows Control and Automation Technology). PLC (Programmable Logic Controller). all the PLC tools and system modification components offered by Beckhoff Automation. a live connection to hardware. Real-time system. the Beckhoff hardware configuration tool. a computer system that is forced to respond to an input in an explicitly allotted time. Real Time. System Manager (TwinCAT System Manager). an IEC standard.net. ST (Structured Text). usually measured in milliseconds. alternate name for Bus Terminal. SFC (Structured Function Chart). an IEC standard PLC programming language that is both graphical and textual. Tick. a small special-purpose computer used to automate machines. Slice. functional elements within a PLC program as described by IEC 1131-1. Online.12150 Nicollet Avenue South / Burnsville. Beckhoff uses this term to describe connecting to the box in real time. the Beckhoff PLC programming environment. the software that runs a computer or is embedded in and runs Fieldbuses. The smallest increment of time as measured by a computer system. PLC Control (TwinCAT PLC Control). OS (Operating System). POU (Program Organization Unit). PLC programming language. MN 55337 / 877 TWIN-CAT (877 894-6228) 49 program to code written in Microsoft Visual Basic or . . text based.

48. 12 System ID. 46 jitter. 32. 19. 45 fieldbus. 49 Real-time. 39. 35 warning. 10. MN 55337 / 877 TWIN-CAT (877 894-6228) 50 Index append. 20. 34. 48. 47. 5. 17. 19. 17 DLL. 15 System Manager. 42 Bus Terminal. 23 serial number. 36. 15 resource. 29. 33. 21. 48 Information System. 5. 34. 36 Contact. 31. 36. 48. 35. 15 OCX. 20. 16. 48 scan. 48 license. 29. 35. 49 PLC Control. 48 kernel. 48 error. 19. 17 . 49 visualization. 49 Registration Key. 34 Data type. 34. 5. 37 data type. 39 latency. 43 POU. 40 Bus Coupler. 49 coil. 9. 12. 8 I/O. 35 runtime. 40 tick. 19. 21. 21.12150 Nicollet Avenue South / Burnsville. 16. 33. 9. 22. 17. 34 Resource. 40. 45. 19 Scan. 19. 48 PLC. 5. 8. 35 deterministic. 38 contact. 18 library. 19 Append. 8. 22.

Sign up to vote on this title
UsefulNot useful