TwinCAT Tutorial
Introduction
- This shows the test of CORE module with TwinCAT 3.x and Visual Studio 2010 (or any other compatible versions).
- It requires that you have a working TwinCAT 3.x on Windows PC and installed network driver for TwinCAT.
Create TwinCAT 3 Project
- Select "New TwinCAT Project …" via the Start page.
- Alternatively, a new project can be created by clicking on File ⇨ New ⇨ Project (All existing project templates are displayed)
Figure 1. TwinCAT3 - New Project
- Select "TwinCAT XAE Project"; a suitable project name can optionally be entered.
- Click on "OK".
Figure 2. TwinCAT3 - Project Configuration
System Scanning
-
Scan devices
- Right click on Device ⇨ Scan.
- Then, every module will be displayed.
Figure 3. TwinCAT3 Project - Scan for CORE ModuleNote: Before scanning, the ESI file for CORE module must be added to proper TwinCAT location. Also, the TwinCAT driver must be installed for Network Interface Card (NIC) Please refer to "Setting tips" section for guideline.
- If CORE module was properly connected, a new ‘Box’, Box 1(NRMK Drive), is detected and added to devices list. Double click on Box 1 and see its basic information.
Figure 4. TwinCAT3 Project - Scanning Result
-
SDO & PDO Information
- Click on CoE – Online tab to check more detailed EtherCAT information
- Upper area displays all objects on drive
- Lower area is default mapped PDO objects
Figure 5. TwinCAT3 Project - CORE EtherCAT SDO
Figure 6. TwinCAT3 Project - CORE EtherCAT PDO
Servo-On
- Click on ‘Online’ tab, be sure that the drive device is in OP mode
- In PDO object area, the initial value of statusword is 545 (0x211), drive is in Ready to switch on state
- Right click on controlword object and select Online Write and assign value of 7 for controlword (transition 3)
- Drive is now in Switch on state with statusword = 563 (0x233)
Figure 7. TwinCAT3 Project - Servo On
Running
- Before enable drive, we should change operation mdoe to Torque Mode (CST). Right click on mode_of_operation object, select Online Write and * input 10 to change mode to CST.
- Repeat previous step to assign controlword with a new value, 15 (0x0F) to perform transition 4.
- Drive is now in Operation enable state with statusword = 567 (0x237), mode_of_operation = 10 (CST).
-
Simple assign target_torque with a suitable value (e.g. 96) and, CORE is in motion.
Important: At this step, CORE will move, be sure that there is not any obstacle on CORE. Do NOT input too large target_torque value which can cause CORE over speed.
Figure 8. TwinCAT3 Project - Operation Values of CORE's PDO