Create TwinCAT 3 C++ Module instance
An instance of the module must be created in order to execute it. Several instances of a module can exist.
After creating a TwinCAT C++ module, open the C++ node and follow these steps to create an instance.
- 1. Right-click on the C++ module (in this case "Untitled1") and select Add New Item....
- All existing C++ modules are listed.
- 2. Select a C++ module. You can use the default name or alternatively enter a new instance name and confirm with OK (in this sample the default name was selected).
- The new instance "Untitled1_Obj2 (CModule1)" becomes part of the TwinCAT 3 Solution: the new node can be found exactly under the TwinCAT 3 C++ source "Untitled1 Project".
The module already provides a simple I/O interface with 3 variables in each case:
- Input Area: Value, Status, Data
- Output Area: Value, Control, Data
The description of these interfaces corresponds in two places:
- "<Classname>Services.h" (in this sample "Untitled1Services.h")
- "TwinCAT Module Configuration".tmc file (in this sample "Untitled1.tmc")