beckhoff TwinCAT 3 — 15.9.2 Calling methods offered by another module via PLC

C++-samples | Sample11: Module communication: method call PLC module to C++ ... р The implementation of the FB_StateMachine, which acts as the proxy for calling the C++ module instance, is completed. Step 7: Calling FB in PLC The FB_StateMachine is now called in the POU MAIN. This simple sample acts as follows: Cyclic incrementation of a PLC counter nCounter If nCounter = 500, the C++ StateMachine is started with the state "1" to increment its internal C++ counter. Then read the state of C++ using GetState(). If nCounter = 1000, the C++ state machine is set to the state "2" in order to decrement its internal C++ counter. Then read the state of C++ using GetState().

If nCounter = 1500, the C++ StateMachine is stopped. The PLC nCounter is also set to "0", so that everything starts again from the beginning. TwinCAT 3 282 Version: 1.19.1