我想找...

搜尋

函式庫參考

目錄

[ 入門指南 ] QEC-M-01 與 NPM PULSERVOII & EC-AD 系列

[教程]

我們很高興推出全新的技術指南,協助工程師與系統整合商開始使用 QEC-M-01(EtherCAT MDevice),並搭配 NPM PULSERVOIINPM EtherCAT 系列伺服驅動器,實現即時且高效能的運動控制。

為了更好地支援半導體、電子與工業自動化產業,本指南提供逐步設定流程、實用程式碼範例,以及整合建議,協助您最大化 EtherCAT 運動控制應用的效能。


1. 新指南亮點

The QEC‑M‑01 is a compact and powerful EtherCAT MDevice equipped with a real-time architecture and integrated development tools. Powered by the open-source 86Duino IDE, it offers a simple yet powerful development platform for automation.

當搭配 NPM PULSERVOII 與 EC-AD 系列產品,並在 CiA402—Profile Position(PP)模式下運作時,它可在嚴苛的運動控制系統中實現精準且快速響應的控制。

NPM PULSERVOII 與 EC-AD 系列驅動器是相容 EtherCAT 的閉迴路馬達控制解決方案,專為高精度與高穩定性而設計。PULSERVOII 系列結合步進馬達的優點與編碼器回授,可避免失步問題,提供平順且可靠的運動控制。EC-AD 系列支援 CiA402,並具備最快 250 μs 的 Distributed Clock(DC)同步能力,可實現精準的多軸協調控制。

兩款驅動器皆具備小巧尺寸與高響應特性,非常適合:

  • 高速組裝系統: 確保自動化機械手臂與檢測平台中的精準定位與穩定性。
  • 精密設備:為 CNC 機台與半導體設備提供平順的加速、減速與原點復歸操作。
QEC_NPM_1

1.1 入門指南的優點

  • 逐步設定指南:
    無論您是初學者還是經驗豐富的開發者,我們的指南都能協助您正確連接並設定 QEC-M-01 與 NPM EtherCAT 驅動器。
  • 程式範例:
    本指南包含 CiA 402 – Profile Position(PP)模式的詳細程式範例,協助您實現從精準定位到彈性控制等各種應用。
  • 應用場景:
    憑藉其小巧設計與精準回授,PULSERVOII driver 與 EC-AD drives 非常適合多軸平台、機械手臂取放應用,以及 SMT 或包裝產線中的高速送料機。

2. 開始使用 QEC-M-01 與 NPM EtherCAT 驅動器

無論您是剛接觸 EtherCAT,還是經驗豐富的運動控制開發者,我們的指南都提供所有必要工具,協助您開始將 QEC-M-01 與 NPM EtherCAT 驅動器進行整合。

2.1 PULSERVO II:Profile Position(PP)模式

以下程式將 NPM Pulservo II 設定為 CiA402 Profile Position(PP)模式:

  • EtherCAT 週期時間:1 毫秒。
  • EtherCAT 模式: ECAT_SYNC。

這個 EthercatMaster 物件 ("mdevice”) 代表 QEC-M-01,而 EthercatDevice_CiA402 物件 ("motor”) 代表 NPM Pulservo II 驅動器。

#include "Ethercat.h"

EthercatMaster mdevice;
EthercatDevice_CiA402 motor;

int pp_state = 0;

void setup() {
  Serial.begin(115200);
  while (!Serial);

  Serial.print("Begin: "); Serial.println(mdevice.begin());
  Serial.print("Slave: "); Serial.println(motor.attach(0, mdevice));
  Serial.print("Start: "); Serial.println(mdevice.start(1000000, ECAT_SYNC));

  motor.setCiA402Mode(CIA402_PP_MODE);
  Serial.print("Enable: "); Serial.println(motor.enable());
  motor.pp_SetMotionProfileType(0); // Linear ramp (trapezoidal profile)
  motor.pp_SetVelocity(100000);
  motor.pp_SetAcceleration(5000);
  motor.pp_SetDeceleration(5000);
}

void loop() {
  Serial.print("Pos: "); Serial.println(motor.getPositionActualValue());
  switch (pp_state)
  {
    case 0:
      if (motor.pp_Run(100000) == 0)
        pp_state++;
      break;
    case 1:
      if (motor.pp_IsTargetReached())
        pp_state++;
      break;
    case 2:
      if (motor.pp_Run(-100000) == 0)
        pp_state++;
      break;
    case 3:
      if (motor.pp_IsTargetReached())
        pp_state = 0;
      break;
  }
}

2.2 PULSERVO II:Cyclic Synchronous Position(CSP)模式

以下程式將 NPM Pulservo II 設定為 CiA402 Cyclic-Synchronous Position(CSP)模式:

  • EtherCAT 週期時間:1 毫秒。
  • EtherCAT 模式: ECAT_SYNC。
  • Distributed Clock:啟用。依循週期時間。

這個 EthercatMaster 物件 ("master”) 代表 QEC-M-01,而 EthercatDevice_CiA402 物件 ("motor”) 代表 NPM Pulservo II 驅動器。運動命令是在 1 ms 的週期性 callback 中產生,透過以固定速率(定速)遞增或遞減命令位置,並在到達行程限制時切換方向來實現。

#include "Ethercat.h"

EthercatMaster master;
EthercatDevice_CiA402 motor;

int32_t position = 0;

void MyCyclicCallback()
{
  if (motor.getCiA402State() != CIA402_OPERATION_ENABLED) return;

  // Set the target position under csp.
  static int dir = +1;
  if (position >= 100000)  dir = -1;
  else if (position <= -100000) dir = +1;
  position += dir * 100;
  motor.setTargetPosition(position);
}

void setup() {
  Serial.begin(115200);

  Serial.print("Begin: ");
  Serial.println(master.begin());

  Serial.print("Slave: ");
  Serial.println(motor.attach(0, master));
  motor.setDc(1000000);
  motor.setCiA402Mode(CIA402_CSP_MODE);

  // Register a callback function.
  master.attachCyclicCallback(MyCyclicCallback);
  Serial.print("Start: ");
  Serial.println(master.start(1000000, ECAT_SYNC));

  // Set target position to current position for safe.
  motor.setTargetPosition(position = motor.getPositionActualValue());
  Serial.print("Enable: ");
  Serial.println(motor.enable());
}

void loop() {
  // Print Position.
  Serial.print("Position: ");
  Serial.println(motor.getPositionActualValue());
  delay(1000);
}

如需進一步了解,請點擊以下連結查看完整指南:


我們將持續提供穩定且創新的 EtherCAT 自動化平台,打造更智慧、更快速且更高效率的控制系統。我們誠摯邀請合作夥伴與開發者探索 QEC 解決方案,應用於您的下一個創新自動化專案。

如需更多資訊或樣品申請,請寄信至  info@icop.com.tw、致電最近的 ICOP 分支機構,或聯絡我們的全球官方經銷商

返回頂端