TwinCAT 3 - first steps
Zahteve zaključka
In this tutorial, we will demonstrate how to create a project, connect to an industrial controller, and upload a test program.
Creating a project in Visual Studio
- First, open the integrated development environment Visual Studio 2019 and click on
Create a new project
, to create a new project. - In the
Create a new project
dialog, selectTwinCAT XAE Project
and clickNext
. - Then, specify the project name and click
Next
. - Next, right-click on the
PLC
subfolder to open the menu, where you clickAdd New Item...
. SelectStandard PLC Project
, specify the project name, and clickAdd
.
Povezovanje na napravo
- In the toolbar, click on
<Local>
and selectChoose Target System...
from the options. - A window will appear with already connected devices. To connect to a new device, click
Search (Ethernet)
. - A dialog for searching controllers will open; press the
Broadcast Search
button to search for devices. - A window will appear where you select the network interfaces through which you want to search for devices and click
OK
. - Industrial controllers will be named PLC-1 ... PLC-9. Select the controller that has been assigned to you and press the
Add Route
button. A window will open where you enter the username and password. The username isAdministrator
, and the password isavtomatika
. Once successfully connected to the controller, a lock icon will appear next to the name, and then clickClose
.
Setting up inputs and outputs
- To set up inputs and outputs, we first need to activate configuration mode by clicking the blue icon in the toolbar.
- Right-click on
Device
and clickScan
to automatically add inputs and outputs.
Uploading to the PLC
- We upload the program to the controller by pressing the
Activate configuration
button located in the taskbar. - If a dialog appears with the text
Some required runtime licenses missing. Generate trial licenses.
, clickYes
and enter the CAPTCHA code, and then clickOK
.
Working without the physical system connected
If we want to develop and test the software solution without a physical system, we need to disable the input-output modules and select the local computer as the target system for compiling our code.
- Right-click on
I/O
→Devices
→Device 3 (CX7000)
. - In the context menu, click
Disable
. - Repeat the same for
Device 1 (EtherCAT)
.