Skip to content

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

  1. Select "New TwinCAT Project …" via the Start page.
  2. Alternatively, a new project can be created by clicking on FileNewProject (All existing project templates are displayed)
    Figure1 Figure 1. TwinCAT3 - New Project
  3. Select "TwinCAT XAE Project"; a suitable project name can optionally be entered.
  4. Click on "OK".
    Figure2
    Figure 2. TwinCAT3 - Project Configuration

System Scanning

  1. Scan devices

    • Right click on DeviceScan.
    • Then, every module will be displayed.
      Figure3
      Figure 3. TwinCAT3 Project - Scan for CORE Module

      Note: 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.
      Figure4
      Figure 4. TwinCAT3 Project - Scanning Result
  2. 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
      Figure5
      Figure 5. TwinCAT3 Project - CORE EtherCAT SDO

      Figure6
      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)
    Figure7
    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.

    Figure8
    Figure 8. TwinCAT3 Project - Operation Values of CORE's PDO

References