Join us today!

Notifications
Clear all

Add a Virtual Axis

1 Posts
1 Users
1 Reactions
502 Views
Posts: 16
Moderator
Topic starter
(@treyem)
Member
Joined: 2 years ago

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.

Add Virtual   Step 1

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.

Add Virtual   Step 2
Add Virtual   Step 3

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.

Add Virtual   Step 4

5. Define the axes as type AXIS_REF in the PLC project. This can be done in a GVL or POU declaration.

Add Virtual   Step 5

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.

Add Virtual   Step 6

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.

Add Virtual   Step 7

8. Activate configuration to have the links take effect.

Add Virtual   Step 8a

 

Reply
Share: