Creating a PLC project

Use PLC Control to create a PLC project. The next steps describe how to create a PLC project in TwinCAT and add it in the tree view.

Prerequisites for this step:

  • An Embedded PC, added in TwinCAT.

Create a PLC project as follows:

1. In the Start menu, right-click on the TwinCAT symbol.
2. In the context menu click on PLC Control.
Creating a PLC project 1:
The TwinCAT PLC Control window appears.
3. In the menu click on File > New and select the option PC or CX (x86).
4. Under Block type select the option Program, and under block language select the option ST (Structured Text).
Creating a PLC project 2:
5. Write a small program.
Creating a PLC project 3:
6. Save the PLC project and click on Project > Compile in the menu.

  • Once the project has been compiled, a file with the extension .tpy is created in the same location as the project file. The file name of the new file is the same as the file name of the PLC project.

    In the next step you can add the compiled PLC project in the TwinCAT System Manager.

 

Adding a PLC project

The PLC project can be added in the System Manager. The newly created variables from a PLC project are integrated in the System Manager and can be linked with the inputs and outputs of the hardware.

Prerequisites for this step:

  • An Embedded PC, added in TwinCAT.
  • A correctly compiled PLC project and a .tpy file.

Proceed as follows:

  1. Switch back to the System Manager window.
  2. Right-click on PLC – Configuration in the tree view on the left.
  3. In the context menu click on Append PLC Project.
    Creating a PLC project 4:
  4. Select a file with the extension .tpy in your system directory and confirm with OK.

    The PLC project is added in the tree view under PLC – Configuration. The variables defined in the project are shown under the inputs and outputs.
    Creating a PLC project 5:

    In the next step you can link the variables with the hardware.