Ethernet - Setting up the bus terminals
Hardware Requirements:
- Ethernet - Bus coupler (BK9000)
- 1 bus terminal with 4 digital outputs (KL2114)
- Bus end terminal (KL9010)
This example is exactly appropriate for the contents of this Ethernet bus station. The hardware is however exchangeable. In this case, the configuration of the I/O devices has to be changed.
Setting up the bus coupler and the terminals
Set up the bus coupler and the bus terminals as shown in the drawing below:
Hardware Documentation
Further information about the hardware connection contains the hardware documentation of the bus coupler.
TwinCAT PLC Configuration
It must the extended version of the 'Machine'-project on the first run time the local PLC arranged its. 'Machine_Final' corresponds to the changes in this chapter was made.
Download PLC samples: Samples PLC
Start the TwinCAT in Config-Mode
Click in the taskbar right down on the symbol of TwinCAT, then goto System/Config. This TwinCAT is started in config-mode , which makes the scanning possible of the boxes.
Starting the TwinCAT System Manager
Once the system has been started, the color of the icon changes from red to blue. Now start the TwinCAT System Manager by selecting 'Start'-> 'Programs' -> 'TwinCAT System' -> 'TwinCAT System Manager'.
The items of the TwinCAT System Manager
In the first line is the name of the project, (here 'unbenannt'), amount there´s the command line (menu) and the toolbar. In the last line you can see the status of the system, in this picture, the system is running (RTime). The two windows in the middle contains the configuration of the system. In the following steps you´ll configure the system.
The system configuration is shown as a tree structure on the left side of the System Manager. It consists of the following four main points:
Konfiguration | Meaning |
---|---|
System | Configuration of the system and real time parameters |
NC | (Optional) Append the NC-tasks and configure them. |
PLC | All PLC Projects that are required to be configured |
Cam | (Optional) Append Cam Group |
I/O | In order to link the controller to the process level, the system needs interfaces. This entry offers a list of all interfaces. |
PLC Configuration:
The individual PLC projects must be made known to the System Manager so that TwinCAT can access the variables of the PLC programs. To do this, press the right mouse button while the mouse pointer is over 'PLC configuration'.
A context menu opens, in which you must select the 'Append PLC project…' entry.
Switch to the your '\TwinCAT\Samples\FirstSteps\TwinCAT' directory and select the 'Machine_Final.tpy' file.
A further point has been added under 'PLC configuration' which bears the name of the PLC project.
The + and the - symbols indicate whether the entry contains a further subpoints. By clicking these symbols, you open or close the entries below them. The following structure appears if you open the tree as far as possible:
Setting up real-time Ethernet
Before you can use real-time Ethernet-capable devices (BK9000), your network card must be furnished with associated drivers.
In the menu bar select 'Options/List of real-time Ethernet compatible devices...'
The following dialog has four subitems:
Installed and ready to use devices | The network connections listed here are real-time Ethernet-capable and can be used |
Compatible devices | Network connections listed here are real-time Ethernet-capable in principle, although they still requires the associated drivers. Click on 'Install'. If the installation was successful the network connections will be shown under 'Installed and ready to use devices' |
Incompatible devices | The network connections listed here are not real-time Ethernet-capable. |
Disabled devices | Network connections listed here are deactivated and are currently not available. |
To continue, at least one network connection must be available under 'Installed and ready to use devices'.
I/O Configuration
Add a device
Insert the I/O devices in the same way like the PLC configuration.
With TwinCAT 2.9 the devices can be scanned automatically ('Scan devices'). Found devices are listed afterwards under I/O devices in the tree view.
The the target system has to be in Config Mode for this function.
Select the 'I/O devices' entry with the right mouse button. A context menu opens, in which you must select the 'Scan devices' entry.
The following window containing a list of all found devices opens. Select the "RT-Ethernet" device. If several devices of this type are listed, select the device that accords to the network connection of the BK9000.
TwinCAT scans the connected peripheral and lists the found devices ->Confirm with 'OK'.
Select your BK9000 and confirm with 'OK'. Don't activate the 'Free Run'.
Expand the tree view by clicking on the '+' symbol to the left of it. As can be seen, the terminals connected to the Bus Coupler have been automatically detected and added.
Now, the System Manager shows the found I/O configuration:
It goes without saying that you can rename the standard designations (device 1, box 1, terminal 1 etc.) To do this, slowly double click the corresponding name and enter the new designation.
Assigning variables to the input/output channels:
Up to this point, the complete hardware needed for the above example program has been configured. Next, the individual variables from the PLC project must be assigned to the individual input/output channels.
To do this, mark the terminal you wish to configure. A dialog box containing the input and output channels of the connected peripheral opens. Select the 'Variables' tab.
You see a list of the four output channels, but they are still all free. Select for all variables of the wanted digital output channel.
Terminal 2 | PLC variables | Meaning |
---|---|---|
Terminal 1 (=output 1) | DeviceUp | Drill up control |
Terminal 2 (=output 2) | DeviceDown | Drill down control |
Terminal 3(=output 3) | Engine | Stepper motor control |
Assignments of the bus terminals:
Project activation
Saving the project
You should save the configuration at this point to make sure you can access it later on. To do this, run the 'Save as…' command from the 'File' menu.
Mapping variables:
You have now configured the complete system for the above example program. You must now create the allocation for the registry. To do this, go to the 'Create mapping' command in the 'Actions' menu. Under the 'Mappings' tree entry, you now see 'Maschine (Standard) - Device 1 (RT-Ethernet)'. Click this entry. The following window opens on the right side:
You can define whether the data flow from A to B or from B to A is to be displayed. In this case, Image A corresponds to the process image of the PLC variables, i.e. the input/output variables. Image B corresponds to the process image of the I/O devices, in this case of the BK9000bus coupler. Each variable or bus terminal is color highlighted in the process image. If you stop on one of these areas with the mouse, a small display box appears in which the precise designation is shown. With a right mouse click you can zoom the picture.
Writing the configuration to the registry
As the last step, you must save the configuration to registry because the information stored there is evaluated when you start TwinCAT. Run the 'Save in registry…' command from the 'Actions' menu. If an older configuration is already stored there, a safety prompt will appear, which you must confirm.
Restarting TwinCAT:
TwinCAT wants to restart in the 'Run Mode' to take the changes. Confirm the dialog of the System Manager with 'OK'.
Maybe the PLC project Machine_Final.pro' has to be reloaded
The individual PLC variables are now output on the bus terminal KL2404. The Bus Terminals indicate their signal state by means of light emitting diodes.
Further information about the TwinCAT System Manager can be found in the Beckhoff Information System.