Join us today!
Add a Virtual Axis
Virtual axes are helpful tools to have when axes needed to be coupled together. Here are the steps to add a virtual axis into TwinCAT and prepare it for PLC control.
1. Open a TwinCAT 3 project.
2. Right-click Motion and choose 'Add New Item…'. Select 'NC/PTP NCI Configuration' from the pop-up to create a motion controller.
3. Right-click 'Axes' under the NC-Task and add the amount of axes required for the project. The Type will be 'Continuous Axis'. The axes will be available under the Axes tree of the NC-Task.
4. Ensure that the library 'Tc2_MC2' library is present under References in the PLC tree. If it is not, it can be added by right-clicking References --> Add library… --> Motion --> PTP. Select 'Tc2_MC2' and press OK. This will provide access to the AXIS_REF variable type.
5. Define the axes as type AXIS_REF in the PLC project. This can be done in a GVL or POU declaration.
6. Build the project by selecting Build --> Build Solution in the menu bar. The axes created in the PLC project will now be available to link to an axis. The instances for NcToPlc and PlcToNc are generated under the PlcTask Inputs and Outputs within the PLC Instance tree.
7. Select an axis under Motion --> NC-Task --> Axes and go to the Settings tab. Press 'Link To PLC…' to select the variable definition for the respective axis. By linking the axes to a PLC variable definition, the axes can now be controlled using PLC logic.
8. Activate configuration to have the links take effect.
- 17 Forums
- 265 Topics
- 932 Posts
- 4 Online
- 688 Members