Samples

The TcCOM_Sample01 sample shows how TcCOM communication can take place between two PLCs. In the process functionalities from one PLC are directly called up from the other PLC.

The TcCOM_Sample02 sample shows how a PLC application can use functionalities of an existing instance of a TwinCAT C++ class. In this way separate algorithms written C++ (or Matlab) can be used easily in the PLC.
Although in the event of the use of an existing TwinCAT C++ module the TwinCAT C++ license is required on the target system, a C++ development environment is not necessary on the target system or on the development computer.

The TcCOM_Sample03 sample shows how a PLC application uses functionalities of a TwinCAT C++ class by generating an instance of C++ class at the same time. In comparison to the previous sample this can offer increased flexibility.

You will find additional programming examples in the documentation of TwinCAT 3 C++. For example, it describes an additional option for calling an algorithm written in C++ from a PLC program (Sample11). In contrast to TcCOM_Sample02, here a wrapper module is programmed that each interface method implements itself. Therefore this variant is more complex. However, if you have to forego interface pointers calling the functionalities in the PLC application due to users, this variant offers an option for doing this.

Another example in the documentation of TwinCAT 3 C++ shows how a TwinCAT C++ Module calls up a method of a function block of the PLC by TcCOM interface (Sample13).