Implement TwinCAT 3 C++ project
This article describes how the sample project can be changed.
The implementation begins after creating a TwinCAT C++ project and opening <MyClass>.cpp (Module1.cpp in this sample).
- 1. The <MyClass>::CycleUpdate() method is cyclically called – this is the point where the cyclic logic is to be positioned. At this point, add the entire cyclic code. Use the drop-down menu at the top of the editor for navigation.
- 2. In this case a counter is incremented by the value of the Value variable in the input image (
m_Inputs
). Replace a line in order to increment the counter without dependence on the value of the input image.
Replace this line:m_counter+=m_Inputs.Value;
with this one:m_counter++;
- 3. Save the modifications.
- 4. If you have prepared the module for Online Change, please note that version 0.0.0.1 has been implemented here, as you can see in the TMC editor.
- 5. The project can now be built and the actual implementation is done until local tests are successful.