beckhoff TwinCAT 3 — 15.8 Sample10: module communication: Using data pointer

C++-samples | Sample10: module communication: Using data pointer 15.8 Sample10: module communication: Using data pointer | Sample10: module communication: Using data pointer This article describes the implementation of two TwinCAT 3 C++ modules, which communicate via a data pointer. Download Here you can access the source code for this sample: https://github.com/Beckhoff/TC1300_Samples/tree/main/S10-Mod2ModDataPointer 1. Using a Visual Studio with TwinCAT installed, open the project via Open Project .... 2. If you want to run the project on Windows or TwinCAT/BSD ® (not required for Beckhoff RT Linux ® ):

Configure signing for this project by right-clicking on the project on the page, selecting Project -> Properties -> TC Sign , enabling TwinCAT signing, and configuring your certificate and password if necessary. Further information on signing C++ projects can be found in the chapter TwinCAT [ } 21] . 3. Select your target system. 4. Build the sample (e.g. Build->Build Solution ). р The sample is ready for operation. 5. Activate the configuration by clicking . Description This communication is based on a "split" data area: Provided by a module and accessible from another module via pointers.

It is not possible that two different data pointers are linked with the same entry in an output or input data area; without this limitation there could be synchronization problems. For this reason a ModuleDataProvider module consolidates input and output in a standard data area, which is not subject to this restriction. All in all, this sample includes the following modules: ModuleDataProvider provides a data area, which can be accessed by the other modules. The data area contains 4 bits (2 for input, 2 for output) and 2 integers (1 for input, 1 for output).

ModuleDataInOut provides "normal" input variables, which are written to the data area of the ModuleDataProvider, and output variables, which are read from the data area. This instance of the CModuleDataInOut class serve as a simulation for real IO. TwinCAT 3 256 Version: 1.19.1