TwinCAT Getting Started
TwinCAT Getting Started
Creating a New IWS Application.........................................................................................36 Selecting the TWCAT Communication Driver........................................................................39 Building the Driver Worksheet ...........................................................................................41 Designing the HMI Screen .................................................................................................46 Specifying the Startup Screen ...........................................................................................50 Testing the Application Locally ...........................................................................................51 Downloading the Application to a Windows CE-based Device .................................................53 Exporting a Symbol File from TwinCAT................................................................................54 Importing the Symbol File into IWS....................................................................................56
Note This document assumes that you are familiar with the Microsoft Windows NT/2000/XP environment, including how to move files, manage system preferences, establish network connections, and install new software. If you do not have this familiarity, then please consult the Windows Help feature as you work through this document.
InduSoft Ltd.
Page 1/60
Introduction
This document describes how to configure InduSoft Web Studio (IWS) and Beckhoffs TwinCAT control software to run together on various Microsoft Windows-based devices, as well as how to establish communication between those devices on an Ethernet network. The following diagram shows a mixed device network using both InduSoft and Beckhoff software components:
Windows NT/2000/XP or XPe InduSoft Web Studio TWCAT driver TwinCAT development ADS Library Beckhoff CX Series, Windows XPe TwinCAT runtime ADS Library InduSoft Web Studio TWCAT driver
(preinstalled)
TCP/IP
Windows NT/2000/XP or XPe InduSoft Web Studio TWCAT driver ADS Library
(free)
ADS Library
TCP/IP
Figure 1. Mixed Device Network Using IWS and Beckhoff Components Each device in the diagram shows a unique combination of operating system, InduSoft software components, and Beckhoff software components. The primary component in this system is Beckhoffs Automation Device Specification (ADS) library, which makes a compatible workstation or industrial PC running Windows NT/2000/XP, an embedded PC running Windows XPe, or a Windows CE-based device into a TwinCAT-compliant node. This library establishes a data exchange protocol that works over standard Ethernet TCP/IP, so that any node with the library installed can communicate directly with your TwinCAT control application,
Page 2/60
InduSoft Ltd.
wherever it may be hosted. The ADS library is included in the full TwinCAT software, but it is also available as a free, separate package from Beckhoff. InduSoft provides a TWCAT communication driver for IWS and CEView. The TWCAT driver, when properly selected configured in your IWS application project, communicates with TwinCAT through the ADS library. In this way, IWS is fully compatible with TwinCAT. The rest of this document will explain How to choose, acquire and install the necessary software components for each of these device configurations; How to use the utilities provided with the ADS library to establish communication between devices; and How to build a sample application in IWS that uses the TWCAT driver and the ADS library to communicate with TwinCAT.
ADS Library
Figure 2. Typical Configuration for Majority of Users If this is your configuration, then you can use the following quickstart guide to jump directly to the relevant sections in this document: 1) Download and run the CEView custom installer (i.e., the .CAB file) for Beckhoff CX Series devices starting on page 12. 2) Establish a link between IWS on your workstation and CEView on the device, and then update CEView to the latest version starting on page 14. 3) License CEView on the device starting on page 15. 4) Select the TWCAT driver and add it to your IWS application project starting on page 39. 5) Build the driver worksheet starting on page 46. 6) Download the finished IWS application to the device starting on page 53. Note This quickstart guide assumes that you are already familiar with both InduSoft Web Studio and the TwinCAT programming software. It only describes how to set up a Beckhoff CX Series device in an existing production environment. If you need more thorough instructions, then please review this entire document.
InduSoft Ltd.
Page 3/60
Page 4/60
InduSoft Ltd.
hoff sales representative for licensing options, and consult the TwinCAT documentation for more information about applying the license. Keep in mind that you may not need to acquire the full version of TwinCAT for your installation; the TwinCAT runtime engine comes preinstalled on most Beckhoff devices, and on other devices you may only need to install the ADS library to enable communication. The ADS communication library is freely available from Beckhoff and can be acquired in several different ways: If you have already installed TwinCAT on a traditional PC, then the ADS library files are available on that PC in the \TwinCAT\ADS Api directory; The ADS library can be installed from the TwinCAT Supplement CD that comes with the TwinCAT Installation CD; or The ADS library is available as a free, standalone download from Beckhoffs Web site at www.beckhoff.com. The full name of the download is TwinCAT_ADS_Communication_Library, and it is listed in the TwinCAT Supplement section of the site.
The ADS communication library can be installed on a traditional PC running Windows NT/2000/XP, on an embedded PC running Windows XPe, or on a Windows CE device using any of the following processor types: ARM, I586, MIPS, SH3, SH4, StrongARM HPC, StrongARM PPC, StrongARM 1100, and StrongARM V4I.
Windows CE Utilities
If you will be working with Windows CE either on a Beckhoff PLC or on some other Windows CEbased device then you should consider having these two utilities installed on your workstation: First, you can use Microsoft ActiveSync to easily transfer files between your workstation and a connected Windows CE-based device. ActiveSync communicates with the device via serial or USB, and when the device is properly connected, it appears on your workstation (under My Computer) as a removable drive.
Figure 3: Using Microsoft ActiveSync to Connect to a Windows CE-based Device ActiveSync can be downloaded for free from Microsofts Web site at: http://www.microsoft.com/windowsmobile/addons/
InduSoft Ltd.
Page 5/60
Second, you can use Remote Display Control for Windows CE (also known as CERHOST.exe) to open a console window on your workstation that shows the desktop of a connected Windows CE-based device. Through this console window, you can fully operate a headless device that is, a device without its own display, keyboard or mouse using only your workstation. Remote Display Control communicates with the device via Ethernet TCP/IP, similar to both TwinCAT and IWS. However, you must know the hostname or IP address of the device in order to connect to it, so be sure to get this information beforehand.
Figure 4: Using Remote Display Control to Connect to a Windows CE-based Device Microsoft includes Remote Display Control as part of their Windows Mobile developer toolkit, but Beckhoff also offers the utility on their Web site at: http://ftp.beckhoff.de/Software/embPC-Control/CE/Tools/RemoteDisplay/ For more information about using Microsoft ActiveSync or Remote Display Control, please consult Microsofts documentation. Note The addresses given above are accurate at the time of this writing, but they may change in the future as Microsoft and/or Beckhoff update their Web sites.
Page 6/60
InduSoft Ltd.
4) Copy all four files to the \BIN directory of your IWS installation. For example C:\Program Files\Indusoft Web Studio v6.1\BIN\ With the ADS library and the latest TWCAT driver both installed, IWS is ready to communicate with TwinCAT running on a remote device. Unless you are performing additional installations on other devices, you may proceed to the next section, Establishing Communication Between TwinCAT Stations, on page 25.
InduSoft Ltd.
Page 7/60
Page 8/60
InduSoft Ltd.
Its possible that there simply isnt enough space to both download the installers and install the software. It all depends on how much non-volatile memory you have available. Furthermore, for the sake of network maintenance and security, embedded PCs on the plant floor often are not connected to the Internet. Yet, they usually are connected to the internal network so you may be able to run the installers from another PC.
InduSoft Ltd.
Page 9/60
The CX1020 can be configured with either Windows XPe or Windows CE. The CX1000 can only be configured with Windows CE. Both models come with the TwinCAT runtime software preinstalled, so you only need install the InduSoft software component that is appropriate to the operating system: the full version of IWS on Windows XPe, or the CEView runtime engine on Windows CE.
Page 10/60
InduSoft Ltd.
In general, the rest of this section describes the following procedure: 1) Check to see if CEView is already installed on the device that is, check to see if the custom installer has already been applied. 2) If CEView is not installed, then download the custom installer and run it. 3) Use the Execution Environment tool in IWS to connect to the device, and then update CEView to match IWS. 4) Entire your runtime license for CEView. You may wonder why you should download and run the custom installer if theres a chance it will install an old version of CEView that needs to be updated anyhow. Why not install CEView from scratch using the Execution Environment tool in IWS? Well, because the installer automatically makes changes to the devices directory structure and system registry that are more difficult to make manually. In the end, its simply easier to run the installer and then update. Before you proceed, make sure that you meet the following prerequisites: You must have the full IWS development software installed on your workstation; Your CX Series device should be connected to your workstation by serial or Ethernet. If it is connected by Ethernet, then it should be assigned a valid IP address; You must have a way to control the device, either through a console window (see page 6) or by physically attaching a display and a mouse; and You must have a way to transfer files from your workstation to the device, either through Microsoft ActiveSync (see page 5), by manually copying the files onto the devices Compact Flash memory card, or by copying across the network.
For help with meeting these prerequisites, please consult Microsofts documentation for Windows CE and Beckhoffs documentation for the CX Series device.
InduSoft Ltd.
Page 11/60
Note Remote Agent is a communications utility included in the CEView installation. It enables communication between IWS on your workstation and CEView on the device. In this way, it serves much the same purpose that the ADS library serves in TwinCAT. If the CEView files are present and Remote Agent starts automatically on boot, then skip to Updating CEView to the Latest Version on page 14. If not, then proceed to Downloading and Running the Custom Installer below.
Page 12/60
InduSoft Ltd.
The CEView files are installed in the \Hard Disk\InduSoft directory, and the system registry is updated.
Figure 7. Installing Files in the InduSoft Directory 5) When the installation is finished, reboot the device by selecting Start Suspend. This will save the updated directory and registry information to the persistent (non-volatile) memory. After the reboot, the Remote Agent utility should start automatically.
Figure 8. Remote Agent Utility Running in Windows CE 6) Tap Setup to open the Setup dialog:
Figure 9. Setup Dialog in Remote Agent Configure the Device Connection settings as needed, depending on how youve connected the device to your workstation. For complete instructions, please consult the InduSoft Web Studio User Guide. You do not need to enter a license at this time. 7) Tap OK to close the Setup dialog. Remote Agent is now ready to receive communication from IWS running on your workstation.
InduSoft Ltd.
Page 13/60
Figure 10. Execution Environment Dialog 3) Configure the Target Station settings as needed, depending on how youve connected the device to your workstation. For complete instructions, please consult the InduSoft Web Studio User Guide. 4) Click Connect to establish communication with the device. If communication is successfully established, then the Status and Platform fields will be updated to reflect the connected device. Also, the Remote Agent utility on the device will show that it has successfully connected back to IWS. 5) Make sure the Only newer files option (checkbox) is enabled, and then click Install system files to update the CEView files on the device. 6) When the installation is completed, click Close to close the Execution Environment dialog. 7) Reboot the device once more by selecting Start Suspend. This will save the updated files to the devices persistent (non-volatile) memory. You should now have the TwinCAT runtime software, the Remote Agent utility, and the updated CEView files all installed on your CX Series device.
Page 14/60
InduSoft Ltd.
Licensing CEView
You must have a valid license to run CEView beyond the free evaluation period. You can obtain this license by contacting your InduSoft sales representative and providing the devices site code. The representative will use this site code to generate a corresponding license code, which you can then apply to the device. The actual licensing can be done in either of two ways: via the Execution Environment tool in IWS, or directly at the device. If youve already used the Execution Environment tool to connect to the device and update the CEView software (see the previous page), then its very easy to also license the software. When you are ready, proceed with the following instructions: 1) In the Execution Environment dialog, select the CE License tab:
Figure 11: CE License Tab in the Execution Environment Dialog 2) Copy the code given in the Site Code field and send it to your InduSoft sales representative. Your representative will return a license key that corresponds to the site code. Note The site code shown above is given only as an example. Your devices actual site code is generated when CEView is installed, and it is unique to your device. 3) Enter the license key in the Site Key field and click Send. If the site key is accepted (validated), then a confirmation message will be displayed. If the site key is not accepted, verify that you have entered it correctly and try again. If it is still not accepted, then contact your InduSoft sales representative for assistance.
InduSoft Ltd.
Page 15/60
If for whatever reason you cannot connect to the device via the Execution Environment tool in IWS, you can still apply a license directly on the device itself: 1) On your CX Series device, in the Remote Agent utility, tap Setup to open the Setup dialog:
Figure 12. Setup Dialog in Remote Agent 2) Tap License to open the License dialog:
Figure 13: License Dialog in Remote Agent 3) Tap Change License to open the Change License dialog:
Figure 14: Change License Dialog in Remote Agent 4) Copy the code given in Site Code field and send it to your InduSoft sales representative. Your representative will return a license key that corresponds to the site code. Note The site code shown above is given only as an example. Your devices actual site code is generated when CEView is installed, and it is unique to your device.
Page 16/60
InduSoft Ltd.
5) Enter the license key in the Site Key field and click Authorize. If the site key is accepted (validated), then the following message is displayed:
Figure 15: Site Key Accepted If the site key is not accepted, verify that you have entered it correctly and try again. If it is still not accepted, then contact your InduSoft sales representative for assistance. When CEView is properly installed, updated, licensed, and ready for runtime, you can proceed to Establishing Communication Between TwinCAT Stations on page 25.
InduSoft Ltd.
Page 17/60
For help with meeting these prerequisites, please consult Microsofts documentation for Windows CE and the manufacturers documentation for the device.
Page 18/60
InduSoft Ltd.
InduSoft Ltd.
Page 19/60
Note For devices running Windows CE 3.x, use the files located in the \Redist\CeView directory. For devices running Windows CE 4.x (a.k.a. Windows CE .NET) and Windows CE 5.x, use the files located in the \Redist\Wince 4.0 directory. For example, for a device running Windows CE 3.1 on an Intel x86 processor: \InduSoft Web Studio v6.1\Redist\CeView\x86\BIN\CEServer.exe For a device running Windows CE 5.0 on an ARM V4 processor: \InduSoft Web Studio v6.1\Redist\Wince 4.0\Armv4\BIN\CEServer.exe 2) Copy this file to the devices persistent (non-volatile) file storage. The directory structures of different Windows CE-based devices can vary greatly, and the device manufacturer may require that applications be stored in a specific directory, so please consult the manufacturers documentation. 3) You can now run Remote Agent in Windows CE by double-tapping the CEServer.exe icon. When you run it, the Remote Agent window is displayed:
Figure 16. Remote Agent Running in Windows CE 4) Tap Setup to open the Setup dialog:
Page 20/60
InduSoft Ltd.
Configure the Device Connection settings as needed, depending on how youve connected the device to your workstation. For complete instructions, please consult the InduSoft Web Studio User Guide. You do not need to enter a license at this time. 5) Tap OK to close the Setup dialog. Remote Agent is now ready to receive communication from IWS running on your workstation.
Figure 18. Execution Environment Dialog 3) Configure the Target Station settings as needed, depending on how youve connected the device to your workstation. For complete instructions, please consult the InduSoft Web Studio User Guide. 4) Click Connect to establish communication with the device. If communication is successfully established, then the Status and Platform fields will be updated to reflect the connected device. Also, the Remote Agent utility on the device will show that it has successfully connected back to IWS. 5) Click Install system files to install the CEView files on the device. 6) When the installation is completed, click Close to close the Execution Environment dialog. 7) Reboot the device once more to save the updated files to the devices persistent (nonvolatile) memory.
InduSoft Ltd.
Page 21/60
You should now have the ADS library, the Remote Agent utility, and the CEView files all installed on your Windows CE-based device.
Licensing CEView
You must have a valid license to run CEView beyond the free evaluation period. You can obtain this license by contacting your InduSoft sales representative and providing the devices site code. The representative will use this site code to generate a corresponding license code, which you can then apply to the device. The actual licensing can be done in either of two ways: via the Execution Environment tool in IWS, or directly at the device. If youve already used the Execution Environment tool to connect to the device and update the CEView software (see the previous page), then its very easy to also license the software. When you are ready, proceed with the following instructions: 1) In the Execution Environment dialog, select the CE License tab:
Figure 19: CE License Tab in the Execution Environment Dialog 2) Copy the code given in the Site Code field and send it to your InduSoft sales representative. Your representative will return a license key that corresponds to the site code. Note The site code shown above is given only as an example. Your devices actual site code is generated when CEView is installed, and it is unique to your device. 3) Enter the license key in the Site Key field and click Send. If the site key is accepted (validated), then a confirmation message will be displayed. If the site key is not accepted, verify that you have entered it correctly and try again. If it is still not accepted, then contact your InduSoft sales representative for assistance.
Page 22/60
InduSoft Ltd.
If for whatever reason you cannot connect to the device via the Execution Environment tool in IWS, you can still apply a license directly on the device itself: 1) On your Windows CE-based device, in the Remote Agent utility, tap Setup to open the Setup dialog:
Figure 20. Setup Dialog in Remote Agent 2) Tap License to open the License dialog:
Figure 21: License Dialog in Remote Agent 3) Tap Change License to open the Change License dialog:
Figure 22: Change License Dialog in Remote Agent 4) Copy the code given in Site Code field and send it to your InduSoft sales representative. Your representative will return a license key that corresponds to the site code. Note The site code shown above is given only as an example. Your devices actual site code is generated when CEView is installed, and it is unique to your device.
InduSoft Ltd.
Page 23/60
Getting Started with IWS and TwinCAT 5) Enter the license key in the Site Key field and click Authorize.
If the site key is accepted (validated), then the following message is displayed:
Figure 23: Site Key Accepted If the site key is not accepted, verify that you have entered it correctly and try again. If it is still not accepted, then contact your InduSoft sales representative for assistance. When CEView is properly installed, licensed, and ready for runtime, you can proceed to Establishing Communication Between TwinCAT Stations on page 25.
Page 24/60
InduSoft Ltd.
InduSoft Ltd.
Page 25/60
Figure 24. TwinCAT Icon in the System Tray 3) Right-click on the TwinCAT icon and select Properties from the pop-up menu:
Page 26/60
InduSoft Ltd.
Figure 26. TwinCAT System Properties Dialog 4) Select the AMS Router tab:
InduSoft Ltd.
Page 27/60
Getting Started with IWS and TwinCAT 5) Check the default AMS Net ID and change it if necessary:
Figure 28. AMS Router Tab in the System Properties Dialog 6) Click OK to apply your changes and close the TwinCAT System Properties dialog.
Page 28/60
InduSoft Ltd.
Figure 30: TwinCAT System Manager 2) Click Choose Target. The Choose Target System dialog is displayed:
InduSoft Ltd.
Page 29/60
Getting Started with IWS and TwinCAT 3) Click Search (Ethernet). The Add Route dialog is displayed:
Figure 32: Add Route Dialog 4) Click Broadcast Search. The System Manager will search the network for other TwinCAT stations and display them. Stations to which routes have already been established will be marked:
Figure 33: Results of Broadcast Search for Other TwinCAT Stations 5) Select a new station and click Add Route , or simply double-click on the station. You will be prompted for a Username and Password for the station:
Figure 34: Logon Information for the Target Station 6) Enter the Username and Password for the new station, and then click OK. Note If the target station is a Beckhoff CX Series device (CX1020 or CX1000) running Windows CE, then the default Username is administrator with no password.
Page 30/60
InduSoft Ltd.
If the logon is successful, then the station will be marked as connected in the route list:
Figure 35: Target Station is Successfully Connected 7) Repeat steps 5 and 6 for each station to which you want to establish a route. Keep in mind that this list only shows the other TwinCAT stations to which routes have been established, allowing communications and making those stations available to be targeted by the TwinCAT development software. Actually targeting a station for your control program is a separate procedure; please consult Beckhoffs documentation for more information. 8) Click Close to close the Add Route dialog and return to the Choose Target System dialog. Stations that can be targeted for your control program are now listed here.
Figure 36: Choose Target System Dialog Showing Available Stations 9) Click OK to close the Choose Target System dialog. 10) From the main menu bar in the TwinCAT System Manager window, select File Exit to exit the System Manager. Your connections are now set and ready for communications. Furthermore, because you used this method to establish your connections that is, you searched the network and actually logged onto the stations there is no need to manually test them. You can proceed to Building a Sample IWS Application on page 36.
InduSoft Ltd.
Page 31/60
2) Double-click (or double-tap) on the utility to run it. The AMS Remote Connections dialog is displayed:
Figure 37. AMS Remote Connections Manager 3) Check the default AMS Net ID for the local station and change it if necessary.
Page 32/60
InduSoft Ltd.
Figure 38. Adding a New Route in AMS Remote Connections The Add Remote Connection dialog is displayed:
Figure 39. Add Remote Connection Dialog Before you proceed, make sure that you have the required information for the other station. 5) In the Name field, enter a descriptive name for the remote computer. For example, SupportPC or CX1020 #3. 6) In the AMS Net ID field, enter the unique station ID of the remote computer. 7) In the Address field, enter the address of the remote computer on the physical network. The format of this address depends on the type of network. For example, if the type of network is Ethernet TCP/IP, then the address will be in standard four-byte, period delimited format (ex. 10.168.23.163). 8) Click on the Transport pull-down menu and select the type of physical network. Note There are many different types of physical network to choose from, and the address format can vary greatly from type to type. If you are using a network other than Ethernet TCP/IP, then please consult Beckhoffs documentation and/or the hardware manufacturers documentation for more information.
InduSoft Ltd.
Page 33/60
9) Click OK to accept the properties and add the connection to the Remote Computers list. 10) Repeat steps 4 through 9 for each connection (route) you want to add. New connections are not tested as they are added. You will be able to test these connections in the next section below. 11) Click OK to close the AMS Remote Connections dialog. 12) To apply these new settings, you must restart the TwinCAT runtime engine or ADS library. If you are working on a workstation or industrial PC running Windows NT/2000/XP, or an embedded PC running Windows XPe, then you must completely reboot the PC. If you are working on a Beckhoff CX1020 or CX1000, or any other Windows CE-based device, then you must save the registry and restart the device. On a Beckhoff device, simply tap the Start button to open the Start menu and then select Suspend. On any other device, please consult the manufacturers documentation.
Page 34/60
InduSoft Ltd.
Figure 41: Setting Up the Test 5) In the AmsNetId field, select the connection to be tested from the pull-down menu. Note This menu should list the same stations/connections that you specified earlier using the AMS Remote Connections Manager utility. Also, if you want to test a specific TwinCAT port on the other station, then enter it in the Port field. (Ports are used by various subroutines in a TwinCAT control program.) 6) Click Start to start the test. The results, including errors, are displayed in the Output field:
If the results are successful, then your AMS routing information is correct and the connection is ready for use. If the results show any errors, then check your physical cabling and routing information and try again. 7) Click Stop to stop the current test. 8) Repeat steps 5 through 7 for each connection that you want to test. 9) Close the Test dialog and exit the ADS Test utility. Your connections are now set and ready for communications. You can proceed to Building a Sample IWS Application on the next page.
InduSoft Ltd.
Page 35/60
TCP/IP
ADS Library
Figure 42: Network Configuration for Sample Application Using the instructions below, you will create a IWS/CEView application screen that displays a TwinCAT program variable (a.k.a. PLC register) on the Beckhoff CX1000. Of course your network configuration may be different than the one shown above, but the same basic instructions apply to all possible configurations; only certain options would vary. Note These instructions do not cover how to initially configure the CX1000, nor how to use the TwinCAT development software to program the device. It is assumed that you have already created the TwinCAT program and downloaded it to the CX1000. For more information, please see Beckhoffs documentation for TwinCAT. Also, please keep in mind this is only a basic walkthrough for creating a sample IWS application. For complete instructions on using IWS, please see the IWS User Guide. The rest of this section describes how to: Run InduSoft Web Studio and create a new IWS/CEView application project; Select the TWCAT communication driver; Build a driver worksheet that links an IWS database tag to the TwinCAT program variable; Lay out a simple IWS/CEView application screen that displays the variable; Compile the application and download it to the CX1000; and Start the CEView application.
Page 36/60
InduSoft Ltd.
2) From the main menu bar, select File New. The New dialog is displayed:
Figure 44: Project Tab of the New Dialog 4) In the Application name field, enter TWCATSample.
InduSoft Ltd.
Page 37/60
Getting Started with IWS and TwinCAT 5) Under Target platform, select CEView Standard:
Figure 45: Selecting the Target Platform 6) Click OK to proceed to the Project Wizard dialog:
7) The default settings are fine for this sample application, so click OK to close the dialog. The new application project is created in IWS and it is ready for configuration.
Page 38/60
InduSoft Ltd.
Figure 46: Right-clicking on the Drivers Folder The Communication Drivers dialog is displayed. 3) In the Communication Drivers dialog, under Available drivers, select the TWCAT driver:
Figure 47: Selecting the TWCAT Driver Note If you have not already downloaded and installed the latest version of the TWCAT driver (see pages 4 and 7), then take a moment to note the driver version displayed in the description in the figure above, the driver version is 1.06 and then compare it to the latest version posted at www.indusoft.com.br/download/drivers/. If a newer version is available, then you should pause here to download and install it. (You must restart IWS to make the new driver available, so save your application project and exit IWS before you install the new driver.)
InduSoft Ltd.
Page 39/60
4) With the TWCAT driver selected, click Select to add it to the Selected drivers list for the application project:
Figure 48: TWCAT Driver Added to Selected Drivers List 5) Click OK to close the dialog. The TWCAT driver is inserted into the Drivers folder:
Figure 49: TWCAT Driver in the Drivers Folder The TWCAT driver is now ready for configuration. In most cases, you should not need to change the drivers communication settings because TwinCAT communications are managed by the TwinCAT software (or ADS library), according to how you configured it earlier. For more information, see Establishing Communication Between TwinCAT Stations starting on page 25. As such, you can proceed directly to building the driver worksheet.
Page 40/60
InduSoft Ltd.
Figure 50: Opening the Main Driver Worksheet The worksheet is opened for editing:
Figure 51: TWCAT Main Driver Worksheet The Disable, Read Completed, Read Status, Write Completed, and Write Status fields are used for checking read/write status and logging runtime errors. Theyre not necessary for this sample application, so you can proceed directly to making your first tag/register association.
InduSoft Ltd.
Page 41/60
2) Tab down to the Tag Name field in the first row of the worksheet table, and then enter the name of your IWS database tag:
Figure 52: Entering the Tag Name 3) If the tag is not already defined in your IWS database, then you will be prompted to create the tag now:
Figure 53: Creating a New Database Tag Click Yes. A New Tag dialog is displayed:
Figure 54: New Tag Dialog Size is the number of elements, if the tag is an array (0 is not an array); Type is the type of data (e.g., Integer, Boolean, Real, String); and Description is short description of the tag. For this sample application, you can accept the default values for the tag, so click OK.
Page 42/60
InduSoft Ltd.
4) Tab into the Station field and enter the station ID for the target PLC, I/O or control program:
Figure 55: Entering the Station For the TWCAT driver, the syntax of the Station field is: <AmsNetID>:<Runtime or Port Number> Where: <AmsNetID> is the AMS Net ID of the target station (see page 25); <Runtime> is the runtime number (1 , 2, 3 or 4) of the TwinCAT control program; and <Port Number> is the ADS port used for the TwinCAT PLC, TwinCAT NC or TwinCAT I/O communications. The following ports are implemented and tested in the current version of the TWCAT driver: o o o 301 TwinCAT I/O 800 BC9000 801, 811, 821, 831 TwinCAT PLC on Windows NT/2000/XP or Windows CE
For more information about AMS Net IDs and TwinCAT port numbers, please consult Beckhoffs documentation. Note You can also leave the Station field blank. If you do, then the driver will automatically communicate with the first TwinCAT PLC runtime on the same workstation or device. This is equivalent to entering a value of 127.0.0.1.1.1:801. This feature is typically used when the same IWS application will be deployed to multiple devices; you do not need to customize the addressing for each device. However, you must have both IWS (or CEView) and TwinCAT installed and running. 5) Tab into the I/O Address field and enter the program variable or register address on the target station:
InduSoft Ltd.
Page 43/60
In this example, .MyTcVar_Int16 is a Global Variable defined within a TwinCAT control program running on the target station. For more information about TwinCAT program variables and device registers, please consult Beckhoffs documentation. Note If you want to actually download and run your sample application (see page 50), then this must be a real program variable on a real TwinCAT station. Otherwise, you will receive communication errors during runtime. With the Tag Name, Station and I/O Address fields completed, youve established an association between the tag in your IWS database and the variable in your TwinCAT control program. Now you must specify what action is taken and when. 6) In the Action field, click on the pull-down menu and select the type of action to be taken on this tag:
Figure 57: Selecting the Action Where: Read is only read values from the target station into the IWS database; Write is only write values from the IWS database to the target station; and Read+Write is both read from and write to the target station.
7) In the Scan field, click on the pull-down menu and select when the values are scanned:
Figure 58: Selecting the Action Where: Screen is only when the value of the tag is changed by user input (e.g., a button press or text entry) from your HMI screen; and Always is on every execution cycle.
Page 44/60
InduSoft Ltd.
8) From the main menu bar, select File Close. You will be prompted to save the driver worksheet:
Figure 59: Saving the Driver Worksheet 9) Click Yes to save and close the driver worksheet. MyTag is now ready to be used in an HMI screen. Note Although it is good to know how to manually build a driver worksheet, you can also use the Import Wizard to automatically build a driver worksheet from your existing TwinCAT program variables and communication settings. For more information, see Advanced: Importing Your TwinCAT Variables into IWS on page 54.
InduSoft Ltd.
Page 45/60
Figure 60: Inserting a New Screen The Screen Attributes dialog is displayed:
Figure 61: Screen Attributes Dialog for New Screen 2) Enter a description for the screen, such as TWCAT Driver Test Screen. Leave the screen Size and Location settings at their default values, and then click OK.
Page 46/60
InduSoft Ltd.
DRAFT 8 September 2006 The new screen (display) is opened for editing:
Figure 62: Editing a New Screen 3) From the Static Objects toolbar, select the Text tool:
Figure 63: Selecting the Text Tool 4) Using the Text tool, click in the screen and type This is the Value of .MyTcVar_Int16: followed by six hash marks (#).
The hash marks will be used to define a dynamic text I/O field. Six hash marks means that the field will be six characters long.
InduSoft Ltd.
Page 47/60
Getting Started with IWS and TwinCAT 5) Click again on the text to highlight it.
Figure 64: Highlighting the Text Object 6) From the Dynamic Properties toolbar, select the Text I/O tool:
Figure 65: Selecting the Text I/O Tool By selecting the Text I/O tool while the text object is highlighted, you are adding the Text I/O dynamic property to the object. 7) Right-click the text object and then choose Properties from the pop-up menu.
Figure 66: Opening the Object Properties The Object Properties dialog is displayed. 8) Click the () button to the right of the Tag/Expression field.
Figure 67: Object Properties for Text Object with Text I/O
Page 48/60
InduSoft Ltd.
Figure 68: Opening a Tag Browser 9) Select MyTag from the tag list and then click OK. The tag is added to the Object Properties dialog:
Figure 69: MyTag Added to Text I/O 10) Click (enable) the Input Enabled checkbox to allow the user to input a value during runtime.
Figure 70: Enabling Input for Text I/O The value is applied to MyTag in the IWS database, and from there it is written to the TwinCAT program variable on the target station. Also, make sure the Minimum and Maximum Values are valid for the selected tag; e.g. a signed integer, in this instance, dictates a range of -32768 to 32767.
InduSoft Ltd.
Page 49/60
10) From the main menu bar, select File Save. You will be prompted to give the screen a filename; you can change the name or accept the default (e.g., Display1.scr). Either way, click OK to save the screen in your project directory. With your tag defined and your screen laid out, you can specify the screen for startup.
3) In the Startup screen field, enter the filename of your application screen. Note If you saved the screen with the default fiilename, then it should be something like Display1.scr. You can also check the list of screens in the Graphics tab of the Workspace. 4) Click OK to close the Project Settings dialog. You can now compile and test your application.
Page 50/60
InduSoft Ltd.
Figure 71: Watching MyTag in the Database Spy 2) From the main menu bar, select Project Run Application. The application will run locally in the CEView emulator.
InduSoft Ltd.
Page 51/60
3) Enter a new value into the text I/O field and watch the tag change in the Database Spy.
Figure 73: Entering a New Value for MyTag 4) When you are done, select Project Stop Application from the main menu bar. Note If the Quality of the tag is GOOD, then the new value is successfully being written to the TwinCAT program variable on the target station. If the Quality of the tag is BAD, then IWS is receiving a communication error from the TWCAT driver. Check your TwinCAT communication settings and your TWCAT driver worksheet.
Page 52/60
InduSoft Ltd.
Figure 74: Application Tab of Execution Environment Dialog 4) Click Send To Target to download your application to the target device. 5) When the download is complete, click Run to run the application on the target device. The Status field will display the status of your application on the device. You can also start and stop the application by using the Remote Agent control panel on the device:
InduSoft Ltd.
Page 53/60
Figure 76: Symbol Configuration Control Panel 4) Enable (check) the Dump symbol entries option. 5) Click the Configure symbol file button. The Set object attributes dialog is displayed.
Page 54/60
InduSoft Ltd.
IWS can only import program objects (POUs) and global variables. It cannot import libraries or other system settings, so you must make sure those items are not included in the exported file. 6) In the program directory tree, select only the POUs and Global Variables that you want to export to IWS. (Ctrl-click to select/deselect individual items.)
Figure 77: Selecting Program Objects and Global Variables for Export 7) Disable (uncheck) all export options other than Export variables of object. This will ensure that only basic variable definitions are exported, rather than any metadata or other structures.
Figure 78: Disabling All Export Options 8) Click OK to accept the configuration and return to the Options control panel. 9) Click OK to close the Options control panel. 10) From the main menu bar, select Project Rebuild All. As TwinCAT rebuilds the project, it generates the symbol file and saves it in the project directory. The symbol file is now ready for import into IWS. It will have the same name as the project file from which it was generated, so for a TwinCAT project named Maschine.pro, the symbol file is named Maschine.sym. Keep in mind that the symbol file will be regenerated every time you rebuild your TwinCAT project, so if in the future you make changes to your project, you must consider whether you also need to reimport the symbol file into IWS. InduSoft Ltd. Page 55/60
Figure 79: Selecting TwinCAT PLC Database 4) Click Next to proceed to the next step of the wizard.
Page 56/60
InduSoft Ltd.
5) Enter the AMS Net ID and port number of the TwinCAT runtime, station or device with which your IWS application will communicate. (For more information, see Establishing Communication Between TwinCAT Stations on page 25.)
Figure 80: Specifying the AMS Net ID and Port Number The import wizard will use this information to build the driver worksheet. Note If you plan to have IWS and TwinCAT running together on the same workstation or device, then you can specify an AMS Net ID of 127.0.0.1.1.1 and a port number of 801. This will instruct IWS to communicate with the first TwinCAT runtime that is running locally. This feature is typically used when the same IWS application will be deployed to multiple devices; you do not need to customize the addressing for each device. However, you must have both IWS (or CEView) and TwinCAT installed and running on every device.
InduSoft Ltd.
Page 57/60
6) Click the Browse button to open a standard Windows file browser, and then find the TwinCAT symbol file that you want to import into IWS. The file should be saved in your TwinCAT project directory.
Figure 81: Browsing for the Symbol File 7) Click Open to select the file and return to the import wizard.
Figure 82: Symbol File Selected 8) Click Next to proceed to the next step of the wizard.
Page 58/60
InduSoft Ltd.
9) Review the variables (i.e., tags) exported from TwinCAT, and deselect (uncheck) any variables that you do not want to import into IWS.
Figure 83: Reviewing the Variables To Be Imported 10) Click Finish to proceed with the import.
Figure 84: Finshing the Import Process As the import process finishes up, it does several things for you automatically: Selects and configures the TWCAT communication driver; Creates new IWS database tags that correspond to the imported TwinCAT variables; and Configures the Main Driver Sheet to associate the new database tags with the TwinCAT variables at the specified AMS Net ID.
InduSoft Ltd.
Page 59/60
Getting Started with IWS and TwinCAT When it is done, it should look something like the figure below.
Figure 85: Final Results of the Database Import Wizard Make sure you thoroughly review both the TWCAT communication settings and the driver worksheet. If everything is satisfactory, then you can proceed to develop the rest of your IWS application as you normally would. For more information about using the database import wizard, please refer to Importing a Database in Chapter 3 of the IWS User Guide.
Page 60/60
InduSoft Ltd.