Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
NOTA DE APLICAO 02
Princpios bsicos da programao de PLC para
CX com TwinCAT PLC
BRESIMAR (asaTek)
e-mail j.andril@bresimar.pt
B-NA02(v1.1)
Janeiro/2009
Table Of Contents
1.
2.
3.
4.
5.
6.
Updated: 07/09/2005
Page 2 of 31
Revision: 1.5
22/11/2004
V1.3
22/02/2005
Ethernet driver
V1.4
V1.5
23/05/2005
05/07/2005
Updated: 07/09/2005
Page 3 of 31
Revision: 1.5
1. Local PC Configuration
1.1. Firewall Settings
TwinCAT uses ports 48898 and 48899 to communicate with remote systems via the
Ethernet network. If a firewall is installed on the local PC, it will almost certainly block
these ports by default, and prevent TwinCAT from configuring remote systems. The first
indication of this problem will be a failure to find any remote TwinCAT systems on the
network, even though they can be pinged successfully from the local PC.
Firewall ports 48898 (for TCP) and 48899 (for UDP) should be opened with full
read/write access for TwinCAT to use. There are currently no known issues with
Windows Firewall or other firewall packages if these ports have been opened
successfully.
NOTE: full local administrator rights will almost certainly be needed to open ports
on the Windows Firewall. Other firewall packages may have password protection
on port configuration to prevent viruses and other people from opening ports
unexpectedly.
and it is impossible to find all the settings required to prevent interference with the
TwinCAT traffic through the Ethernet port.
In particular, Norton and McAfee security suites are both known to spuriously cause
problems with the broadcast search for remote TwinCAT devices, resulting in no remote
devices being found, event though they exist on the network and can be seen with the
Ping command. They have also been known to corrupt AMS route settings for no
apparent reason, which can interfere with the TwinCAT PLC connection during
debugging.
NOTE: it is STRONGLY recommended that Norton and McAfee anti-virus software
should be disabled while using TwinCAT.
Updated: 07/09/2005
Page 4 of 31
Revision: 1.5
subnet masks between themselves and join the network. Please note that this process
can take up to 1 minute to complete.
To determine the actual IP address assigned to the CX1000:
1. Ping the CX1000 using the NetBIOS name
2. If the ping command is successful, the actual IP address will be shown in square
brackets after the NetBIOS name. The CX1000 has successfully joined the
network, and is ready to be configured as required. Go to chapter 3, Modifying
the CX1000 IP Address Settings on page 6.
3. For the mask bytes set to 0, at least one of the corresponding IP address bytes
must be different to thCX1000
4. Ping the CX1000 using the CX1000 IP address or NetBIOS name
5. If the ping command is successful, the actual IP address will be shown in square
brackets after the NetBIOS name. The CX1000 has successfully joined the
network, and is ready to be configured as required. Go to section 3, Modifying
the CX1000 IP Address Settings on page 6.
the settings are unknown, the IP address and subnet mask must be changed manually.
If the CX1000 has a DVI/USB module fitted, local configuration can be used to
modify the IP address and subnet mask settings. Go to section 3.3, Local
Configuration on page 8 for full details.
If the CX1000 does NOT have a DVI/USB module fitted, or a suitable keyboard,
mouse or screen are not available, the CX1000 image on the CF card must be
restored to the base image. Go to section 5, Restore/Upgrade CX1000 on page
20.
Updated: 07/09/2005
Page 5 of 31
Revision: 1.5
ensuring that a particular device will always be assigned the same IP address, and no
other device will get that particular IP address. However, if a replacement device is
fitted, the DHCP server configuration must be updated to ensure that the IP address is
associated with the Ethernet MAC address of the new device.
a device with a specified IP address is present on the Ethernet network. Ping sends 4
request messages (1 per second) to the specified IP address and displays the responses
that are received. The screenshot below shows a successful ping command to IP
address 192.168.3.4.
Updated: 07/09/2005
Page 6 of 31
Revision: 1.5
If no response is received, the device either does not exist, or other factors e.g.
firewall, incorrect subnet mask, etc. are preventing the local PC from seeing the
response. In this case, the local PC will not be able to access the target device. Refer
to chapter 1, Local PC Configuration on page 4.
3.1.2. Cloning CX1000 CF Cards
If a CX1000 CF card is cloned AFTER the NetBIOS name has been generated, all
CX1000s fitted with the cloned CF card will have the same NetBIOS name. While this
does not cause a problem for the functionality of the CX1000 and TwinCAT, network
problems will occur when cloned CX1000s are connected to the same network.
In addition, the NetBIOS names and the last 3 bytes of the Ethernet port MAC address
will not match on cloned CX1000s, making it more difficult to identify which CX1000 is
actually communicating with TwinCAT System Manager, or other applications.
Updated: 07/09/2005
Page 7 of 31
Revision: 1.5
3.2.2. Windows CE
TwinCAT System Manager can be used to modify the settings shown on the screen
capture below on a CX1000 running Windows CE. Proceed to Chapter 4, Programming
Remote TwinCAT Systems on page 11 to continue CX1000 configuration.
To change any other Windows CE settings on the CX1000, use the procedure described in
section 3.3, Local Configuration on page 8.
Updated: 07/09/2005
Page 8 of 31
Revision: 1.5
Updated: 07/09/2005
Page 9 of 31
Revision: 1.5
3.4.2. Windows CE
CERHost can be used to connect to a CX1000 running WinCE and display the CX1000
desktop on the local PC. The CX1000 can now be configured via the Control Panel in the
same way as any other WinCE device from the local PC.
CERHost can be downloaded from www.microsoft.com and will run on any Windows
platform. Refer to section 6.7, Using CERHost on page 27 for further details.
Updated: 07/09/2005
Page 10 of 31
Revision: 1.5
4. Select Search
Updated: 07/09/2005
Page 11 of 31
Revision: 1.5
TwinCAT System Manager will scan the Ethernet network, and display the details of all
TwinCAT-enabled systems that it found on the network.
6. Select the CX1000 that you want to connect to as the remote system
7. Click Add Route
Any remote TwinCAT systems found on the network will be displayed, along with the
TwinCAT version and installed operating system on the remote system.
Updated: 07/09/2005
Page 12 of 31
Revision: 1.5
When the route to the CX1000 has been established, X will be shown in the
Connected column next to the CX1000 host name. The version of WinCE operating
system should also be noted for future reference. As this process may take up to 15
seconds to complete, use the Refresh Status button to re-check the CX1000 status.
NOTE: the error message below may appear if the CX1000 IP address has been
modified, as the CX1000 NetBIOS name will still be associated with the old IP
To re-create the route to the CX1000 in the Add Route Dialog window:
Updated: 07/09/2005
Page 13 of 31
Revision: 1.5
Updated: 07/09/2005
Page 14 of 31
Revision: 1.5
Manager displays the current target system and the operating status of the current
target system at the bottom right hand side of System Manager Window.
NOTE: CX1000 with WinCE V4.10 may not automatically store a new route when it
is created, and it will be lost when the CX1000 is powered down. The route must
be stored manually by suspending the CX1000. Refer to section 6.5 , Manually
Storing Settings on WinCE CX1000 on page 24.
For details about upgrading a CX1000, refer to section 5.2, CX1000 with Windows CE
V4.10 on page 21.
Updated: 07/09/2005
Page 15 of 31
Revision: 1.5
3.
4.
5.
6.
Updated: 07/09/2005
Page 16 of 31
Revision: 1.5
7. Enter User name and Password. These are both blank by default.
8. Click OK
At this point, the CX1000 has been shut down. Cycle the power supply to the CX1000 to
Updated: 07/09/2005
Page 17 of 31
Revision: 1.5
1. Select Online
2. Select Choose Run-Time System
Updated: 07/09/2005
Page 18 of 31
Revision: 1.5
The target PLC system will be displayed in the red box at the bottom right of the
TwinCAT PLC Control screen.
Updated: 07/09/2005
Page 19 of 31
Revision: 1.5
a fixed IP address has been set and forgotten, etc. In this case, it may be desirable to
restore the CX1000 to its basic state, i.e. the state when it left the factory.
NOTE: restoring a CX1000 CF card to the base image will wipe all user settings and
Option Description
CX1800_02nn_
Yyyy_mm_dd_
xxx_
vvv
5.1.2. Windows CE
The image version on a WinCE CX1000 is indicated by the version file in the root of the
CF card. V1.75 indicates that WinCE image file version 175 is currently installed. The
version file can be viewed in the \Hard Disk folder by double clicking the My
Computer icon on the CX1000 itself, using local or remote configuration. Alternatively,
the file name can be checked by reading the CF card using a PC and CF card reader.
The image file name has the following format:
CX1800_01nn_yyyy_mm_dd_CX_xxx_www_vvv.ZIP
Option Description
CX1800_01nn_
Yyyy_mm_dd_
xxx_
www_
vvv
Updated: 07/09/2005
Page 20 of 31
Revision: 1.5
without problems.
cannot read the CF card due to file system corruption, contact Hayes Control
Systems Ltd for further help.
Updated: 07/09/2005
Page 21 of 31
Revision: 1.5
2. A base directory will be created that indicates the version of the image. In the
example, the directory name is V175
3. Copy all files from the V175\WithTc\CF directory to the root of the CF card if
TwinCAT is required on the CX1000
4. Copy all files from the V175\WithoutTc\CF directory to the root of the CF card
if TwinCAT is not required on the CX1000
Updated: 07/09/2005
Page 22 of 31
Revision: 1.5
6. Additional Information
6.1. TwinCAT System Configuration
Once the target TwinCAT system has been selected, the CX1000 system is configured
using TwinCAT System Manager in exactly the same way as a local TwinCAT system
would be configured.
Getting Started note Configure the TwinCAT IO System is available as a PDF document
from Hayes Controls to guide the user through configuring and downloading the CX1000
hardware system using TwinCAT System Manager.
configured.
Getting Started note Mapping TwinCAT PLC Variables to IO is available as a PDF
document from Hayes Controls to guide the user through configuring and downloading
the PLC program using TwinCAT PLC Control.
mask for the PC Ethernet port settings to be the same as the subnet mask for the
CX1000.
The subnet mask also affects the IP address that must be specified for the PC Ethernet
port. If a byte in the subnet mask is set to 255 (0xFF), the corresponding byte of the IP
address must be the same in the PC and CX1000. This is shown in the table below.
Setting CX1000
PC
Subnet mask
255.255.255.0
255.255.255.0
IP address
192.168.1.x
192.168.1.y
Comment
The subnet mask settings must be
identical
The first 3 IP address bytes must equal,
the 4th byte must be different.
Updated: 07/09/2005
Page 23 of 31
Revision: 1.5
1. To access the CX1000, use local configuration (see section 3.3) or remote
connection. (See section 3.4.2)
2. Click Start
3. Select Suspend
The CX1000 will shut down and re-boot to make any new settings take effect.
Updated: 07/09/2005
Page 24 of 31
Revision: 1.5
Updated: 07/09/2005
Page 25 of 31
Revision: 1.5
The IP address and subnet mask settings can now be modified using the same method as
with a keyboard and mouse on a normal PC.
Updated: 07/09/2005
Page 26 of 31
Revision: 1.5
1. Run CERHOST.EXE.
2. Select Tools and ensure that Send all mouse move is ticked.
Updated: 07/09/2005
Page 27 of 31
Revision: 1.5
The IP address and subnet mask settings can now be modified using the same method as
with a keyboard and mouse on a normal PC.
Updated: 07/09/2005
Page 28 of 31
Revision: 1.5
3. Right click TwinCAT icon at bottom right of the screen and select Poperties
4. Select the AMS Router tab
5. Select the devices that need to be deleted and click Remove. The route to the
device has now been removed from the AMS router. Click OK when complete.
If a Win32 error occurs when trying to remove a device, the route must be removed
manually from the Windows registry. Follow the procedure described in section 6.8.1,
Removing Corrupt Routes Manually on page 30.
Updated: 07/09/2005
Page 29 of 31
Revision: 1.5
The local TwinCAT AMS Router will be re-started, and the TwinCAT System will return to
Config mode.
6.8.1. Removing Corrupt Routes Manually
Occasionally, it is possible to get 2 or more routes configured in the AMS Router with the
same name. If this happens, the routes cannot be removed in the normal way, and must
be removed manually from the Windows registry.
To remote a route from the Windows registry:
Updated: 07/09/2005
Page 30 of 31
Revision: 1.5
3.
4.
5.
6.
7.
8.
Select My Computer
Select HKEY_LOCAL_MACHINE
Select SOFTWARE
Select Beckhoff
Select TwinCAT
Select Remote
Each configured route will have its own folder, but the folder for a corrupt route will
Updated: 07/09/2005
Page 31 of 31
Revision: 1.5