Modules | Module-to-module communication Sample12: Module communication: Using IO mapping [ } 285] IO Data Pointer Direct memory access is also possible within a task via the Data Area Pointers, which are created in the TMC Editor. If several callers of a task or callers from other tasks occur, the user must ensure the data consistency through appropriate mechanisms. Data pointers are available for C++ and MATLAB ® . The following sample shows the implementation: Sample10: Module communication: Use of data pointers [ } 256] Method calls via interfaces As already described, TcCOM modules can offer interfaces that are also defined in the TMC editor.
If a module implements them ( "Implemented Interfaces" in the TMC editor [ } 111] ), it offers appropriate methods. A calling module will then have an "Interface Pointer" to this module in order to call the methods. These are blocking calls, meaning that the caller blocks until the called methods come back and the return values of the methods can thus be directly used. If several callers of a task or callers from other tasks occur, the user must ensure the data consistency through appropriate mechanisms. The following samples show the implementation: Sample11: Module communication: PLC module invokes method of C module [ } 257] Sample11a: Module communication:
C module calls a method of another C module [ } 284] Further samples exist for the communication with the PLC [ } 304] . ADS As the internal communication of the TwinCAT system in general, ADS can also be used to communicate between modules. Communication in this case is acyclic, event-controlled communication. At the same time ADS can also be used to collect or provide data from the UserMode and communicate with other controllers (i.e. via the network). ADS can also be used to ensure data-consistent communication, e.g. between tasks/cores/CPUs. In this case TcCOM modules can be both clients (requesters) and servers (providers). The implementing language (PLC, C++, Matlab ® ) is irrelevant.
TwinCAT 3 47 Version: 1.19.1