PLC

Creating a TMC file and adding it to the TwinCAT project

The following section describes how to create a TMC file and add it to the TwinCAT project. Multiple addition of the TMC file in the same TwinCAT project is not permitted.

A stand-alone PLC project has been created (e.g. "SeparatePlcProject"), which contains a PLC project (e.g. "PLC1").
A TwinCAT project has been created into which the stand-alone PLC project is to be integrated (e.g. "SeparateTc3Project").
1.
Open the stand-alone PLC project and select the PLC project object ("PLC1 Project") in the PLC project tree.
2.
Select the command Build (Build <PLC Project Name>) from the context menu or the Build menu.
The PLC project is compiled and checked for errors. If the compilation is successful, the TMC file is created.
 standaloneplcproject_build_en-us
3.
Open the TwinCAT project and select the PLC object in the TwinCAT project tree.
4.
Select Add Existing Item from the context menu or the Project menu.
 separatetc3project_add_en-us
The standard dialog for opening a file appears.
5.
Select the TMC file and click Open to add it to the project.
 separatetc3project_add_tmc_open_en-us
The PLC instance of the stand-alone PLC project and the referenced tasks are added to the TwinCAT project. If a system task with the name of the referenced task of the PLC project already exists in the TwinCAT project, no new task is added. Instead, the existing system task is linked to the added PLC instance.
 separatetc3project_referencedplc_en-us
 

Automatic reloading of the TMC file

In the settings of the PLC instance, you can specify that the TMC file should automatically be reloaded when the stand-alone PLC project is changed. Double-click on the PLC instance of the stand-alone PLC project in the project tree to open the PLC instance settings in the editor. On the Object tab, tick the Auto Reload TMI/TMC check box.

 
 
 

Manual reloading of the TMC file

To manually reload the TMC file in the TwinCAT project when the stand-alone PLC project changes, select the PLC instance of the stand-alone PLC project in the project tree and select TMI/TMC File > Reload TM/TMC File from the context menu.