
Downloading PLC Program to Actual Hardware
PLC Route
We use Visual Studio for developing TwinCAT software which can run in the PLC. We need to setup a path so that our development PC can find the path for communicating with the PLC.
It is littlebit different in TC3 as compared to TC2.
=> Press on the TwinCAT icon | Router | Edit Routes

Figure 01: TwinCAT 3 route settings
This action opens another dialog
=> Press on the Add button
=> Enter IP address of the PLC
=> Press on the Enter Host Name / IP button
=> Select the found PLC and insert login/password and Add Route
=> There should be a cross when route has been established
=> Now the PC and PLC should be able to communicate
PLC Route TC 2.0
Right click on the TwinCAT icon and properties
=> AMS Net Id is visible as seen in the following image
=> The following dialog can be found from the TC icon (bottom right corner)
=> The AMS net ID is set as 10.10.10.9.1.1 (this is PLC AMS Net ID)

Figure 02: TwinCAT AMS Net ID of PLC/Development PC
Now let see we have a TwinCAT 2.0 development PC and we want to set up the route between the developpment machine and the PLC
=> Open the system manager as shown in the following screenshoot

Figure 03: Creating route from TwinCAT 2 PC to a PLC

Figure 04: Searching PLC from another PC, similar to TC3 version but from Route settings menu from system manager
PLC Hardware:
Once we have developed our program in the Windows environment, we need to download the program to the actual IPC. If we want to download the program for the first time, activate the program. The following diagram shows what button should be used to activate the program (3rd from right side). Once the program is running then we can login for examining different variable from the engineering environment as shown first button from the left.

Figure 05: Different options related to project downloading in TwinCAT environment
Login:
Once our program is running, we may need to examine different variable from the program. We can press on the left button in the above image (Fig 01)
Application ‘Port_851’ does not exist on device “XX”. Do you want to create it and … :
We can see the above dialog sometimes, the reason could be the application does not exist or is not running or we can’t access it for some reason. Details might show some reason. If we are sure we can safely press the Yes button and continue.

Figure 06: If app is not running or we are not able to connect for some reason, we can see this dialog
If we want to create the program for auto start then it will not ask anymore. To do that we need to select “Autostart Boot Project” as shown in the next image.

Figure 07: Making a project with autostart
Download the update:
Once our program is running, we may need to update the program or need to fix bugs. So we change the program and download it to the IPC. If we try to login we see the following dialog.

Figure 08: Login option into the running TwinCAT project
Login with online change:
The change is loaded onto the controller. The program running on the controller is not stopped. The PLC project is logged in.
Login with download:
Program stops and we need to start again
Login without any change:
Details can give additional information about the project, changes etc
Tips 01:
=> When we have updated the program we may have changes for example in HW. In this case, we need to make sure the configuration and devices found are the same. If those are not the same then we can put the PLC to config mode and restart. If we restart from run mode to run mode then some information is not taken into effect.
=> Always, download the program with config mode
=> If we don’t activate the program then the content is not changed
=> When we restart the PLC, we can set the PLC to config mode before restart (this will make sure old configurations are loaded correctly)
Tips 02: An item with the same key has already been added
=> Most cases the reaons is that we have activated a project and we are activated similar project from the same machine.
=> The solution to this problem is that we restart the VS, clear the project and re activate

Figure 09: An item with key problem when activating project
Download the sample from the link given above.
Next, let’s try to understand PLC data type at https://www.hemelix.com/plc/linking-input-output-cards-to-plc-program/
Ask questions related to Hemelix sample code and design at Google group https://groups.google.com/g/hemelix