Twincat Getting Started PDF
Twincat Getting Started PDF
Twincat Getting Started PDF
Getting Started
with IWS and TwinCAT
Contents
Introduction ............................................................................................................2
Quickstart for Beckhoff CX1020 or CX1000 .......................................................................... 3
Note
– This document assumes that you are familiar with the Microsoft Windows NT/2000/XP envi-
ronment, including how to move files, manage system preferences, establish network con-
nections, and install new software. If you do not have this familiarity, then please consult
the Windows Help feature as you work through this document.
Introduction
This document describes how to configure InduSoft Web Studio (IWS) and Beckhoff’s TwinCAT con-
trol software to run together on various Microsoft Windows-based devices, as well as how to estab-
lish communication between those devices on an Ethernet network.
The following diagram shows a mixed device network using both InduSoft and Beckhoff software
components:
TCP/IP
InduSoft
CEView Component provided by InduSoft
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 Beckhoff’s Automation Device Specification (ADS) library,
which makes a compatible workstation or industrial PC running Windows NT/2000/XP, an embed-
ded 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,
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 de-
vice 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.
TwinCAT InduSoft
runtime CEView
(preinstalled)
ADS TWCAT
Library driver
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 up-
date 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 Se-
ries device in an existing production environment. If you need more thorough instructions,
then please review this entire document.
Note
– Although the full version of IWS can be downloaded from InduSoft’s Web site, you must
have a valid license to run it beyond the free evaluation period. Please contact your Indu-
Soft sales representative for licensing options, and consult the InduSoft Web Studio User
Guide for more information about applying the license.
Also included in IWS are all of the communication drivers available at the time of release. However,
these drivers are always under development, so a newer version of the TWCAT driver may be
available. You can download the latest TWCAT driver from InduSoft’s up-to-date driver list at
www.indusoft.com.br/download/drivers/.
Note
– Although the full version of TwinCAT can be downloaded from Beckhoff’s Web site, you must
have a valid license to run it beyond the free evaluation period. Please contact your Beck-
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 dif-
ferent 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 Beckhoff’s 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 CE-
based 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.
ActiveSync can be downloaded for free from Microsoft’s Web site at:
http://www.microsoft.com/windowsmobile/addons/
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.
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
Microsoft’s 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.
3) Install and license the full TwinCAT development software, as described in its own documen-
tation.
Installing TwinCAT will automatically enable communication between the PC and other TwinCAT-
compliant devices, so you do not need to do anything else to configure IWS.
3) Acquire the ADS communication library (see page 4), and locate the following files therein:
\TcAdsDll\AdsDll.dll
\TcAdsDll\TcAdsDll.dll
\TcAdsDll\TcAdsTest.exe
\TcAdsDll\TcAmsRemoteMgr.exe
4) Copy all four files to the \BIN directory of your IWS installation. For example…
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 Sta-
tions,” on page 25.
It’s possible that there simply isn’t 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.
Note
– This custom installer is only available for Beckhoff CX Series devices running Windows CE.
There is no equivalent for CX Series devices running Windows XPe; see “Installing IWS on a
Beckhoff CX1020 Running Windows XPe” above.
CX Series devices can be ordered from Beckhoff with this custom installer already applied; the op-
tion is listed in Beckhoff’s catalog as “CX1800-0005 InduSoft HMI CE Runtime.” The installer can
also be downloaded from Beckhoff’s Web site and run by the user, in case a device is ordered with-
out the InduSoft option.
InduSoft and Beckhoff work together to try to make sure this installer always includes the latest
version of CEView. It is important to have the latest version installed on your CX Series device, in
order to correctly run your IWS applications. Working with different versions of IWS and CEView
may result in serious errors.
Unfortunately, it’s still possible for InduSoft and Beckhoff to fall out of sync, so that even a freshly
downloaded installer may include an old version of CEView. As such, when you receive a new de-
vice with the InduSoft option or when you run the installer yourself, you should still use the Execu-
tion Environment tool in IWS to update CEView on the device.
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.
Note
– The address given above is correct at the time of this writing, but it may become in-
valid as Beckhoff updates their Web site. You can also use the site’s navigation tree
to find the Web page; it should be listed under Download > Software > Embedded PC.
2) Copy the installer file to the device. You should save the file in the device’s \Hard
Disk\System directory.
3) Locate the installer file on the device and double-tap its icon. This will run the installer.
4) Follow the on-screen installation instructions. When the installer prompts you to confirm the
creation of the \Hard Disk\InduSoft directory, tap the OK button.
The CEView files are installed in the \Hard Disk\InduSoft directory, and the system regis-
try is updated.
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.
Configure the Device Connection settings as needed, depending on how you’ve 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.
3) Configure the Target Station settings as needed, depending on how you’ve connected the
device to your workstation. For complete instructions, please consult the InduSoft Web Stu-
dio User Guide.
4) Click Connect to establish communication with the device.
If communication is successfully established, then the Status and Platform fields will be up-
dated 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 device’s 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.
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 device’s “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 you’ve already used the Execution Environment tool to connect to the
device and update the CEView software (see the previous page), then it’s 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:
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 device’s 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.
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:
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 device’s actual site
code is generated when CEView is installed, and it is unique to your device.
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:
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.
Note
– This section discusses Windows CE-based devices in general. Beckhoff’s CX Series devices
(i.e., the CX1020 and the CX1000) are discussed in the previous section.
Any Windows CE-based device can be made a fully compatible node in your TwinCAT/InduSoft sys-
tem, but it requires a few extra steps because the device does not come with any of the necessary
software preinstalled and there is no custom installer to do it for you.
Since this is not a Beckhoff device, you cannot install the full TwinCAT runtime software. Instead,
you can install the ADS library that enables communication with other TwinCAT nodes. You can
then install InduSoft CEView, which ties into and communicates through the ADS library.
In general, the rest of this section describes the following procedure:
1) Determine the OS version and processor type of your Windows CE-based device.
2) Install the ADS library that is appropriate to the processor type.
3) Install the Remote Agent utility and configure it to start automatically on boot.
4) Use the Execution Environment tool in IWS to establish communication between your work-
station and the device, and then install CEView on the device.
5) Enter your runtime license for CEView.
Before you proceed, make sure that you meet the following prerequisites:
You must have the full IWS development software installed on your workstation;
Your Windows CE-based 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 device’s Compact
Flash memory card, or by copying across the network.
For help with meeting these prerequisites, please consult Microsoft’s documentation for Windows
CE and the manufacturer’s documentation for the device.
Note
– “Windows CE .NET” is another name for Windows CE 4.x.
\TcAdsDllCe\setup\TcAdsDllCe.<processor type>.CAB
\TcAdsDllCe\setup\TcAdsDllCe.MIPS.CAB
Please note that each cabinet file is a complete installer. You will only need one file — the
one that corresponds to your device’s processor type — to install the ADS library.
2) Copy this file to the device’s persistent (non-volatile) file storage. If you don’t know where
this is, then please consult the manufacturer’s documentation.
The directory structures of different Windows CE-based devices can vary greatly, and the
device manufacturer may require that files be stored in a specific directory, so please con-
sult the manufacturer’s documentation.
3) Go to the Windows CE device, locate the cabinet file there, and double-tap its icon to run it.
4) Follow the on-screen instructions, if any.
5) When the installation is finished, reboot the device to save the new files and settings to per-
sistent (non-volatile) memory.
The ADS library should now be installed on your Windows CE device. You will verify it in the next
section, “Establishing Communication Between TwinCAT Stations,” on page 25.
…where:
– <IWS directory> is the directory where you installed IWS;
– <OS version> is the version of Windows CE running on your device (see note); and
– <processor type> is the processor type that is in your device.
Note
– For devices running Windows CE 3.x, use the files located in the \Redist\CeView di-
rectory.
– 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:
Configure the Device Connection settings as needed, depending on how you’ve 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.
3) Configure the Target Station settings as needed, depending on how you’ve connected the
device to your workstation. For complete instructions, please consult the InduSoft Web Stu-
dio User Guide.
4) Click Connect to establish communication with the device.
If communication is successfully established, then the Status and Platform fields will be up-
dated 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 device’s persistent (non-
volatile) memory.
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 device’s “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 you’ve already used the Execution Environment tool to connect to the
device and update the CEView software (see the previous page), then it’s 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:
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 device’s 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.
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:
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 device’s actual site
code is generated when CEView is installed, and it is unique to your device.
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:
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.
Note
– By default, the TwinCAT software is configured to start automatically on boot.
3) Right-click on the TwinCAT icon and select Properties from the pop-up menu:
6) Click OK to apply your changes and close the TwinCAT System Properties 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:
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:
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 Win-
dows CE, then the default Username is administrator with no password.
If the logon is successful, then the station will be marked as connected in the route list:
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 Beckhoff’s 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.
Note
– Even though this file is installed as part of the TwinCAT runtime engine or ADS li-
brary, it can be difficult to find since the installation of the library varies by plat-
form. For more information, please see pages 7 and 19.
– You can also use the Windows Search function to find the file more quickly, but re-
member to search for the actual filename (TcAmsRemoteMgr.exe).
2) Double-click (or double-tap) on the utility to run it. The AMS Remote Connections dialog is
displayed:
3) Check the default AMS Net ID for the local station and change it if necessary.
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, “Sup-
portPC” 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 net-
work 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 Beckhoff’s documentation and/or the hardware
manufacturer’s documentation for more information.
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 connec-
tions 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 de-
vice, 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 manufacturer’s documentation.
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 connec-
tion 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 Sam-
ple IWS Application” on the next page.
Using the instructions below, you will create a IWS/CEView application screen that displays a Twin-
CAT program variable (a.k.a. PLC register) on the Beckhoff CX1000. Of course your network con-
figuration 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 Beckhoff’s documentation for TwinCAT.
– Also, please keep in mind this is only a basic walkthrough for creating a sample IWS appli-
cation. For complete instructions on using IWS, please see the IWS User Guide.
2) From the main menu bar, select File New. The New dialog is displayed:
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.
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.)
4) With the TWCAT driver selected, click Select to add it to the Selected drivers list for the appli-
cation project:
5) Click OK to close the dialog. The TWCAT driver is inserted into the Drivers folder:
The TWCAT driver is now ready for configuration. In most cases, you should not need to change
the driver’s communication settings because TwinCAT communications are managed by the Twin-
CAT 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.
The Disable, Read Completed, Read Status, Write Completed, and Write Status fields are used for check-
ing read/write status and logging runtime errors. They’re not necessary for this sample ap-
plication, so you can proceed directly to making your first tag/register association.
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:
3) If the tag is not already defined in your IWS database, then you will be prompted to create
the tag now:
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.
4) Tab into the Station field and enter the station ID for the target PLC, I/O or control program:
For the TWCAT driver, the syntax of the Station field is:
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 301 — TwinCAT I/O
o 800 — BC9000
o 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 Beck-
hoff’s 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 mul-
tiple devices; you do not need to customize the addressing for each device. How-
ever, 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:
In this example, .MyTcVar_Int16 is a Global Variable defined within a TwinCAT control pro-
gram running on the target station. For more information about TwinCAT program variables
and device registers, please consult Beckhoff’s 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, you’ve 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:
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:
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.
8) From the main menu bar, select File Close. You will be prompted to save the driver work-
sheet:
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 pro-
gram variables and communication settings. For more information, see “Advanced: Import-
ing Your TwinCAT Variables into IWS” on page 54.
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.
4) Using the Text tool, click in the screen and type “This is the Value of .MyTcVar_Int16: ” fol-
lowed 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.
6) From the Dynamic Properties toolbar, select 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 67: Object Properties for Text Object with Text I/O
9) Select MyTag from the tag list and then click OK. The tag is added to the Object Properties
dialog:
10) Click (enable) the Input Enabled checkbox to allow the user to input a value during runtime.
The value is applied to MyTag in the IWS database, and from there it is written to the Twin-
CAT 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.
10) From the main menu bar, select File Save. You will be prompted to give the screen a file-
name; 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.
Note
– This sample application is for education and demonstration ONLY. Do not deploy any IWS
application in a live production environment without thoroughly testing it first.
It is easy to test a sample application locally: IWS has a built-in CEView emulator that executes the
HMI screen as if it was downloaded to an actual Windows CE-based device, and the Database Spy
can show how the tag values change as the screen is used.
To test your application locally:
1) In the Database Spy, select MyTag for watching.
2) From the main menu bar, select Project Run Application. The application will run locally in the
CEView emulator.
3) Enter a new value into the text I/O field and watch the tag change in the Database Spy.
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 communi-
cation settings and your TWCAT driver worksheet.
Note
– This sample application is for education and demonstration ONLY. Do not deploy any IWS
application in a live production environment without thoroughly testing it first.
If you’ve already established a connection with a Beckhoff PLC or other Windows CE-based device,
using the Execution Environment tool in IWS (see pages 14 and 21), then you can also download
your sample application to that device and run it.
1) Make sure that the Remote Agent utility (CEServer.exe) is running on the target device.
2) From the main menu bar, select Project Execution Environment. The Execution Environment
dialog will appear. Check your Target Station settings and then click Connect.
If you cannot establish a connection with the target device, then check your physical cabling
and TwinCAT communication settings.
3) Once a connection is made, select the Application tab of the Execution Environment dialog:
Note
– This section assumes that you are already familiar with using TwinCAT to develop and de-
ploy control programs, and that you have a program ready to import into IWS. For complete
instructions on using TwinCAT, please consult Beckhoff’s documentation.
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.
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 gen-
erates 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.
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 Communi-
cation Between TwinCAT Stations” on page 25.)
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 mul-
tiple devices; you do not need to customize the addressing for each device. How-
ever, you must have both IWS (or CEView) and TwinCAT installed and running on
every device.
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 pro-
ject directory.
7) Click Open to select the file and return to the import wizard.
9) Review the variables (i.e., tags) exported from TwinCAT, and deselect (uncheck) any vari-
ables that you do not want to import into IWS.
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.
Make sure you thoroughly review both the TWCAT communication settings and the driver work-
sheet. If everything is satisfactory, then you can proceed to develop the rest of your IWS applica-
tion as you normally would.
For more information about using the database import wizard, please refer to “Importing a Data-
base” in Chapter 3 of the IWS User Guide.